Hi! i did try to modify this script but i'm getting error like infinity loop?? all just want is to have a random selection every end of progress bar with random success rate. here's the script..
Please help me modify this..
thank you!
caspen,213,35,0 script School of Fish 723,{
if (isequipped(2764)) && (isequipped(2775)){
specialeffect2 EF_BUBBLE;
set .@fcast,10;
if (isequipped(2550)) { //Fisher's_Muffler
set .@fcast,.@fcast - 3;
}
if (isequipped(2443)) { //Fish_Shoes
set .@fcast,.@fcast - 2;
}
progressbar "ffffff",.@fcast;
mes "*********Fishing*********";
mes "fish has taken the bait";
setarray .@options$[0], "What will I do?","Boring","Pull the fish!";
// generate the random order
for( set .@i,0; .@i < getarraysize(.@options$); set .@i,.@i+1 ) {
while( set(.@rand,rand(1,getarraysize(.@options$))) == getd(".@__tmp_"+.@rand) );
setd(".@__tmp_"+.@rand,set(.@array[.@i],.@rand));
}
// Debug output
// for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
// dispbottom(.@array[.@i]);
// arrange the menu options in that order
for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
set .@menu$, .@menu$ + .@options$[.@array[.@i]-1] + ":";
// pick an option
set .@picked, .@array[select(.@menu$)-1];
// display the corresponding option
switch(.@picked) {
case 1:
mes "Are you kiddin me?";
close;
case 2:
mes "Come back when you're ready..";
close;
case 3:
close2;
progressbar "ffffff",.@fcast;
.@r = rand(100);
if ( .@r < 80 )
goto fish1;
else if ( .@r < 60 )
goto fish2;
else if ( .@r < 40 )
goto fish3;
else if ( .@r < 20 )
goto catch;
else {
mes "Nothing was caught.";
emotion 28;
close;
}
}
fish1:
mes "*********Fishing*********";
setarray .@options$[0], "Stop fishing","Boring","Keep pulling!";
// generate the random order
for( set .@i,0; .@i < getarraysize(.@options$); set .@i,.@i+1 ) {
while( set(.@rand,rand(1,getarraysize(.@options$))) == getd(".@__tmp_"+.@rand) );
setd(".@__tmp_"+.@rand,set(.@array[.@i],.@rand));
}
// Debug output
// for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
// dispbottom(.@array[.@i]);
// arrange the menu options in that order
for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
set .@menu$, .@menu$ + .@options$[.@array[.@i]-1] + ":";
// pick an option
set .@picked, .@array[select(.@menu$)-1];
// display the corresponding option
switch(.@picked) {
case 1:
mes "Are you kiddin me?";
close;
case 2:
mes "Come back when you're ready..";
close;
case 3:
close2;
progressbar "ffffff",.@fcast;
.@r = rand(100);
if ( .@r < 80 )
goto fish2;
else if ( .@r < 60 )
goto fish3;
else if ( .@r < 40 )
goto catch;
else {
mes "Nothing was caught.";
emotion 28;
close;
}
}
fish2:
mes "*********Fishing*********";
setarray .@options$[0], "Stop fishing","Boring","Keep pulling!";
// generate the random order
for( set .@i,0; .@i < getarraysize(.@options$); set .@i,.@i+1 ) {
while( set(.@rand,rand(1,getarraysize(.@options$))) == getd(".@__tmp_"+.@rand) );
setd(".@__tmp_"+.@rand,set(.@array[.@i],.@rand));
}
// Debug output
// for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
// dispbottom(.@array[.@i]);
// arrange the menu options in that order
for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
set .@menu$, .@menu$ + .@options$[.@array[.@i]-1] + ":";
// pick an option
set .@picked, .@array[select(.@menu$)-1];
// display the corresponding option
switch(.@picked) {
case 1:
mes "Are you kiddin me?";
close;
case 2:
mes "Come back when you're ready..";
close;
case 3:
close2;
progressbar "ffffff",.@fcast;
.@r = rand(100);
if ( .@r < 80 )
goto fish3;
else if ( .@r < 60 )
goto catch;
else {
mes "Nothing was caught.";
emotion 28;
close;
}
}
fish3:
mes "*********Fishing*********";
setarray .@options$[0], "Stop fishing","Boring","Keep pulling!";
// generate the random order
for( set .@i,0; .@i < getarraysize(.@options$); set .@i,.@i+1 ) {
while( set(.@rand,rand(1,getarraysize(.@options$))) == getd(".@__tmp_"+.@rand) );
setd(".@__tmp_"+.@rand,set(.@array[.@i],.@rand));
}
// Debug output
// for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
// dispbottom(.@array[.@i]);
// arrange the menu options in that order
for( set .@i,0; .@i < getarraysize(.@array); set .@i,.@i+1 )
set .@menu$, .@menu$ + .@options$[.@array[.@i]-1] + ":";
// pick an option
set .@picked, .@array[select(.@menu$)-1];
// display the corresponding option
switch(.@picked) {
case 1:
mes "Are you kiddin me?";
close;
case 2:
mes "Come back when you're ready..";
close;
case 3:
close2;
progressbar "ffffff",.@fcast;
.@r = rand(100);
if ( .@r < 80 )
goto catch;
else {
mes "Nothing was caught.";
emotion 28;
close;
}
catch:
if (rand(1,20) == 2) {
getitem 8162,1; //Big Fish
specialeffect EF_BUBBLE;
mapannounce "caspen","" + strcharinfo(0) + " has caught a Fishing Coin!!!",bc_map,"0xff77ff";
emotion 46;
end;
}
set .@rhea_ran,rand(1,70);
if (.@rhea_ran < 20) {
getitem 579,1; //Fresh Fish
emotion 21;
}
else if (.@rhea_ran == 20) {
getitem 908,1; //Spawn
emotion 4;
}
else if (.@rhea_ran == 21) {
getitem 909,1; //Jellopy
emotion 76;
}
else if (.@rhea_ran == 22) {
getitem 963,1; //Sharp_Scale
emotion 76;
}
else if (.@rhea_ran == 23) {
getitem 956,1; //Gill
emotion 76;
}
else if (.@rhea_ran == 24) {
getitem 6049,1; //Marlin
emotion 76;
}
else if (.@rhea_ran == 25) {
getitem 918,1; //Sticky_Webfoot
emotion 79;
}
else if (.@rhea_ran == 26) {
getitem 960,1; //Nipper
emotion 76;
}
else if (.@rhea_ran == 27) {
getitem 910,1; //Garlet
emotion 76;
}
else if (.@rhea_ran == 28) {
getitem 938,1; //Sticky_Mucus
emotion 79;
}
else if ((.@rhea_ran > 28) && (.@rhea_ran < 40)) {
getitem 624,1; //Rotten Fish
emotion 71;
}
else {
mes "Nothing was caught.";
emotion 28;
close;
}
if (rand(100) <4) {
getitem 12103,1; //Gift_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught a Bloody Branch!!",bc_map,"0x00ffff";
emotion 46;
}
if (rand(100) <10) {
getitem 603,1; //Old_Blue_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught an Old Blue Box!!",bc_map,"0x00ffff";
emotion 46;
}
if (rand(1,600) <3) {
getitem 7806,1; // god anvil
mapannounce "caspen","" + strcharinfo(0) + " has caught an god Anvil!!",bc_map,"0x44ff44";
emotion 46;
}
if (rand(1,3200) == 3) {
getitem 19200,1; //Old_Violet_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught an Earth Flux!!",bc_map,"0x44ff44";
emotion 46;
}
if (rand(1,3300) == 3) {
getitem 19201,1; //Old_Violet_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught an Wind Flux!!",bc_map,"0x44ff44";
emotion 46;
}
if (rand(1,3400) == 3) {
getitem 19202,1; //Old_Violet_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught an Fire Flux!!",bc_map,"0x44ff44";
emotion 46;
}
if (rand(1,3500) == 3) {
getitem 19203,1; //Old_Violet_Box
mapannounce "caspen","" + strcharinfo(0) + " has caught an Water Flux!!",bc_map,"0x44ff44";
emotion 46;
}
}
end;
}
mes "uuhm!Please wear a Fishing gear..";
mes "Thanks!..";
close;
}
caspen,205,41,0 duplicate(School of Fish) School of Fish#55 723
caspen,222,41,0 duplicate(School of Fish) School of Fish#53 723
caspen,233,34,0 duplicate(School of Fish) School of Fish#50 723
Question
kitty14
Hi! i did try to modify this script but i'm getting error like infinity loop??

all just want is to have a random selection every end of progress bar with random success rate.
here's the script..
Please help me modify this..
thank you!
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.