mirabell Posted February 5, 2017 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 197 Reputation: 19 Joined: 11/20/11 Last Seen: February 28 Share Posted February 5, 2017 (edited) this isnt working for me not sure why OnInit: if (gettime(3) >=0 && gettime(3) <=3) set $@isnight, 1; night; if (gettime(3) >=4 && gettime(3) <=7) set $@isnight, 0; day; if (gettime(3) >=8 && gettime(3) <=11) set $@isnight, 1; night; if (gettime(3) >=12 && gettime(3) <=15) set $@isnight, 0; day; if (gettime(3) >=16 && gettime(3) <=19) set $@isnight, 1; night; if (gettime(3) >=20 && gettime(3) <=23) set $@isnight, 0; day; end; Edited February 5, 2017 by mirabell wrong part of script Quote Link to comment Share on other sites More sharing options...
0 Akkarin Posted February 5, 2017 Group: Forum Manager Topic Count: 282 Topics Per Day: 0.06 Content Count: 3144 Reputation: 1632 Joined: 03/26/12 Last Seen: April 15 Share Posted February 5, 2017 If-statements with more than one line of code to perform should be in curly braces: OnInit: if (gettime(3) >=0 && gettime(3) <=3) { $@isnight = 1; night; } if (gettime(3) >=4 && gettime(3) <=7) { $@isnight = 0; day; if (gettime(3) >=8 && gettime(3) <=11) { $@isnight = 1; night; } if (gettime(3) >=12 && gettime(3) <=15) { $@isnight = 0; day; } if (gettime(3) >=16 && gettime(3) <=19) { $@isnight = 1; night; } if (gettime(3) >=20 && gettime(3) <=23) { $@isnight = 0; day; } end; Don't forget that gettime() now uses constants: Quote *gettime(<type>) This function will return specified information about the current system time. DT_SECOND - Seconds (of the current minute) DT_MINUTE - Minutes (of the current hour) DT_HOUR - Hour (of the current day) DT_DAYOFWEEK - Week day (constants for MONDAY to SUNDAY are available) DT_DAYOFMONTH - Day of the current month DT_MONTH - Month (constants for JANUARY to DECEMBER are available) DT_YEAR - Year DT_DAYOFYEAR - Day of the year It will only return numbers. If another type is supplied -1 will be returned. if (gettime(DT_DAYOFWEEK)==SATURDAY) mes "It's a Saturday. I don't work on Saturdays."; Quote Link to comment Share on other sites More sharing options...
0 mirabell Posted February 5, 2017 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 197 Reputation: 19 Joined: 11/20/11 Last Seen: February 28 Author Share Posted February 5, 2017 (edited) thanks so i should be using (gettime(DT_HOUR) >=16 && gettime(DT_HOUR) <=19) thanks i forgot about the curls its been 4 years since i wrote a script Edited February 5, 2017 by mirabell 1 Quote Link to comment Share on other sites More sharing options...
Question
mirabell
this isnt working for me not sure why
OnInit: if (gettime(3) >=0 && gettime(3) <=3) set $@isnight, 1; night; if (gettime(3) >=4 && gettime(3) <=7) set $@isnight, 0; day; if (gettime(3) >=8 && gettime(3) <=11) set $@isnight, 1; night; if (gettime(3) >=12 && gettime(3) <=15) set $@isnight, 0; day; if (gettime(3) >=16 && gettime(3) <=19) set $@isnight, 1; night; if (gettime(3) >=20 && gettime(3) <=23) set $@isnight, 0; day; end;
wrong part of script
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.