JulioNIB 7 Posted June 22, 2020 Share Posted June 22, 2020 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) Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted June 22, 2020 Share Posted June 22, 2020 I think you have to use WAIT(0) or WAIT(1) or some low value. I once tried WAIT(500) and my texts were blinking to. Guess it has to do with the "refreshing" of the script. Quote Link to comment Share on other sites More sharing options...
JulioNIB 7 Posted June 22, 2020 Author Share Posted June 22, 2020 the problem is that im not calling any Wait() in the tick, so, there is no pause, just the normal script interval, and the issue disappears after some script reloads, very odd Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted June 23, 2020 Share Posted June 23, 2020 Oh, I must have misread your post. Sorry. Quote Link to comment Share on other sites More sharing options...
LMS 674 Posted June 23, 2020 Share Posted June 23, 2020 You could try measuring the tick time and see if it perhaps skips a tick (maybe WAIT is not implemented correctly). Quote Link to comment Share on other sites More sharing options...
JulioNIB 7 Posted July 1, 2020 Author Share Posted July 1, 2020 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 Quote Link to comment Share on other sites More sharing options...
LMS 674 Posted July 5, 2020 Share Posted July 5, 2020 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? Quote Link to comment Share on other sites More sharing options...
JulioNIB 7 Posted July 6, 2020 Author Share Posted July 6, 2020 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) Quote Link to comment Share on other sites More sharing options...
LMS 674 Posted July 8, 2020 Share Posted July 8, 2020 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. Quote Link to comment Share on other sites More sharing options...
JulioNIB 7 Posted July 8, 2020 Author Share Posted July 8, 2020 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.