ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: tuxon on October 01, 2011, 12:06:32 PM

Title: Sessions interact
Post by: tuxon on October 01, 2011, 12:06:32 PM
Hi all,
i' m trying to find if there is a way to make a script execute actions directly on easyuo.
For example, i have easyuo opened with 3 sessions. My purpose will be like:

in script 3 (for example) make a command that, under a check, "hits" the pause button for script on tab 2.

I tryed with the click command, but it interact with the client and not with easyuo; is it possible to do this by other ways?
I want to put the pause command in another script for make it more reactive, if i put it in a main script may pass seconds before the check.
Title: Re: Sessions interact
Post by: freddy on October 01, 2011, 12:21:33 PM
You can use persistent  vars * (stores data in registry) or namespace vars !

http://wiki.easyuo.com/index.php?title=Variables

You can get a script to pause euo, but it wont be able to play again. You'd have to have a script scan for the var that tells it to pause and do something like
repeat
until *resume = #true  

then set that var to false
Title: Re: Sessions interact
Post by: Endless Night on October 01, 2011, 06:55:19 PM
The thing is if you main script doesnt detect a pause button pressed in it very fast it also wont detect a var set to pause very fast either.

If would recommend that you create a sub that checks for the pause button, and call it from many places in your script.
Title: Re: Sessions interact
Post by: tuxon on October 02, 2011, 12:01:18 PM
I have find this in a topic of the easyuo forum, but i don' t know what means :

Quote
I hope this helps ya out. You can add the check anywhere in your script as it uses a subroutine which will return it to its exact location in your script that it pauses at.


;This is assuming *77 is used as pause
;variable like above.. setting *77 in
;another euo window to "pause" will make
;this window enter a pauseloop until its
;set back to "ok".


Mainloop:
if *77 = pause
  gosub pause
<other code>
goto mainloop

Sub Pause
  Pause_Loop:
  if *77 <> ok
  goto Pause_Loop
return
Title: Re: Sessions interact
Post by: Endless Night on October 02, 2011, 05:59:17 PM
it means if you

set *77 Pause

in script A

and put the other code in script B in many many places.   Then script B will pause when *77 = pause and it comes arouse the line that checks if *77 = pause.
Title: Re: Sessions interact
Post by: Endless Night on October 02, 2011, 05:59:44 PM
of course you can also use the pause option from the easyuo menu.
Title: Re: Sessions interact
Post by: 12TimesOver on October 03, 2011, 07:38:16 AM
Moved to Scripting Chat.

X
Title: Re: Sessions interact
Post by: tuxon on October 03, 2011, 12:27:40 PM
For now i solved using a clicking program.

This program can click a portion of the screen, after setting the coordinates to click, and has an hotkey to run.
Easyuo opened on the tab of the main script, and the control-script run :
Code: [Select]
key S SHIFT
Shift-S is the hotkey of the clicking program. I set it with the coordinates of the pause button of easyuo.
So i can directly run a very little script to immediatly pause the main script without put lots of control in it.

This is a rough solution, but at the moment is the only i was able to make work  :P
I was also thinking make a little application to run by a "call" of easyuo, but i wasn' t able to compile it.
If i find an easy way to pause scripts i' ll post it.
Title: Re: Sessions interact
Post by: Endless Night on October 03, 2011, 05:34:00 PM
the easiest way to pause scripts is to inbuild that function into the script itself.
Most of my scripts have that function, but not everyone knows how.
Title: Re: Sessions interact
Post by: tuxon on October 04, 2011, 05:16:15 AM
but not everyone knows how.
I' m one of them  :P
I tryed to put a lot of checks for pause in a very big script, but the only result was that i make it looping hehehe

I' ll need to study more about scripting
Title: Re: Sessions interact
Post by: Cerveza on October 04, 2011, 05:37:14 AM
while *tuxon_pause = on
  wait 1

In the control script you can put the toggle for turning *tuxon_pause on or off.
Title: Re: Sessions interact
Post by: tuxon on October 04, 2011, 06:55:24 AM
I' ve done this sub for world save check:
Code: [Select]
scanjournal !i
      if #jcolor = 53
      {
         if THE_WORLD_WILL_SAVE_IN in #journal || WORLD_IS_SAVING in #journal
         {
            Event sysmessage  SAVE Detected
            key c ctrl alt ;pause
            event sysmessage SCRIPT PAUSED
         }
         if CLEANING in #journal
         {
            Event sysmessage  CLEANING Detected
            key c ctrl alt ;pause
            event sysmessage SCRIPT PAUSED
         }
         if COMPLETE in #journal
         {
            key s ctrl alt ;start
            event sysmessage SCRIPT RESUMED
         }
         if CLEANED in #journal
         {
            key s ctrl alt ;start
            event sysmessage SCRIPT RESUMED
         }
      }         

   nameSpace Clear
   nameSpace Pop
return

If i put it in a questing script i' ll have to insert a "gosub SAVE_CHECK" like 50 times and it goes crazy, this is the reason why i was trying to manage the main script without insert the control directly in it :)