Jump to content
  • 0
Hyroshima

A New Label Time OnSec<secound> possible ?

Question

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~ ^^

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

You can adapt NPC Timers.

initnpctimer;

Onxxxxx:

//Do anything

end;

OnSec maybe kill performance.

Share this post


Link to post
Share on other sites
  • 0
Há 3 horas, Lunastra disse:

 

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 by Hyroshima

Share this post


Link to post
Share on other sites
  • 0
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. 

Share this post


Link to post
Share on other sites
  • 0
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;
	}

 

 

 

Share this post


Link to post
Share on other sites
  • 0
Posted (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 by Emistry
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
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 ^^

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.