Affecting objects of a room inside of a dialog script?[SOLVED]

Started by Ibispi, Tue 14/01/2014 21:00:02

Previous topic - Next topic

Ibispi

Hello everyone,

I have walked into a minor problem, that I'm sure can be solved somehow(in fact, I already know the solution, but it is too complicated :=).

I was wandering if it was possible to affect objects of a certain room inside of dialog script? I have looked through the AGS manual and found no solutions.
as an example(what I'm trying to do): I want to change oRefrigeratorDoor.Visible to true inside of a dialog script; and the error shows up, as it finds the object unkown to the script.

The solution that I was talking about would be to define a global boolean and then use Repeatedly execute function inside of a room, where it would check when this boolean becomes true, so I could do that what I wanted to do inside of the room.

Therefore, is there a way to connect dialog script with room script(other than this complicated global variable/boolean thing)?

Thanks in forward!  :kiss:

Ghost

Arg, I misread the question. Sorry.

But you can have room claim_events. They should work nicely.

monkey0506

If you specifically need to address a room object from a dialog which may occur outside of the room the object is in, you can consider using a Character instead, or check out the OtherRoom module (which AFAIK, should still work with the latest versions of AGS).

Khris

This question comes up all the time and has been answered countless times already.

Basically, if the object is in the current room, you can access it using the object[] array.
Assuming the fridge door has ID #2: if (player.Room == 3) object[2].Visible = true;

You already mentioned the other solution (which applies if the object is in another room). That's the standard way of doing things like that. The only thing you should do different is check for the boolean in the room's "enters before fadein" event / room_Load, not rep_exe.

Ibispi

Quote from: Khris on Tue 14/01/2014 21:50:40
Basically, if the object is in the current room, you can access it using the object[] array.
Assuming the fridge door has ID #2: if (player.Room == 3) object[2].Visible = true;

IT WORKED! :cheesy:
Thank you sir.

And thanks Ghost and Monkey for trying to help!

SMF spam blocked by CleanTalk