Jump to content

Blinking DRAW_TEXT issue


JulioNIB
 Share

Recommended Posts

Anyone have experienced a issue with scriptHookRDRDotNet where the draw_text method results in a blinking text like if there was a Wait() being called somewhere?

 

I have this issue only in .net code, in .asi works fine. Also, if i reload scripts like 10 times, the bug disappears and text starts to appear as expected.

 

This is the actual code that is called in a Tick        

	Native.Function.Call(Native.Hash.SET_TEXT_SCALE, 0.0, scale)
        Native.Function.Call(Native.Hash._SET_TEXT_COLOR, col.R, col.G, col.B, col.A)
        Native.Function.Call(Native.Hash.SET_TEXT_CENTRE, bCentered)

        If bDropShadow Then
            Native.Function.Call(Native.Hash.SET_TEXT_DROPSHADOW, 1, 1, 1, 1, 1)
        Else
            Native.Function.Call(Native.Hash.SET_TEXT_DROPSHADOW, 0, 0, 0, 0, 0)
        End If

        '15533817421857667793UL = _DRAW_TEXT
        Native.Function.Call(15533817421857667793UL, Native.Function.Call(Of String)(Native.Hash._CREATE_VAR_STRING, 10, "LITERAL_STRING", sText), x, y)

 

Link to comment
Share on other sites

  • 2 weeks later...
On 6/23/2020 at 12:37 PM, LMS said:

You could try measuring the tick time and see if it perhaps skips a tick (maybe WAIT is not implemented correctly).

 

about the WAIT implementation, this is what we have in ScripthookV RDR DotNet plugin:

while (true)
    {
        // Yield execution and give it back to ScriptHookRDR2.
        scriptWait(0);

        // Switch to our CLR fiber and wait for it to switch back.
        SwitchToFiber(sScriptFiber);
    }

this method "scriptWait" is imported from scripthookRDR:

IMPORT void scriptWait(DWORD time);

 

its very odd this issue, if we disable VSync the blinking is even more visible, more fps, other methods like DRAW_RECT works perfect

Link to comment
Share on other sites

If DRAW_RECT works fine, then I guess it is not the waiting behavior. Perhaps the text buffer is messed up/mismanaged and gets cleared by accident sometimes?

Link to comment
Share on other sites

thats the actual code:

        Native.Function.Call(Native.Hash.SET_TEXT_SCALE, 0.0, scale)
        Native.Function.Call(Native.Hash._SET_TEXT_COLOR, col.R, col.G, col.B, col.A)
        Native.Function.Call(Native.Hash.SET_TEXT_CENTRE, bCentered)

        If bDropShadow Then
            Native.Function.Call(Native.Hash.SET_TEXT_DROPSHADOW, 1, 1, 1, 1, 1)
        Else
            Native.Function.Call(Native.Hash.SET_TEXT_DROPSHADOW, 0, 0, 0, 0, 0)
        End If

	'15533817421857667793UL the draw text method:
        Native.Function.Call(15533817421857667793UL, Native.Function.Call(Of String)(Native.Hash._CREATE_VAR_STRING, 10, "LITERAL_STRING", sText), x, y)

 

Link to comment
Share on other sites

It looks fine to me, but I was thinking perhaps the Script Hook mismanages the translation from a managed string to unmanaged and the buffer then gets cleared somewhere accidentally. But I have never used that Script Hook so I cannot say why exactly it would not work for text but works for rect.

Link to comment
Share on other sites

yeah, its a odd issue, i also noticed that if i bring the SNT menu (the trainer that comes with scripthookRDR by AB) and then close it, the blinking is reduced, seems that im missing to call something somewhere lol

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...