LearningRO Posted June 10, 2020 Group: Members Topic Count: 107 Topics Per Day: 0.02 Content Count: 778 Reputation: 73 Joined: 02/10/12 Last Seen: 9 hours ago Share Posted June 10, 2020 (edited) Hi, i try to make enable/disable NPC in certain day if Day A will be open from 18 until 19 if Day B will be open 19 until 20 and i try to make the script like this prontera,139,219,3 script NPC 99,{ mes "helo"; close; OnClock1800: if ( gettime(DT_DAYOFWEEK) == SUNDAY ) { enablenpc strnpcinfo(0); end; } end; OnClock1900: if ( gettime(DT_DAYOFWEEK) == MONDAY){ enablenpc strnpcinfo(0); end; } if ( gettime(DT_DAYOFWEEK) == SUNDAY ) { disablenpc strnpcinfo(0); end; } end; OnClock2000: if ( gettime(DT_DAYOFWEEK) == MONDAY){ disablenpc strnpcinfo(0); end; } end; OnInit: disablenpc strnpcinfo(0); end; } my question its that script above already correct? or someone here have better version from me Edited June 13, 2020 by LearningRO to more informative Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted June 13, 2020 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 13, 2020 (edited) prontera,139,219,3 script NPC 99,{ mes "helo"; close; OnInit: OnMinute00: if ((gettime(DT_DAYOFWEEK) == SUNDAY && gettime(DT_HOUR) >= 18 && gettime(DT_HOUR) < 19) // Day A 1800~1900 || (gettime(DT_DAYOFWEEK) == MONDAY && gettime(DT_HOUR) >= 19 && gettime(DT_HOUR) < 20) // Day B 1900~2000 ) { hideoffnpc strnpcinfo(0); } else { hideonnpc strnpcinfo(0); } end; } Edited June 13, 2020 by Emistry 1 Quote Link to comment Share on other sites More sharing options...
0 Kreustoo Posted June 10, 2020 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 216 Reputation: 45 Joined: 05/03/13 Last Seen: March 9 Share Posted June 10, 2020 It seems good to me. Quote Link to comment Share on other sites More sharing options...
0 LearningRO Posted June 10, 2020 Group: Members Topic Count: 107 Topics Per Day: 0.02 Content Count: 778 Reputation: 73 Joined: 02/10/12 Last Seen: 9 hours ago Author Share Posted June 10, 2020 2 hours ago, Kreustoo said: It seems good to me. thanks i just want to know if there any better version for this script Quote Link to comment Share on other sites More sharing options...
0 LearningRO Posted June 13, 2020 Group: Members Topic Count: 107 Topics Per Day: 0.02 Content Count: 778 Reputation: 73 Joined: 02/10/12 Last Seen: 9 hours ago Author Share Posted June 13, 2020 (edited) 3 hours ago, Emistry said: prontera,139,219,3 script NPC 99,{ mes "helo"; close; OnInit: OnMinute00: if ((gettime(DT_DAYOFWEEK) == SUNDAY && gettime(DT_HOUR) >= 18 && gettime(DT_HOUR) < 19) // Day A 1800~1900 || (gettime(DT_DAYOFWEEK) == MONDAY && gettime(DT_HOUR) >= 19 && gettime(DT_HOUR) < 20) // Day B 1900~2000 ) { hideoffnpc strnpcinfo(0); } else { hideonnpc strnpcinfo(0); } end; } Thanks emistry i think your code style more better and Efficient than mine and already update my Tittle to be more informative BTW @Emistry Can you give me feedback or comments about my code style? Is there any possibility of bugs or not? Or just not efficient? Edited June 13, 2020 by LearningRO Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted June 14, 2020 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 14, 2020 your script, just redundancy, and NPC may not show upon reloaded at certain hours. performance-wise, maybe its is lightly better, since it do much less computation than mine, but its too less to be notice. 1 Quote Link to comment Share on other sites More sharing options...
0 LearningRO Posted June 14, 2020 Group: Members Topic Count: 107 Topics Per Day: 0.02 Content Count: 778 Reputation: 73 Joined: 02/10/12 Last Seen: 9 hours ago Author Share Posted June 14, 2020 10 hours ago, Emistry said: your script, just redundancy, and NPC may not show upon reloaded at certain hours. performance-wise, maybe its is lightly better, since it do much less computation than mine, but its too less to be notice. so my script more lightly but not effecient if accidently i must reloadserver coz the issue about npc not showing.. hmmm okay i get it emistry thanks you +1 Quote Link to comment Share on other sites More sharing options...
Question
LearningRO
Hi, i try to make enable/disable NPC in certain day
if Day A will be open from 18 until 19
if Day B will be open 19 until 20 and i try to make the script like this
my question its that script above already correct?
or someone here have better version from me
to more informative
Link to comment
Share on other sites
6 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.