ObjectON in another room

Started by fiaschetta, Sat 29/04/2006 03:24:30

Previous topic - Next topic

fiaschetta

I stay in room 4... I want that after a dialog with a charcather in room 4, the object (3) of the room 2 become visible..
How i do?

Ashen

1) (as I said in another thread of yours, in a vague way) Use variables. In the dialog change a variable value -you can do this directly, using GlobalInts, and the dialog script command set-globalint, or use your own int, and the run-script command (here's a list of dialog script commands, or do a forum search if you want more detail on run-script, it's explained in a few threads). Then, when you enter room 4, check that variable's value and turn the object on if needed. If it's an object the player can then take from the room, don't forget to change the variable back when they do, or it'll be turned on again when they re-enter the room.

2) (as strazer said in that other thread) If you're going to be doing a lot of manipulating objects, hotspots, etc in other rooms, you might find his OtherRoom module usefull, as it takes care of all the variables for you.
I know what you're thinking ... Don't think that.

fiaschetta

Well.

In script of dialog:

@1
EGO: Ciao!
run-script 2
stop

then in global script (i used the OTHEROOM MODULE):

function dialog_request (2)  \lbraceraw
OtherRoom.ObjectOn (3,3);
\rbraceraw
{


But when i test game have an error of: ERROR : Parse error at '2'

Why?

Ashen

(I'm assuming the brace errors - e.g. \lbraceraw instead of { -  are just how it's copied, and they're OK in the script itself.)

Because you've declared the dialog_request function wrong. Do a forums search, or read the BFAQ entry to find more details. It should look like:
Code: ags

function dialog_request (int param)  {
  if (param = 2) {
    OtherRoom.ObjectOn (3,3);
  }
}
I know what you're thinking ... Don't think that.

fiaschetta

#4
Ok, but when i test game go out this error:

objecton is not a pubblic member of 'otheroom'

Ashen

#5
Well, at least the run-script part seems to be working now.

That looks like it's an error either with the module itself, or with how you've set it up. I'm not actually familar with that module - are you sure you've got the function name (ObjectOn) right? (I just copied what you had, not sure if that's what it's actually called.) Also, check capitialisation (ObjectOn, vs Objecton, objecton, objectOn, etc).

EDIT: OK, just checked the module's readme. The function is OtherRoom.Object_On with an underscore, and should appear in the autocomplete - so provided you don't just copy-paste code without checking it, you should be OK.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk