PHP-Code:
scn bgCatsAndRatsChooseQuest
Short Button
Short MenuShown
Short DoOnce
Short Reset
Float FQuestDelayTime
Begin GameMode
Set FQuestDelayTime to 0.01
; set extremely low so that it grabs every button press ;
If Reset == 1
Set DoOnce to 0
Set Button to - 1
Set MenuShown to 0
Set Reset to 0
Endif
; included to reset the script when it 's running a second time;
If DoOnce == 0
; DoOnce necessary, because otherwise the menus show up indefinitely;
If bgCatsAndRatsSetting == 0
MessageBox "This version of Cats and Rats tags guards to stop them from going on a rampage. There are three tagging modes. Insecure (best perfomance, high miss chance). Semi secure (tagging once when entering a new cell. Small miss chance and nearly no perfomance loss). Secure (tagging every five seconds, nearly no misses, may cause small perfomance loss on some machines.) Current mode is insecure. Do you want to change it?" "Change to semi secure" "Change to secure" "Cancel"
Set MenuShown to 1
Set Button to GetButtonPressed
ElseIf bgCatsAndRatsSetting == 1
MessageBox "This version of Cats and Rats tags guards to stop them from going on a rampage. There are three tagging modes. Insecure (best perfomance, high miss chance). Semi secure (tagging once when entering a new cell. Small miss chance and nearly no perfomance loss). Secure (tagging every five seconds, nearly no misses, may cause small perfomance loss on some machines.) Current mode is semi secure. Do you want to change it?" "Change to insecure" "Change to secure" "Cancel"
Set MenuShown to 2
Set Button to GetButtonPressed
ElseIf bgCatsAndRatsSetting == 2
MessageBox "This version of Cats and Rats tags guards to stop them from going on a rampage. There are three tagging modes. Insecure (best perfomance, high miss chance). Semi secure (tagging once when entering a new cell. Small miss chance and nearly no perfomance loss). Secure (tagging every five seconds, nearly no misses, may cause small perfomance loss on some machines.) Current mode is secure. Do you want to change it?" "Change to insecure" "Change to semi secure" "Cancel"
Set MenuShown to 3
Set Button to GetButtonPressed
Endif
; I already tried to put GetButtonPressed to another parts of the script - it didn' t work ;
Set DoOnce to 1
Endif
If MenuShown == 1
Set Button to GetButtonPressed
If button == 0
Set bgCatsAndRatsSetting to 1
StopQuest bgCatsAndRatsGuardsSecure
StartQuest bgCatsandRatsGuardQuest
Message "Semi secure tagging enabled"
Set MenuShown to 4
ElseIf button == 1
Set bgCatsAndRatsSetting to 2
StartQuest bgCatsAndRatsGuardsSecure
StopQuest bgCatsandRatsGuardQuest
Message "Secure tagging enabled"
Set MenuShown to 4
ElseIf button == 2
Set MenuShown to 4
return
Endif
Endif
If MenuShown == 2
Set Button to GetButtonPressed
If button == 0
Set bgCatsAndRatsSetting to 0
StopQuest bgCatsAndRatsGuardsSecure
StopQuest bgCatsandRatsGuardQuest
Message "Insecure tagging enabled"
Set MenuShown to 4
ElseIf button == 1
Set bgCatsAndRatsSetting to 2
StartQuest bgCatsAndRatsGuardsSecure
StopQuest bgCatsandRatsGuardQuest
Message "Secure tagging enabled"
Set MenuShown to 4
ElseIf button == 2
Set MenuShown to 4
return
Endif
Endif
If MenuShown == 3
Set Button to GetButtonPressed
If button == 0
Set bgCatsAndRatsSetting to 0
StopQuest bgCatsAndRatsGuardsSecure
StopQuest bgCatsandRatsGuardQuest
Message "Insecure tagging enabled"
Set MenuShown to 4
ElseIf button == 1
Set bgCatsAndRatsSetting to 1
StopQuest bgCatsAndRatsGuardsSecure
StartQuest bgCatsandRatsGuardQuest
Message "Semi secure tagging enabled"
Set MenuShown to 4
ElseIf button == 2
Set MenuShown to 4
return
Endif
Endif
; MenuShown 4 is set once the game recognizes a button press , so the script is running until that is done . I can say that this scripts runs fine the first time , but fails to get the button press the second time and following ;
if MenuShown == 4
Set Reset to 1
StopQuest bgCatsAndRatsChoose
Endif
End