Difference between revisions of "RogueScript"
Jump to navigation
Jump to search
m |
m |
||
Line 17: | Line 17: | ||
* turn | * turn | ||
* | * key_press | ||
* give | * give | ||
* | * throw | ||
* | * throw_hit | ||
* inter | * inter-use | ||
* intra | * intra-use | ||
* hover | * hover | ||
* touch | * touch | ||
* | * pick_up | ||
* drop | * drop | ||
* quaff | |||
* eat | |||
* target | |||
* inventory | |||
* kick | |||
* apply | |||
* look | |||
* chat | |||
== Example == | == Example == |
Revision as of 12:56, 6 November 2010
Description
RogueScript is a proposed interpreted language with C style syntax. It will be based loosely on NWScript. It should be noted, however, that this language is not intended to be used in development of an engine, but as a means to control roguelike objects within a user-made game world (created with a game creation system).
Features
- familiar syntax (C family)
- simple, yet powerful scripting (without arrays, structs, or pointers)
- dynamic typing
- easy interaction with game world things
- basic types (such as bool, undefined, float, int, string)
- reasonable speed
Events
Most game world objects can have scripts attached. Script functions are attached to various events.
- turn
- key_press
- give
- throw
- throw_hit
- inter-use
- intra-use
- hover
- touch
- pick_up
- drop
- quaff
- eat
- target
- inventory
- kick
- apply
- look
- chat
Example
begin() { log("Hello World"); } use() { rDoor = GetArgument(ENV, 0); if (IsObjectRef(rDoor)) { iObs = GetObjectProp(rDoor, OBJECT_PROP_OBSTRUCT); if (iObs) SetObjectProp(rDoor, OBJECT_PROP_OBSTRUCT, 0); else SetObjectProp(rDoor, OBJECT_PROP_OBSTRUCT, 1); } return 1; /* override normal door behaviour */ }