Monday, September 28, 2020

moving word in waitingroom

today I just review another member's script and this part caught my eye

HAHAHA !! this is so cute yet so wasting server resources !!!


I dunno I should praise him for creativity or comment him for being dump for wasting so much server bandwidth for doing this 😅

yes I don't recommend doing this on your live server ...
because every *waitingroom script command means sending one packet to each player surround this npc
... but I'm sooo impressed 😝

Sunday, September 27, 2020

A race condition in npc scripts

today I just reviewed a paid script (I couldn't show because its paid)
and I saw multiple errors and mistakes on the said script !!

this one in particular, is something less well known, but it is VERY important if you are making a Game script

let's give an example

at first glance this script looks bug free, but there is a race condition going on after the *input command

step to reproduce :-
1. open up 4 client, first 2 player claim the reward normally
2. on 3rd client, type 'ragnarok' but don't hit enter yet
3. on 4th client, type 'ragnarok' and hit enter, now the script says the event has ended
4. back on 3rd client, hit the Enter key, now this event has 4 players won this event !

to prevent this from happening, needs to add another check right after the *input command


another example is on my Private MVP Room script, which can be found in rathena repo
https://github.com/rathena/rathena/blob/a4d57cb8a398368c0d720aedc669dff88f73c4d4/npc/custom/etc/mvp_room.txt#L62-L66

now try remove these line
1. let player A register an empty room, but left the menu window open
2. player B register the empty room faster than player A
3. now both player A and player B can go into the same room !
4. if this is register under party/guild, player's B party/guild member couldn't get in even after paying the fees !!

so remember, if you are making a Game or Event script, every time after hitting a next; *menu *select *input *progressbar
the value might have changed from the original value, and might lead to race conditions between players

The Importance of *checkweight

today I just reviewed a paid script (I couldn't show because its paid)
and I saw multiple errors and mistakes on the said script !!

and this is one that MANY ... I mean MANY scripters has made this mistakes !!


if the player is currently overweight, or having more items than *getinventorysize(), the item will drop on the floor
if this actually happens, other players around this npc can come in to steal the reward item while the actual winner still desperately trying to store item

to fix this, all you have to do is add *checkweight script command
or use *rodex_sendmail script command ... or *mail script command for rathena

Linux compiler error that never shown on Visual Studio

let's just admit Visual Studio sux ... ok ? right now, if you want to host a Private Ragnarok Online server, its just better to choose...