Hyroshima Posted February 6, 2020 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 189 Reputation: 122 Joined: 07/11/14 Last Seen: November 27, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Lunastra Posted February 6, 2020 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 2 Reputation: 0 Joined: 01/28/20 Last Seen: March 20, 2020 Share 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 Link to comment Share on other sites More sharing options...
0 Start_ Posted February 6, 2020 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 21 hours ago Share Posted February 6, 2020 You can adapt NPC Timers. initnpctimer; Onxxxxx: //Do anything end; OnSec maybe kill performance. Quote Link to comment Share on other sites More sharing options...
0 Hyroshima Posted February 6, 2020 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 189 Reputation: 122 Joined: 07/11/14 Last Seen: November 27, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
0 Akkarin Posted February 6, 2020 Group: Forum Manager Topic Count: 282 Topics Per Day: 0.06 Content Count: 3144 Reputation: 1630 Joined: 03/26/12 Last Seen: April 15 Share 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 Link to comment Share on other sites More sharing options...
0 Hyroshima Posted February 6, 2020 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 189 Reputation: 122 Joined: 07/11/14 Last Seen: November 27, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
0 Emistry Posted March 16, 2020 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
0 Hyroshima Posted March 17, 2020 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 189 Reputation: 122 Joined: 07/11/14 Last Seen: November 27, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
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~ ^^
Link to comment
Share on other sites
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.