Contraptions Design Specification
Section 3.14.x : Scripting
By Kenneth Manta
I miss Happydance :( Best script function ever.
Current Implementation
Script locations
- GUI::Game Init
- GUI::Network IP Init
- Session::Event Scripts
The only serializable events are player ship:OnKey scripts. Network play ususaly does not need the events.
Currently Implemented Event Scripts
These scripts need special handling or are currently implemented to do so.
- InitDisplay
- Session::InitScript
- ?::OnKey
- Level::OnKey
- Widget::OnDestroy: currently implemented poorly. Should make the CPtrScript
- Whatnot::OnPlayerTouch
- Whatnot::OnShipTouch
- ::OnTimer
- Ship::OnCreate
- The following are implemented as an array of scripts
Session::Abort: Player aborts a challenge
Session::Abandon: Abandon ship
Session::Respawn:
LevelDone
Better Script Design
The following objects have the following events
Objects
- Widget
- Contraption
- WhatNot
- Future::Thingamabob
- Map(Level)?: Some events dont make sense in this
- Future: Dohickies? these events are delayed
Events
---Local Events---
--Creation/Destruction--
- OnCreate: Not necessarily when the object is created but when its added to the session.
- OnDestroy: Unlike destructors in programming languages, this never gets called when the session ends.
--Physics events--
- OnTouchWidget: OnTouchShip does not exist as you cant point to ships
- OnTouchPlayer
- Future:OnTouchThingamabob
---Global Events---
--Session Events--
These events are slightly different in that there are mulitple instances of that event each with a specific ID
- OnTimer(N)
- OnKeyHit?(N)
--The follow events are triggered by menu actions--
- Abort: Player aborts a challenge
- Abandon: Abandon ship
- Respawn:
- LevelDone
- Future: Custom Global Events. Caused by Trigger(EventID)
Implementation
CScriptPtr
CScriptEvents Event;
Event(OnDestroy);
CScriptEvents uses a map from string to CScriptPtr
Future Ideas
After the game is released, start creating a lot of events.
Copyright 2004-2005 © Polyart. All rights reserved.