Hyroshima Posted February 6, 2020 Posted February 6, 2020 Hello again, it be possible to create a clone of OnMinute but with seconds? The idea would be to call the label every time the minute was changed.Since already thank you very much by Hyro~ ^^ Quote
0 Lunastra Posted February 6, 2020 Posted February 6, 2020 Would not be sleep and sleep2? *sleep {<milliseconds>}; *sleep2 {<milliseconds>}; *awake "<NPC name>"; These commands are used to control the pause of a NPC. sleep and sleep2 will pause the script for the given amount of milliseconds. Awake is used to cancel a sleep. When awake is called on a NPC it will run as if the sleep timer ran out, and thus making the script continue. Sleep and sleep2 basically do the same, but the main difference is that sleep will not keep the rid, while sleep2 does. Also sleep2 will stop the script if there is no unit attached. Examples: sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore) sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'. https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6771 Quote
0 Start_ Posted February 6, 2020 Posted February 6, 2020 You can adapt NPC Timers. initnpctimer; Onxxxxx: //Do anything end; OnSec maybe kill performance. Quote
0 Hyroshima Posted February 6, 2020 Author Posted February 6, 2020 (edited) Há 3 horas, Lunastra disse: Não seria dormir e sleep2? https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6771 2 horas atrás, Start_ disse: Você pode adaptar os temporizadores do NPC. O OnSec pode prejudicar o desempenho. I don't want to attach time to the script, I just need a label to be activated per minute. Edited February 6, 2020 by Hyroshima Quote
0 Akkarin Posted February 6, 2020 Posted February 6, 2020 8 hours ago, Hyroshima said: I don't want to attach time to the script, I just need a label to be activated per minute. For running a script each minute, attaching a timer is the best way to do it. Quote
0 Hyroshima Posted February 6, 2020 Author Posted February 6, 2020 7 hours ago, Akkarin said: For running a script each minute, attaching a timer is the best way to do it. I understand, was thinking of something to update by the minute without having to leave a script timer tied to it. ex: OnSec: OnSec59: <code> end; OnMinute: OnMinute00: OnMinute01: OnMinute02: OnMinute03: OnMinute04: OnMinute05: OnMinute06: OnMinute07: OnMinute08: OnMinute09: OnMinute10: etc...59: <code> end; OnInit,while,sleep: OnInit: freeloop(1) while(1) { <code> sleep 1000; } Quote
0 Emistry Posted March 16, 2020 Posted March 16, 2020 (edited) #1 OnSecXX: doesn't exist, but this is redundant and unnecessary because OnMinuteXX already can fulfill what you looking for. #2 while(1) { // process what you want sleep 1000; } this attempt aren't actually recommended, people has been abusing how to use this trick for their convenience, without knowing the consequences. Whenever the script has done what its instructed to do, it should free up the resource, but this attempts doesn't free up the resource. #3 OnMinuteXX: due to user required to duplicate from 00 ~ 59th minutes, its become redundant work, but its exactly what you need. Fyi, it free up the resource once it done its part. #4 OnTimer60000: // process whatever you want here. OnInit: initnpctimer; end; more elegant, and less redundant work, doesn't required user to duplicate all the OnMinuteXX like attempt #3 did, and yes it also free up the resources once it done its part. Conclusion: you should pick between attempt #3 and #4. Personally, I would prefer #4. Edited March 16, 2020 by Emistry 1 Quote
0 Hyroshima Posted March 17, 2020 Author Posted March 17, 2020 14 hours ago, Emistry said: #1 OnSecXX: doesn't exist, but this is redundant and unnecessary because OnMinuteXX already can fulfill what you looking for. #2 while(1) { // process what you want sleep 1000; } this attempt aren't actually recommended, people has been abusing how to use this trick for their convenience, without knowing the consequences. Whenever the script has done what its instructed to do, it should free up the resource, but this attempts doesn't free up the resource. #3 OnMinuteXX: due to user required to duplicate from 00 ~ 59th minutes, its become redundant work, but its exactly what you need. Fyi, it free up the resource once it done its part. #4 OnTimer60000: // process whatever you want here. OnInit: initnpctimer; end; more elegant, and less redundant work, doesn't required user to duplicate all the OnMinuteXX like attempt #3 did, and yes it also free up the resources once it done its part. Conclusion: you should pick between attempt #3 and #4. Personally, I would prefer #4. Thanks for attention, but my idea is not to leave a time attachment, and work only when called similar to other labels that have a trigger that in this case it would always have been an increase in the minute real time. I will analyze and check how it would behave and try to create this function ^^. #Conclusion: you should pick between attempt #3 and #4. Personally, I would prefer #4. *this would also be the one I would use ^^ Quote
Question
Hyroshima
Hello again, it be possible to create a clone of OnMinute but with seconds?
The idea would be to call the label every time the minute was changed.
Since already thank you very much by Hyro~ ^^
7 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.