ScriptUO

Official ScriptUO EasyUO Scripts => Script Snippets => Topic started by: Cerveza on February 26, 2009, 11:45:37 AM

Title: Cerv's Pause Button
Post by: Cerveza on February 26, 2009, 11:45:37 AM
Put this at the beginning of the script, where it will only be called ONE time. Maybe in the setup, depending on your script.

Code: [Select]
gosub showEUOMenu1
That will bring up the PAUSE button.

Now put this somewhere in your mainloop:

Code: [Select]
if #MENUBUTTON = pause
  gosub pause_script

That will watch the button for when it's pressed to pause the script.

Now just put in these two subs near the end of your script:

Code: [Select]
sub pause_script
  set %script paused
  set #MENUBUTTON N/A
  menu delete pause
  menu Font BGColor Red
  menu Button pause 0 0 115 45 UnPause
  while %script = paused
  {
    if #MENUBUTTON = pause
    {
      set %script unpaused
      menu delete pause
      menu Font BGColor Lime
      menu Button pause 0 0 115 45 Pause
      set #MENUBUTTON N/A
    }  
  }
return

;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
menu Clear
menu Window Title CP
menu Window Color BtnFace
menu Window Size 113 44
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 16
menu Font Style
menu Font Color WindowText
menu Font BGColor Lime
menu Button pause 0 0 115 45 Pause
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------