Jump to content

JIP MessageBoxExAlt in 51.2


sLoPpYdOtBiGhOlE

Recommended Posts

This post is to demonstrate a JIP problem work around and does not require a response from other nexus users.

 

After further testing there's definitely a timming issue when calling MessageBoxExAlt from a MenuButtonPressedUDF.
Calling RunScriptSnippet with a 15 frame delay from a MenuButtonPressedUDF seems to correct the issue.
I'm unsure if different computers may need longer timings.
But for me 10 frames or lower fails on my hardware.

Here is an example esp that demonstrates the message box work around:

Here are the scripts that are in the esp:

MBEAQuestScr for registering the M key to show the message box:

Scn MBEAQuestScr

Begin GameMode
    If GetGameRestarted
        SetOnKeyDownEventHandler fnMBEAKey 1 50 ;M Key
    EndIf
End

fnMBEAKey for firing the MessageBox when the m key is pressed:

Scn fnMBEAKey

Int iKey

Begin Function { iKey }
    Call fnMBEAShow 0
End

MenuButtonPressedUDF work around example (broken code commented out):

Scn fnMBEAShow

Int iButton
Ref rScr
String_Var sTxt

Begin Function { iButton }
    Set rScr To fnMBEAShow
    If iButton == 0
        ;MessageBoxExAlt fnMBEAShow "^Root Menu^Select Menu|Root Menu|Sub Menu|Exit"
        Let sTxt := "^Root Menu^Select Menu|Root Menu|Sub Menu|Exit"
        PlayerRef.RunScriptSnippet 15 "MessageBoxExAlt %q%i%q %q%z%q" rScr sTxt
    ElseIf iButton == 1
        ;MessageBoxExAlt fnMBEAShow "^Sub Menu^Select Menu|Root Menu|Sub Menu|Exit"
        Let sTxt := "^Sub Menu^Select Menu|Root Menu|Sub Menu|Exit"
        PlayerRef.RunScriptSnippet 15 "MessageBoxExAlt %q%i%q %q%z%q" rScr sTxt
    EndIf
    Sv_Destruct sTxt
End

Edit:

Notes:

RunscriptSnippet fails if the MessageBoxExAlt String Param is to long, so there is no way you could do 256 buttons using the above method.

Yes I do want to use 256 Buttons as that's the size of my adult follower framework :smile:

 

 

For using RunScriptSnippet like above then I use %%r for multi-line descriptions.

Using %r (direct call) or %%r (RunScriptSnippet) in MessageBoxExAlt description will cause the MessageBox Title and Description to be Left Justified.

Unexpected quirky behavior.

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...