Page 1 of 1

map-server crash - buggy scripts

Posted: 03 Sep 2011, 04:42
by o11c
Today the map server crashed, which we believe is due to a buggy script, although we're not sure.

I have disabled or edited the following NPCs which were problematic:
  • (001-1) Elanore::OnPCKillEvent: probably not an error, but I fixed it anyway
  • 033-1 Kimarr - probably okay, but I fixed it anyway
  • 008-1 Andra - I might have fixed this, but I'm not sure so I disabled it anyway
  • 042-1 Hasan - there seems to be missing logic for if the intended fighter logs out
  • 025-1 the entrance to the whole Rossy quest on maps 025-3 and 025-4, which code has numerous problems.
When writing or review scripts, remember that the player can log out at any blocking moment (e.g. next), or between any callbacks.

Also, you cannot do blocking dialog from a callback (OnTimer or OnFooDeath)

Re: map-server crash - buggy scripts

Posted: 03 Sep 2011, 05:13
by Kage
o11c wrote: When writing or review scripts, remember that the player can log out at any blocking moment (e.g. next), or between any callbacks.
The scripting engine should be smart enough to fix this, each player should have their own script stack which is deleted if they leave.

Re: map-server crash - buggy scripts

Posted: 03 Sep 2011, 06:30
by o11c
Kage wrote:
o11c wrote: When writing or review scripts, remember that the player can log out at any blocking moment (e.g. next), or between any callbacks.
The scripting engine should be smart enough to fix this, each player should have their own script stack which is deleted if they leave.
Not directly, but perhaps indirectly.

But, permanent variables, inventory, etc. may be left in a half-changed state.

That being said, I do not believe that a player logging out across a 'next' or input is the problem, but logging out across a timer or event.

Every quest that relies on such must take care to reset global variables if the player disappears, I believe this needs to happen with the tutorial e.g., but it's getting late.

I did update the wiki by splitting it roughly into sections, and did some minor description changes.

Re: map-server crash - buggy scripts

Posted: 03 Sep 2011, 15:03
by alastrim
On Barriers.txt(025-3) and Battlecaves.txt(025-4):
A lot of changes on these 2 files. I hope it is less confusing now:
http://gitorious.org/+tmw-admins/tmw/tm ... ef4d07e1aa

On Hasan.txt(042-1):

Changed a "close" command for "end" in "onScorpionDeath" label, since there is not a dialog open at this point.

On Tanisha.txt(042-2):

Changed a "close" command for "end" in "onTick" label, since there is not a dialog open at this point.

Re: map-server crash - buggy scripts

Posted: 03 Sep 2011, 15:30
by Jenalya
I pushed a temporary fix for the tutorial in tmwa-server-data, so new players can do a shortened version of the tutorial and don't get trapped in the starting area.
This one should be reverted before we merge the fixes from tmwa-server-test.

In tmwa-server-test I added a check of the return value from attachrid() in several scripts.

Re: map-server crash - buggy scripts

Posted: 03 Sep 2011, 17:01
by alastrim
I changed more things in hasan.txt.

When there was a fight going on, you would always go to the label in which he is afraid of the scorpion, blocking other people from talking normally with him.

I also tried to simplify the checks in "Ontimer5000".

Re: map-server crash - buggy scripts

Posted: 04 Sep 2011, 10:16
by Jenalya
alastrim wrote:I changed more things in hasan.txt.

When there was a fight going on, you would always go to the label in which he is afraid of the scorpion, blocking other people from talking normally with him.

I also tried to simplify the checks in "Ontimer5000".
Did some more changes about that, since the player got the wrong dialogue part when talking to Hasan after starting a scorpion fight.

Also, I reenabled the disabled NPCs in tmwa-server-test and restarted the testserver with the latest version:
http://forums.themanaworld.org/viewtopi ... 13&t=14050