Jump to content
  • 0

add new day variable


cder

Question


  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.02
  • Content Count:  96
  • Reputation:   0
  • Joined:  08/06/18
  • Last Seen:  

Hello guys I need a very simple answer, it would be like to assign "+1" in a variable called "newday", when the server arrives at 00:00

 

Example:

Spoiler

-    script    DayNight    -1,{


OnClock0000:
   set newday, newday + 1; 
   end;
    }
}

 

Edited by cder
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

Use global variable. Example: $var or read script command in doc folder 

Edited by Mabuhay
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.02
  • Content Count:  96
  • Reputation:   0
  • Joined:  08/06/18
  • Last Seen:  

17 minutes ago, Mabuhay said:

Use global variable. Example: $var or read script command in doc folder 

I know about it, I did just one example up there, but what I want to assign is not global, but for each player ..., you know ?

Edited by cder
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

You cannot do player bound variables if you dont attach players. It is better to check for the current day using gettime then update every time player uses that npc. 

More examples are best found in annieruru's blogspot. 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.02
  • Content Count:  96
  • Reputation:   0
  • Joined:  08/06/18
  • Last Seen:  

5 minutes ago, Mabuhay said:

You cannot do player bound variables if you dont attach players. It is better to check for the current day using gettime then update every time player uses that npc. 

More examples are best found in annieruru's blogspot. 

Thx, please can you send the link?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

OnClock0000:
	addrid(0);
	set newday, newday + 1; 
	end;

You can use addrid. 

*addrid(<type>{,<flag>{,<parameters>}});

This command will attach other RIDs to the current script without detaching the
invoking RID. It returns 1 if successful and 0 upon failure.

<type> determines what RIDs are attached:
 0: All players in the server.
 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
 2: Party members of a specified party ID.
    [ Parameters: <party id> ]
 3: Guild members of a specified guild ID.
    [ Parameters: <guild id> ]
 4: All players in a specified area of the map of the invoking player (or NPC).
    [ Parameters: <x0>,<y0>,<x1>,<y1> ]
 5: All players in the map.
    [ Parameters: "<map name>" ]
 Account ID: If type is Account ID, attach the specified account ID.

<flag> can prevent certain players from being attached:
 0: Players are always attached. (default)
 1: Players currently running another script will not be attached.

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.02
  • Content Count:  96
  • Reputation:   0
  • Joined:  08/06/18
  • Last Seen:  

7 minutes ago, Patskie said:

OnClock0000:
	addrid(0);
	set newday, newday + 1; 
	end;

You can use addrid. 


*addrid(<type>{,<flag>{,<parameters>}});

This command will attach other RIDs to the current script without detaching the
invoking RID. It returns 1 if successful and 0 upon failure.

<type> determines what RIDs are attached:
 0: All players in the server.
 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
 2: Party members of a specified party ID.
    [ Parameters: <party id> ]
 3: Guild members of a specified guild ID.
    [ Parameters: <guild id> ]
 4: All players in a specified area of the map of the invoking player (or NPC).
    [ Parameters: <x0>,<y0>,<x1>,<y1> ]
 5: All players in the map.
    [ Parameters: "<map name>" ]
 Account ID: If type is Account ID, attach the specified account ID.

<flag> can prevent certain players from being attached:
 0: Players are always attached. (default)
 1: Players currently running another script will not be attached.

   

 

Oops, how beautiful, I can't test it now but I am very grateful for that, thanks ...

 

Edited by cder
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...