Creating functional "boxes" in the script

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Creating functional "boxes" in the script

Post by winstein » Mon Nov 26, 2012 4:17 pm

Here's something I would like to implement. If the script did not manage to do what is intended, meaning that it goes out of sync, how do I make the program skip that particular section to another line (and continue as usual)? Basically, what I am saying is, I want to create something like parts within the program (similar to functions, I think) that will skip a section if it doesn't do as I intended it to do.

It's hard to explain this, but I hope you understand what I am saying.

Thanks for reading.
PPQ

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Tue Nov 27, 2012 5:59 am

i use if else label goto statements

:example:


Code: Select all

label>start
 GetPixelColor>x,y,color
	 If>color=13027237
             MouseMove>x,y
             LClick
			 goto>start
else>
goto>snake

label>snake
 GetPixelColor>x,y,color2
	 If>color2=1302666
             MouseMove>x,y
             LClick
			 goto>start
else>
goto>end

label>end

if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

Post by hoangvo81 » Mon Dec 17, 2012 8:37 pm

SRT>RoutineName
.. do your functions

END>RoutineName


if>isSync=TRUE
GoSub>RoutineName
endif


..basically go to the subroutine called RoutineName if the item isSync is TRUE if not then just ignore the routine and continue on with the script.

ie:

SRT>DisplayValue
Mdl>K value is %k%
END>DisplayValue

let>k=0
repeat>k
add>k,1
if>k=5
Gosub>DisplayValue
endif

until>k,10


*This repeats and just add 1 to k each time. but only display the message modal when k is 5, if not it just skip the process.
Hope this is what you are looking for.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts