map-server crash - buggy scripts

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

map-server crash - buggy scripts

Post 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)
Former programmer for the TMWA server.
User avatar
Kage
Manasource
Manasource
Posts: 929
Joined: 02 May 2009, 18:12

Re: map-server crash - buggy scripts

Post 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.
<Kage_Jittai> ... are you saying I am elite :D
<thorbjorn> Yes. :P
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: map-server crash - buggy scripts

Post 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.
Former programmer for the TMWA server.
alastrim
Novice
Novice
Posts: 139
Joined: 02 Jun 2009, 12:19
Location: Brasil

Re: map-server crash - buggy scripts

Post 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.
User avatar
Jenalya
TMW Adviser
TMW Adviser
Posts: 717
Joined: 22 Sep 2010, 19:28

Re: map-server crash - buggy scripts

Post 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.
alastrim
Novice
Novice
Posts: 139
Joined: 02 Jun 2009, 12:19
Location: Brasil

Re: map-server crash - buggy scripts

Post 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".
User avatar
Jenalya
TMW Adviser
TMW Adviser
Posts: 717
Joined: 22 Sep 2010, 19:28

Re: map-server crash - buggy scripts

Post 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
Post Reply