Jump to content
  • 0

Gettime problem


donkeyg

Question


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

ordeal_1-1,0,0,0 script DS_HiddenNpc -1,{
OnClock2130:
if(gettime(4) == 1 ) end;

i wan to make it sunday only, why it would held during wednesday???

Link to comment
Share on other sites

16 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

if(gettime(4) == 1 ) end;

if( today = Monday ) end this script

Edited by goddameit
Link to comment
Share on other sites


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

because your condition checking is wrong....it only check for monday...then your script only stopped on monday....

the correct condition would be

if( gettime(4) ) end;

refer gettime

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

OnSun2130:

I actually wants to rewrite that devil square script,

its not an optimized script, and not easily to edit

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

if( gettime(4) ) end;

= mean this is sunday?

Link to comment
Share on other sites


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

if( gettime(4) ) end;

= mean this is sunday?

if not sunday....the script will end at this line....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

if( gettime(4) ) end;

= mean this is sunday?

if not sunday....the script will end at this line....

hmm... end? then how do i make it held at sunday? lol

Link to comment
Share on other sites


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

because your condition checking is wrong....it only check for monday...then your script only stopped on monday....

the correct condition would be

if( gettime(4) ) end;

refer gettime

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

because your condition checking is wrong....it only check for monday...then your script only stopped on monday....

the correct condition would be

if( gettime(4) ) end;

refer gettime

so if i wan to held it on sunday only, it will be like this?

if(gettime(4) == 1 || gettime(4) == 2 || gettime(4) == 3 || gettime(4) == 4 || gettime(4) == 5 || gettime(4) == 6 )

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

because your condition checking is wrong....it only check for monday...then your script only stopped on monday....

the correct condition would be

if( gettime(4) ) end;

refer gettime

so if i wan to held it on sunday only, it will be like this?

if(gettime(4) == 1 || gettime(4) == 2 || gettime(4) == 3 || gettime(4) == 4 || gettime(4) == 5 || gettime(4) == 6 )

Yes or

if( gettime(4) != 0 ) end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

because your condition checking is wrong....it only check for monday...then your script only stopped on monday....

the correct condition would be

if( gettime(4) ) end;

refer gettime

so if i wan to held it on sunday only, it will be like this?

if(gettime(4) == 1 || gettime(4) == 2 || gettime(4) == 3 || gettime(4) == 4 || gettime(4) == 5 || gettime(4) == 6 )

Yes or

if( gettime(4) != 0 ) end;

what does the "!" means?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

! - Logical Not.

Reverses the boolean result of an expression. True will become false and

false will become true.

Example:

if(!callfunc("F_dosomething"))

{

mes "Doing something failed.";

close;

}

trunk/doc/script_commands.txt

// If gettime(4) is not 0 --> if day is not Sunday
if( gettime(4) != 0 ) end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

OnClock1400://
if(gettime(4) == 0 || if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5 ) end;

Something wrong???? i wan to make it held on 2 4 6 only.

Link to comment
Share on other sites


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

OnClock1400:
if( gettime(4) % 2 != 0 ) end;

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

OnClock1400://
if(gettime(4) == 0 || if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5 ) end;

Something wrong???? i wan to make it held on 2 4 6 only.

No it's working.

OnClock1400:
if( gettime(4) % 2 != 0 ) end;

Your code works also with gettime(0)

0 % 2 == 0

and

i wan to make it held on 2 4 6 only

Just to point it out

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

if(gettime(4) == 1 || gettime(4) == 2 || gettime(4) == 3 || gettime(4) == 4 || gettime(4) == 5 || gettime(4) == 6 ) end;

hmm. why it's still held on thursday , friday? i wan to make it held on sunday only swt. quite cnofuse

Link to comment
Share on other sites


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

show your full script....

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