viewing paste topic/4726- scripting style | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
prontera,150,186,5  script  1st generation  100,{
    setarray $@haha, 100,200,300,400;
    set @i, 0;
    goto L_loop;
L_loop:
    if ( $@haha[@i] == 300 ) goto L_result;
    set @i, @i +1;
    goto L_loop;
L_result:
    dispbottom "i is "+ @i;
    end;
}
 
prontera,153,186,5  script  2nd & 3rd generation    100,{
    setarray .@haha, 100,200,300,400;
    for ( set .@i, 0; .@i < getarraysize(.@haha); set .@i, .@i +1 ) {
        if ( .@haha[.@i] == 300 ) break;
    }
    dispbottom "i is "+ .@i;
    end;
}
 
prontera,156,186,5  script  4th generation  100,{
    while ( .haha[.@i] != 300 && .@i < .haha_size ) .@i++;
    dispbottom "i is "+ .@i;
    end;
OnInit:
    setarray .haha, 100,200,300,400;
    .haha_size = getarraysize(.haha);
    end;
}
Viewed 1396 times, submitted by AnnieRuru.