Jump to content

Question

Posted

Hello rAthena Community,

I have a small problem and I think it's easy to solve but I don't want to make a mistake.

I have this script for War of Emperium times.

OnClock1900: //start time for Wend,Sun(0,3), Wend,Sun(0,3)
OnClock2000: //end time for Wend,Sun(0,3), Wend,Sun(0,3)

// starting time checks
if((gettime(4)==0) && (gettime(3)>=19 && gettime(3)<20) ||
(gettime(4)==3) && (gettime(3)>=19 && gettime(3)<20)) {

But I want Wednesday and Sunday: 19:00 - 20:30 o'clock

Can I just edit it to:

OnClock1900: //start time for Wend,Sun(0,3), Wend,Sun(0,3)
OnClock2030: //end time for Wend,Sun(0,3), Wend,Sun(0,3)

// starting time checks
if((gettime(4)==0) && (gettime(3)>=19 && gettime(3)<20) ||
(gettime(4)==3) && (gettime(3)>=19 && gettime(3)<20)) {

or

OnClock1900: //start time for Wend,Sun(0,3), Wend,Sun(0,3)
OnClock2030: //end time for Wend,Sun(0,3), Wend,Sun(0,3)

// starting time checks
if((gettime(4)==0) && (gettime(3)>=19 && gettime(3)<2030) ||
(gettime(4)==3) && (gettime(3)>=19 && gettime(3)<2030)) {

Thanks for your help!

4 answers to this question

Recommended Posts

Posted

The function gettime() returns only what you specify.

gettime(3) will give you the hour only.

Since you can only arrive at the if check at two possible times, 19:00 and 20:30, you only need to check for the days and that specific hour.

OnClock1900: // Start time
OnClock2030: // End time
// Check for Sunday or Wednesday AND that it is starttime
if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 19) {

I'm guessing you have an "end time check" at the end of that if. Make sure to change that check to something like this:


// Check for Sunday or Wednesday AND that it is endtime
if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 20) {

*gettime(<type>)

This function will return specified information about the current system time.

...

3 - Hour (of a day)

...

Posted

Because I'm looking for a random War of Emperium and I don't want to change the castles manually.

The script by Brian announces every War of Emperium which castle is open this season.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...