Jump to content
  • 0

A New Label Time OnSec<secound> possible ?


Hyroshima

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

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

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  01/28/20
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

You can adapt NPC Timers.

initnpctimer;

Onxxxxx:

//Do anything

end;

OnSec maybe kill performance.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

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. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

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;
	}

 

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

#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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

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

Link to comment
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...