how do u generat a random goto script?

August 26, 2010 at 14:15:42
Specs: Windows 7
how do i make a random generation that will select a random go to
i want to use this for several things but i dont know how to make it generate a random existing goto thing i know how to do it in mirc script it looks like this
var %item = $rand(1,3)
if (%item == 1) .timer 1 2 msg $chan 5 test 1
if (%item == 2) .timer 1 2 msg $chan 5 test 2
if (%item == 3) .timer 1 2 msg $chan 5 test 3
}
example of how i am aming to set up the batch script
:loop
<random goto script>
:a
echo test1
goto loop
:b
echo test 2
goto loop
:c
echo test 3
goto loop

See More: how do u generat a random goto script?

Report •

#1
August 26, 2010 at 14:31:28
Set /a Number=(%Random% %%10)+1
IF "%Number%"=="1" GOTO 1
IF "%Number%"=="2" GOTO 2
...

Change the "%%10" to how ever many labels you have.


Report •

#2
August 26, 2010 at 15:44:13
@Matt123 ^^ ty it works perfectly just 1 quick question whats the +1 do?

Report •

#3
August 26, 2010 at 16:56:35
%Random% includes all numbers, including 0. so the +1 will stop the script from ever outputting a 0.

Also, you could simply do "GOTO %Number%" if your labels are cleverly named as numbers..


Report •

Related Solutions

#4
August 26, 2010 at 17:54:42
well i only remembered about that i needed this part because i noticed when i was doing a cmd marix it was looping and every one could tell it was and i didnt want it to loop threw the thing over and over again so if it mixes the order up every time its loops it looks like it is actually doing random # and letters and i had other uses for this to ^^

Report •

#5
August 26, 2010 at 18:36:19
WOW! I had to reread that twice to understand it all! It's just one never-ending sentence!

But, I'm glad I was able to help!


Report •

Ask Question