Author Topic: Start Script at Specific Line  (Read 2074 times)

0 Members and 1 Guest are viewing this topic.

Offline RumplesTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 1
  • Rumples has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Start Script at Specific Line
« on: April 23, 2022, 04:54:34 PM »
0
I'm a total newb, so please excuse my ignorance.

 Is there a way to start a script at a certain line? I'm trying to figure out what is going wrong, and rather than starting the script from the top (because of course my troubles are midway through) I would like to start at a certain line. It could be something to do with the 'step over', 'step into', 'step out' options but I have no idea what those mean. I pause when the script doesn't do what I want, so I have a general idea of where it is going awry, but because I'm clueless I am kind of just stumbling along with changing things and hoping they work, it would be much easier to start from where the issue is.

I tried to search for this but I couldn't find anything. I'm sure i'm just using the wrong verbiage...

Thanks

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 489
  • Activity:
    0.6%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +50
  • Referrals: 3
    • View Profile
Re: Start Script at Specific Line
« Reply #1 on: April 23, 2022, 10:08:26 PM »
0
So the various commands do this:
F6 - execute the rest of this routine or called external until you return from it, then pause there
F7 - execute 1 line at a time and pause before executing the next line
F8 - (step over) can be used to execute a whole subroutine or called external (you can't actually pause and step through a called external script)
F9 - run (no automatic pause control exists with this command)


When I want to stop at a known spot in the script, I will add a pause statement. A more flexible method is to set a value and pause if that value is set.

Code: easyuo
  1. set %debug _ , MYVALUE , _
  2. for %i 1 100
  3.  {
  4.  wait 10
  5.  }
  6. ; now in this loop, I want to set the pause, but only when %debug has the value _MYVALUE_ in it
  7. if _ , MYVALUE , _ in %debug
  8.  {
  9.  pause
  10.  ; so it will stop at this line and you can use the F6 - F9 keys to control program flow from this point
  11.  ; you can also check and set the values of variables using the right side of the easyuo program
  12.  }
  13.  
  14. for %i 1 10
  15.  {
  16.  wait 10
  17.  }
  18. halt
  19.  

The benefit of doing it this way is you can control the pause statements by changing the %debug variable to have a variety of values and you can have multiple control points in the script. This will allow you to test a script at full speed without stopping on each line. The script can also keep the debug code in place and by just changing the %debug variable you can allow the whole script to run.

I used the underscores around the value because it forces the phrase to be whole and a partial match won't work - which is safer.

Gaderian
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline RumplesTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 1
  • Rumples has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Start Script at Specific Line
« Reply #2 on: April 24, 2022, 06:03:18 PM »
0
Thank you for your quick reply! Hopefully i'll have some time soon to test this out.

Tags: