Room Script doesn't do anything!

Started by Salzi, Fri 25/01/2019 12:50:41

Previous topic - Next topic

Salzi

Hey guys, absolute beginner here.

I am trying to have a dialog (dDialog5) start right when the room loads.
I used this code in the room script:

Code: ags

function room_AfterFadeIn()
{
  dDialog5.Start();
}


This code works when clicking on a character in this room and others, but nothing is happening when I put a command in this room directly. I tried multiple options, like:

Code: ags

function room_AfterFadeIn()
{
  Speech.Style = eSpeechSierraWithBackground;
  aMusic1.Play();
  gBuch.Visible = true;
}


But none of those commands work when I start up the room.
Anyone got an idea? :-[

Crimson Wizard

First thing to check, have you just pasted this function there, or connected to real event in room Events panel?

Connecting functions with events is explained here: https://www.adventuregamestudio.co.uk/manual/acintro3.htm

Salzi

I thought about that already, but what kind of event would it be? I don't want the player to have to click on anything, I want the events to start right when the room loads - it works with starting the music etc in other rooms, just not in this one.

Matti

I think Crimson asked if you properly linked the room_AfterFadeIn()-event via the room's properties panel (instead of just copy-pasting it for example). Does it look like this:


Salzi

Ohh thank you so much, it works now! This small thing has given me such a headache! :-D

ManicMatt

Just incase you haven't realised this, there's no need to type in the room function code room_AfterFadeIn and so on. The first time you need it, click on those dots (...) and ags will automatically generate the required code for you to type your script events into and jump to the room script page. If you already have the function code in place, ags will just jump to the room function code already in place, which is handy to quickly find that part of the code.

Its best imo to get into this habit because then you won't ever forget to enter the code in the properties panel.

SMF spam blocked by CleanTalk