ScriptingPhailure Posted January 17, 2012 Posted January 17, 2012 (edited) Is there a way to loop the special effect command? I want the effect to repeat itself for the same duration as progress bar. In my case 10 secs. I want the effect to go off while charging and loop until charge is completed. Edited January 17, 2012 by ScriptingPhailure Quote
Arcenciel Posted January 17, 2012 Posted January 17, 2012 Refer to the portion "VIII - Effects " http://rathena.org/b...e-for-browedit/ Quote
ScriptingPhailure Posted January 17, 2012 Author Posted January 17, 2012 (edited) I tried that and it gave me an infinite loop. Could you take a look at my script and tell me where to apply and what? new_1-3,100,120,3 script Fishing Spot 857,15,15,{ mes "[Yourself]"; mes "Maybe I should go fishing."; switch(select("yes:no")) { case 1: close2; goto OnAction; end; case 2: mes "ok bye failure"; close; } OnAction: [b]specialeffect 54; [/b]//I want this to loop for 10 secs while the progress bar charges up progressbar "^000000",10; set fishingz, rand(7); if (fishingz == 0) goto gotfish; if (fishingz == 1) goto gotfish; if (fishingz == 2) goto gotfish; if (fishingz == 3) goto gotfish; if (fishingz == 4) goto gotfish; if (fishingz == 5) goto gotfish; if (fishingz == 6) goto gotfish; close; OnTouch: showevent 2,0; end; specialeffect2 14 ; getitem 579,1; close; } Edited January 17, 2012 by ScriptingPhailure Quote
Derceto Posted January 17, 2012 Posted January 17, 2012 1. set .@duration, 10; set .@delay, 1000; set .@timeToEnd, gettimetick(2) + while (gettimetick(2)<.@timeToEnd) { specialeffect whatever; sleep2 .@delay; } 2. set .working, 1; set .@delay, 1000; initnpctimer; while (.working) { specialeffect whatever; sleep2 .@delay; } end; OnTimer[something]: .working = 0; end; Needless to mention the 1) is much better, but you can choose the one is more convenient for you. Quote
ScriptingPhailure Posted January 17, 2012 Author Posted January 17, 2012 Ok the effect repeats but I need to go off while the progress bar is charging up, either the effect goes off and then the bar charges or it charges after the bar is full. Quote
KeyWorld Posted January 17, 2012 Posted January 17, 2012 OnEffect: set @loop_effect, 1; set .@delay, 500; while ( @loop_effect ) { specialeffect 54; sleep2 .@delay; } end; OnAction: doevent strnpcinfo(3) + "::OnEffect"; progressbar "^000000",10; set @loop_effect, 0; Since progressbar() pause the script you have to do the effect loop in another """thread""". Quote
ScriptingPhailure Posted January 17, 2012 Author Posted January 17, 2012 (edited) OnEffect: set @loop_effect, 1; set .@delay, 500; while ( @loop_effect ) { specialeffect 54; sleep2 .@delay; } end; OnAction: doevent strnpcinfo(3) + "::OnEffect"; progressbar "^000000",10; set @loop_effect, 0; Since progressbar() pause the script you have to do the effect loop in another """thread""". This effect still triggers after the progress bar finishes charging not while. Then it's an infinite loop. Is it possible to use doevent to trigger two events at once? Edited January 17, 2012 by ScriptingPhailure Quote
KeyWorld Posted January 17, 2012 Posted January 17, 2012 Weird, maybe you should put a sleep2(1); just after the doevent() to force the script engine to execute it before it pause the script with the progressbar(). Quote
ScriptingPhailure Posted January 18, 2012 Author Posted January 18, 2012 That didn't work either. I feel like pulling out my hair. Quote
Question
ScriptingPhailure
Is there a way to loop the special effect command? I want the effect to repeat itself for the same duration as progress bar. In my case 10 secs. I want the effect to go off while charging and loop until charge is completed.
Edited by ScriptingPhailure8 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.