Event for player enters room, after fade-in?

Started by frission, Tue 09/10/2007 17:09:42

Previous topic - Next topic

frission

Throughout the manual I see references to being able to call an event for when the player enters room, after fade-in, but I don't see how to do it. I see the on_event function only has a setting for calling an event BEFORE the fade-in. I can see how to set up an interaction for it, but I'd rather do this in the script itself (I need it to reference a few variables and be something I can easily change along with the rest of hte script).

From using the search feature on here I see some people with code that looks auto-generated by AGS (with #sectionstart headers) for this purpose, but I don't see how to get mine to do that. Is this a bug in the current version of AGS? (I only wonder since apparently another aspect of it didn't generate the appropriate code block when I asked a previous question of this nature)

Thanks again! Things are going along quite nicely on the whole with this project.

Khris

I'm not sure if I understand you correctly; if I do, the solution is simple:
In Room editor -> Settings, click the button with the red i, double-click "player enters screen (after fadein)", add a RunScript-action.
QuoteI can see how to set up an interaction for it, but I'd rather do this in the script itself
My only conclusion from that sentence is that you've never used a single RunScript-action before. But from the rest of the script I understand that you're familiar with scripting.
I'm confused :=

monkey0506

AGS 2.72 and earlier it uses the Interaction Editor. Open the room, click on the 'i' button, and you'll see "Player enters room (after fadein)". You can use the Interaction Editor to add simple interactions, or you can use a "Run script" action to automatically generate a function (that will probably be something like "room_a()") to allow you to edit the script.

AGS 3.0 it's now in the events pane where you can define a custom function name, for example, "room_AfterFadein". You will then need to define the function in your room script which is as simple as opening the room script and typing:

Code: ags
function room_AfterFadein() {
}


You can then put your scripts within that function.

frission

#3
Quote from: monkey_05_06 on Tue 09/10/2007 17:23:12
AGS 2.72 and earlier it uses the Interaction Editor. Open the room, click on the 'i' button, and you'll see "Player enters room (after fadein)". You can use the Interaction Editor to add simple interactions, or you can use a "Run script" action to automatically generate a function (that will probably be something like "room_a()") to allow you to edit the script.

OK, I think this is what I was looking for. Thanks!

Quote from: KhrisMUC on Tue 09/10/2007 17:22:18
My only conclusion from that sentence is that you've never used a single RunScript-action before. But from the rest of the script I understand that you're familiar with scripting.
I'm confused :=
Thanks! I'm much more comfortable with scripting in general than the interface, as I think is probably clear here! :-) I'm still feeling my way around how they fit together.

monkey0506

Yes...AGS 2.72 and earlier often required users to access the interaction editor sometimes even if only to add a run script action. AGS 3.0 has done away with the interaction editor in favor of telling people "RTFM" and "use scripting, it's easier and more powerful." ;D

You'll need to use the interaction editor to set up certain room interactions (like enter after fadein and first entry) as well as character interactions, though you can always just use "run script" actions.

SMF spam blocked by CleanTalk