Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Macro IF and ELSE Tutorial
#1
Hello everybody. I am eduardoroeder and used to be a forum moderator when bbot started. Today i will teach you how to do If and Else on macros.

I have not found a way to learn this so i learned by my self on the hard way.
First you make a macro normally and add the contition you want to check. Example:
Code:
I:=Misc.Random(1, 6)
!I!==1                    ----- if the variable I = 1 do the rest of macro
Cavebot.Stop()
Macro.Wait(2000)
Self.Say(hello?)
Cavebot.Start()
Macro.Wait(5000)
Then you want to check if I is different than 1 do something else.
You put "Exit()" on the end of the macro, and on a new line you make this:
Code:
{dootherthing}
Self.Say(Not 1)
Exit()
and after the condition check you put the name you putted inside the brackets(in the case "dootherthing") and it will look like this:


Code:
I:=Misc.Random(1, 6)
!I!==1 [dootherthing]
Cavebot.Stop()
Macro.Wait(2000)
Self.Say(hello?)
Cavebot.Start()
Macro.Wait(5000)
Exit()
{dootherthing}
Self.Say(Not 1)
Exit()

And thats it!

What this script will do:
1-I:=Misc.Random(1, 6) -> Get a random number between 1 and 6
2-!I!==1 [dootherthing] -> Check if the number is 1. If true do whats down the check, if false, do [dootherthing].
3-Do the true or false part Big Grin

Thanks! Any question please ask and ill try to answer.
Support my thread for features request: http://forums.bmega.net/thread-16858.html

Rep++ if I helped. Rep++ se eu ajudei.


Forum Jump:


Users browsing this thread: 1 Guest(s)