Jump to content
  • 0

Script working only one specified day.


Vali

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  128
  • Reputation:   7
  • Joined:  12/29/11
  • Last Seen:  

Hi,

I'm looking to do an scrip that works only for one specified day when a monster is killed. I really do not know how to do the compare to do that if:

header of the script{
end;
OnNPCKillEvent:
if(date() == 20120404)  // This part
{
DoSomething();
}
}

Thank you.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


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

you can try this

*gettime(<type>)
This function will return specified information about the current system time.
1 - Seconds (of a minute)
2 - Minutes (of an hour)
3 - Hour (of a day)
4 - Week day (0 for Sunday, 6 is Saturday)
5 - Day of the month.
6 - Number of the month.
7 - Year.
8 - Day of the year.
It will only return numbers.
   if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

sample:

- script npcname -1,{
end;

OnNPCKillEvent:
if(gettime(4)!=6) end;
DoSomething()

}

This script would work only on Saturday

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

Hi!, try this

set .@date$,""+20120404;
if(gettimestr("%Y%m%d",21)==.@date$)
{
//Do stuff
}

%Y - year

%m - months with leading zero when the value is 1 - 9

%d - day with leading zeros when the value is 1 - 9

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  128
  • Reputation:   7
  • Joined:  12/29/11
  • Last Seen:  

Thank you. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

Hi!, try this

set .@date$,""+20120404;
if(gettimestr("%Y%m%d",21)==.@date$)
{
//Do stuff
}

%Y - year

%m - months with leading zero when the value is 1 - 9

%d - day with leading zeros when the value is 1 - 9

Good idea :)

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