LearningRO Posted June 10, 2020 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
0 Emistry Posted June 13, 2020 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
0 LearningRO Posted June 10, 2020 Author 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
0 LearningRO Posted June 13, 2020 Author 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
0 Emistry Posted June 14, 2020 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
0 LearningRO Posted June 14, 2020 Author 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
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
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.