ScriptingPhailure Posted January 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 87 Reputation: 21 Joined: 01/13/12 Last Seen: March 15, 2014 Share 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 Link to comment Share on other sites More sharing options...
Arcenciel Posted January 17, 2012 Group: Members Topic Count: 69 Topics Per Day: 0.01 Content Count: 1315 Reputation: 372 Joined: 12/10/11 Last Seen: August 31, 2013 Share Posted January 17, 2012 Refer to the portion "VIII - Effects " http://rathena.org/b...e-for-browedit/ Quote Link to comment Share on other sites More sharing options...
ScriptingPhailure Posted January 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 87 Reputation: 21 Joined: 01/13/12 Last Seen: March 15, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
Derceto Posted January 17, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 43 Reputation: 2 Joined: 01/17/12 Last Seen: February 15, 2014 Share 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 Link to comment Share on other sites More sharing options...
ScriptingPhailure Posted January 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 87 Reputation: 21 Joined: 01/13/12 Last Seen: March 15, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
KeyWorld Posted January 17, 2012 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Share 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 Link to comment Share on other sites More sharing options...
ScriptingPhailure Posted January 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 87 Reputation: 21 Joined: 01/13/12 Last Seen: March 15, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
KeyWorld Posted January 17, 2012 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Share 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 Link to comment Share on other sites More sharing options...
ScriptingPhailure Posted January 18, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 87 Reputation: 21 Joined: 01/13/12 Last Seen: March 15, 2014 Author Share Posted January 18, 2012 That didn't work either. I feel like pulling out my hair. Quote Link to comment Share on other sites More sharing options...
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 ScriptingPhailureLink to comment
Share on other sites
8 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.