Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001314I6 LibraryGeneralpublic2014-05-26 22:182014-05-27 15:55
Assigned ToDavidG 
PlatformOSOS Version
Product Version6/11 
Target Version6/12Fixed in Version 
Summary0001314: If the player object has an orders property, that will execute whenever the player does something
DescriptionOrdinarily the player object has no orders property. If the game executes a ChangePlayer() on an NPC that has an orders property, that property will be run whenever the PC (formerly an NPC) tries to do something. In the example code, when the player is controlling the original PC, taking the rock works okay. If you hit George, you become George. Then when you try to take the rock, you get "Fatal error: Stack overflow". What happened was an infinite loop that ate up all of the VM's stack space after which the interpreter complained and aborted.
This severely limits how fun things can get when changing bodies.

The objective: Change things such that orders does not get executed if the object actually is the Player.
Minimal Source Text To Reproduce
Include "parser.h";
Include "verblib.h";
Include "Grammar";

[ Initialise;
	location = theroom;

Object theroom "The Room"
	with description "Just an ordinary room.",
	has light;

Object -> Rock "rock"
	with name "rock",
	description "Just a rock.";

Object -> George "George"
	with name 'George',
	short_name "George",
	description "It's George.",
	before [;
		"You feel oddly disoriented for a moment.";
	orders [;
		<<take noun, actor>>;
		<<drop noun second, actor>>;
	has male proper animate transparent;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
DavidG (developer)
2014-05-27 15:54

At ( [^]), Zarf pointed out that this behavior is correct. Exercise 52 in the DM4 talks about how a running orders routine can be useful for a player-controlled character. The solution, which seems obvious now that this was pointed out to me is to do a check like this:

if (self ~= player)
    <<take noun, actor>>;

- Issue History
Date Modified Username Field Change
2014-05-26 22:18 DavidG New Issue
2014-05-27 02:24 DavidG Assigned To => DavidG
2014-05-27 02:24 DavidG Status new => assigned
2014-05-27 02:25 DavidG Description Updated View Revisions
2014-05-27 15:54 DavidG Note Added: 0002840
2014-05-27 15:55 DavidG Status assigned => closed
2014-05-27 15:55 DavidG Resolution open => fixed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker