Find
You are looking at a loopy doop
This little loopy doop demonstrates how to loop through the same block of code several times, doing something slightly different each time.
push the loopy doop
to see the rather complex method
kick the loopy doop
to see the very simple method (I dont know why I didnt show it to you first).
Remember you can use
cycle
to methodically get new values each time a loop is run.
Created by
wolis
, last updated 04 Sep 2009
Code
if target of push then initloop;
if target of bounce then foreachloop;
##foreachloop:
$button = $actor;
foreach in (spawned1,spawned2,spawned3,spawned4) do spawnit;
##spawnit:
cycle $weapon through ("small club","large club","battle axe","golden sword");
cycle $weapbase through ("weap1","weap2","weap3","weap4");
print "Id like to find a $list_line in [$button] and make it wield a $weapon (which is based on $weapbase) ";
##-------------- old code below -------------------------;
##initloop:
$loopcount = 0;
runsub toploop;
##toploop:
cycle $myword through (goblin,hobbit,macaronni,elephant,possum);
add 1 to $loopcount;
if $loopcount < 5 then dosomething;
##dosomething:
print "this is something number $loopcount and my word is $myword";
runsub toploop;