Events
Positions like Passages, with Scripts belonging to the event.
In this case, there is no object needed to trigger the script. Entering / Leaving the tile(s) is triggering the event.
Events
Moderator: Developers
- bitnapper
- Tome Mimic (Module Baker)
- Posts: 135
- Joined: Fri Jan 30, 2009 3:33 pm
- Location: Somewhere near the alps
- Contact:
Events
Yes in the
'gamedat'-folder
E.g:
An event could be for an example an invisible teleporter, an info-message, spawn surprisingly a monster at a position, initiate the movement of a guard...
I think, the scripts have to be enumerated eg. script1.txt / script2.txt and so on, where the number of the script is the number of the event, because there is no possibility yet to have multiple scripts in the same text file, if I got that right.
'gamedat'-folder
E.g:
Code: Select all
TopleftXY BottomrightXY ScriptNo
36 50 37 50 1
I think, the scripts have to be enumerated eg. script1.txt / script2.txt and so on, where the number of the script is the number of the event, because there is no possibility yet to have multiple scripts in the same text file, if I got that right.
Two beer or not two beer... rather a malt whisky
- bitnapper
- Tome Mimic (Module Baker)
- Posts: 135
- Joined: Fri Jan 30, 2009 3:33 pm
- Location: Somewhere near the alps
- Contact:
Events
Example for usage of events:
There are 10 Braziers on the map. They all use the same object from the object folder (with no script)
For 6 of this braziers there is an event-script based on the braziers position.
4 Braziers are 'for decoration' only
Benefits:
- The brazier has only to be once in the object list, because the event-script is separated from the displayed object (less use of memory / load function)
- Use of objects from the GOR and having an user-defined script for its event
- There is no need to have an object at all for something to happen
- No complicated Link Passage ==> Object ==> Event-Script
There are 10 Braziers on the map. They all use the same object from the object folder (with no script)
For 6 of this braziers there is an event-script based on the braziers position.
4 Braziers are 'for decoration' only
Benefits:
- The brazier has only to be once in the object list, because the event-script is separated from the displayed object (less use of memory / load function)
- Use of objects from the GOR and having an user-defined script for its event
- There is no need to have an object at all for something to happen
- No complicated Link Passage ==> Object ==> Event-Script
Two beer or not two beer... rather a malt whisky
- bitnapper
- Tome Mimic (Module Baker)
- Posts: 135
- Joined: Fri Jan 30, 2009 3:33 pm
- Location: Somewhere near the alps
- Contact:
Further example
If I want the player to solve the following puzzle:
- He has to light to braziers to open a door
This could be solved with events.
Can it be solved with the actual 'script per object' ?
To make it easier to write such puzzles, it would be handy if there is an array of flags to set / unset, which could be changed / queried by a script.
- He has to light to braziers to open a door
This could be solved with events.
Can it be solved with the actual 'script per object' ?
To make it easier to write such puzzles, it would be handy if there is an array of flags to set / unset, which could be changed / queried by a script.
Two beer or not two beer... rather a malt whisky
- Zefz
- Squirrel Knight (Administrator)
- Posts: 3820
- Joined: Wed Jul 23, 2008 1:27 am
- Location: Norway
- Contact:
Egoboo uses a IssueOrder system and the IfOrdered to get "variable = selforder" and translates it to what it must do.
Example:
Currently braziers handle this with scripts. If they are lighted they open their assigned passage. If the brazier is normal or not depends on its content (also set in spawn.txt).
For example:
If a brazier has content 0 it will act as a normal lighted brazier.
If a brazier has content 1 it will not be lighted and open "selfpassage" when it is lighted.
"selfpassage" is also set in spawn.txt
This means all braziers can share the same generic script:
Example:
Code: Select all
script a:
IfBumped
tmpargument = [OPEN]
IssueOrder
script b:
IfOrdered
tmpx = selforder
tmpy = [OPEN]
IfXIsEqualToY
DoStuff
For example:
If a brazier has content 0 it will act as a normal lighted brazier.
If a brazier has content 1 it will not be lighted and open "selfpassage" when it is lighted.
"selfpassage" is also set in spawn.txt
This means all braziers can share the same generic script:
Code: Select all
IfReaffirmed //It got lighted
tmpargument = 1
IfContentIs //Is it a special brazier?
tmpargument = selfpassage
OpenPassage //Open our assigned passage