Mantis

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015628Runner[All Projects] VariablesPublic2014-08-07 18:522017-12-06 09:46
ReporterParodyKnaveBob 
Assigned ToSteven Campbell 
PriorityHighSeverityC - GeneralReproducibility100%
StatusAssignedResolutionOpen 
PlatformWindowsOSWindows VistaOS VersionSP2
Summary0015628: Variables: Room Creation Code returns unpredictable results for objects and events
DescriptionWhen I first started taking notes (finally) to report this bug, I looked at object_index, event_type, and event_number in Room Creation Code on a small project I'd been building on for quite awhile, and I got the following results:

object_index - 0
event_type - 11
event_number - 87

In preparing a demo project for this report, however, I started with a new, blank file -- one room, no objects -- and this is what I got:

object_index - 0
event_type - 0
event_number - 0

If I were to use a general script for something -- in which I'd built debugging information to better locate issues -- and it needed to alert me of an error, instead of telling me it's in no-object's no-event or some-specialized-event-id, I would be told it's in the first object's Create Event -- but only for that project. There's no telling what numbers I'd get for other projects (as seen in the first output example above). This unpredictability can potentially lead to a lot of wasted time tracking bugs' phantom locations -- especially when using object_get_name() on an object_index to display a human-readable name that a programmer doesn't realize is wrong!
Steps To Reproduce1. New project.
2. New room.
3. Room Creation Code:

show_debug_message("object_index:" + string(object_index));
show_debug_message("object name: " + object_get_name(object_index));
show_debug_message("id:" + string(id));
show_debug_message("event_type:" + string(event_type));
show_debug_message("event_number:" + string(event_number));

4. Run in debug mode.
5. Observe 0's (probably) for all values except object name, which is "undefined" in angle brackets.
Additional InformationIn my repro steps, I included id, too, but I see that gives a pretty distinct value at least.
1.4 Version1.99.182
2.x Runtime Version
2.x Runtime Version Verified In
Attached Files

- Relationships

-  Notes
(0031647)
Neil Wicker (Updater)
2014-08-08 08:44

There shouldn't really be any reason for people to use object_index in room creation code but I'll assign this on as it should definitely report something other than <undefined>.
(0031651)
ParodyKnaveBob (Updater)
2014-08-08 10:54

In general, I would agree that explicitly trying to use object_index unscoped/unprefixed in Room Creation Code is rather pointless, but like I said in the report, if a person creates a script which is designed with generalized debug information, the confused debug info errantly reports an invented object and event.

If a room reported itself as object noone, that would at least make more sense. As for the event, it might be wise anyway to have additional event values for Room Creation Code and Instance Creation Code.
(0036707)
ParodyKnaveBob (Updater)
2015-04-06 16:21

I just realized, as a suggestion about event constants, you could group object Create Event, Room Creation Code, and Instance Creation Code all under the ev_create event_type but with different event_number entries -- like ev_create_object, ev_create_room, ev_create_instance.
(0056904)
ParodyKnaveBob (Updater)
2017-12-06 09:46

Related to 0027235 perhaps?


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker