Scriptable events

Scriptable events

Postby unixfreak » 09 Apr 2012, 21:21

Hi, i read a post here the other day where quin mentioned about worldalias triggers and being able to change the music for example; viewtopic.php?f=53&t=2942#p28926

I've been working on a campaign map with several rooms and triggers to open/close the doors which works nicely using the in-game linking. (trigger entity is set to toggle,action,off)

So far i've had no luck trying to echo a line of text using this method, the command i am using: in the map.cfg
{l Code}: {l Select All Code}
worldalias on_trigger_86 = [  echo "^fz43!^f7ALERT^fz43! ^f4sector ^f6A^f02 ^f4has been opened: 30 seconds until lockdown." ]

Where the trigger "index" is also 86. Having changed the parameters for the trigger entity to: script,action,off)

Screenshot in case i have changed something i shouldn't of :p
Image

Also i have looked at the SP gamemode configs from sauerbraten and tried using the same methods in RE but they don't seem to be working either (ex; alias level_trigger_20 [ echo "blah" ])

I'm not sure what i'm doing wrong, assuming RE already has support for scriptable events. I'm basically trying to have a scenario where a player presses a button on a wall, and a door somewhere else in the map opens up for a short period of time, so the player has to run inside to advance to the next section, before the door shuts on them.

Having said that, i want to print a "notice" message to alert the players that a specific door has been opened, and then i guess i would need to know how to control the doors "state" from inside the map config... i would assume it would involve using a sleep loop for 30 seconds but i'm unaware of how to open and close a door using this method, any help on that too would be great, cheers.
User avatar
unixfreak
 
Posts: 82
Joined: 02 Feb 2012, 11:54
Location: Bristol, England

Re: Scriptable events

Postby unixfreak » 10 Apr 2012, 01:09

*edit: made things more clear.*

Ok, quin answered my first question on another thread, i had the wrong syntax being part of the problem; here's how it goes (maybe someone could add it to the wiki? i don't have an account on there for now)

If you set the id of a trigger to 1, and then enable the script paramater, you would use this;
{l Code}: {l Select All Code}
worldalias on_trigger_1 [
        // code goes here
]

ps, i don't think you need to write worldalias, when you save the map it removes it from the cfg file, and funny enough it re-adds the "=".


However, i'm not sure how to actually open a door now; here's what i'm trying to do and a small function if written so far (which works!! yay):
{l Code}: {l Select All Code}
on_trigger_1 = [
        if (= $t1_active 0) [
                echo "^fz43!^f7ALERT^fz43! ^f4sector ^f6A2 ^f4has been ^f0OPENED^f4: 30 seconds until lockdown."
                t1_active = 1

                sleep 30000 [
                        echo "^fz43!^f7ALERT^fz43! ^f4sector ^f6A2 ^f4has been ^f6CLOSED^f4."
                        t1_active = 0
                ]
        ]
]
t1_active = [0]


How can i control a door's state open/closed when using the script parameter on an entity? Ideally, i want the linked door to open, and then close when the sleep loop has ended.
User avatar
unixfreak
 
Posts: 82
Joined: 02 Feb 2012, 11:54
Location: Bristol, England

Re: Scriptable events

Postby qreeves » 10 Apr 2012, 08:49

You can link a trigger to another trigger to have it inherit the state of the pressed trigger. There is no way to do this from the script.
Quinton "quin" Reeves | Lead Developer, Red Eclipse | http://redeclipse.net/ | http://www.facebook.com/redeclipse.net
User avatar
qreeves
 
Posts: 1294
Joined: 17 Mar 2011, 03:46
Location: Queensland, Australia

Re: Scriptable events

Postby unixfreak » 10 Apr 2012, 16:39

qreeves {l Wrote}:You can link a trigger to another trigger to have it inherit the state of the pressed trigger. There is no way to do this from the script.


Hmm, well i only seem to get this when trying your suggestion:
{l Code}: {l Select All Code}
failed linking 104 and 99 (1)


I did play around with two triggers linked to a single door, however it seems to work as just that, 2 seperate triggers.
ie; one trigger will run the script, but the door will not open, the other trigger opens the door, but doesn't run the script.
User avatar
unixfreak
 
Posts: 82
Joined: 02 Feb 2012, 11:54
Location: Bristol, England

Who is online

Users browsing this forum: No registered users and 0 guests