NewRoomEx Bug

Started by Mr Flibble, Sat 24/04/2004 20:45:54

Previous topic - Next topic

Mr Flibble

The NewRoomEx script normally works, as does its interaction partner, but in one room, it doesn't.

I want a player to click on a hotspot, walk to it, then go to Room11. I tried changing it a region, then a 'Left Edge'  command, but still nothing.I have programmed things like this countless times before.

The NewRoom code works fine though. And NewRoomEx works fine in all other rooms.
Could someone please identify this problem and tell me how to rectify it, or instruct me on the data column (Edge+offset) usage.

It may be in the manual, but I couldn't find it.
Ah! There is no emoticon for what I'm feeling!

Ashen

When you say it doesn't work, how do you mean? Does it do nothing, does it crash the game, does it go to the wrong room, does it go to the right room at the wrong place? I don't mean to sound patronising, but how it goes wrong affects how you fix it. Help us to help you (did I mention not wanting to sound patronising?).

Scummbuddy

and we'll need to see the surrounding code of the problem.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Mr Flibble

I have the latest AGS with the SP1.
I have put in a hotspot, number 4.
When the player clicks on it, they walk to it, but instead of going to a different room, the music stops, and the character kinda 'jumps' to the edge of the hotspot that is in a walkable area. Repeated clicking does the same.

The interaction is placed in the 'walk to' slot. I tried putting it in any click but it doesn't work.

Once I got an error message that said something like
" NewRoom 2 codes in script" or something. I can't get it exactly because it hasn't come up again.

Either fixing that, or reminding me about edge+offset (which still works) would be of great help.
Ah! There is no emoticon for what I'm feeling!

Ashen

Try putting it in the 'Interact Hotspot' slot instead, and set the 'Walk To' point for the hotspot.

Alternatively, maybe making the hotspot a region, and using 'Player Wlaks onto Region' would work better.

Mr Flibble

Both tried. Both failed.
It doesn't matter anymore though, my data got wiped.
I'll have to start from the level of the demo.
( I posted it in the appropriate forum, you can find it if you want it).
Maybe the problem will just sort itself out.
Ah! There is no emoticon for what I'm feeling!

higgins131

i am having the same problem. i want to walk across the room to a desk, display a message, then go to a new room depending on the global variable (theres one view of a close desk and one view of an open desk). to the best of my scripting knowledge i did this :

if(GetGlobalInt(1)==1) {
MoveCharacter(JUSTIN,31,50);
DisplayMessage(0);
NewRoomEx(5,0,0);
}

if(GetGlobalInt(1)==2) {
MoveCharacter(JUSTIN,31,50);
DisplayMessage(0);
NewRoomEx(6,0,0);
}  

i don't know where my problem is. the character would walk to the desk and then nothing would happen. i've tried movecharacterblocking and movecharactertohotspot and they did the same thing. can someone please tell me what i am/might be doing wrong?

Ashen

Mr. Flibble: sorry to hear that, hopefully the second time round, it'll work otu.

higgins, I can see two possible problems here:

1. You're sending Justin to coordinates 0,0 the absolute top left of the screen, meaning he would be totally invisible. This may cause the AGS engine a problem.

2.  Are you sure GlobalInt 1 is set to either value. By default, I think the GlobalInts are set to 0.

And finally, where exactly in the script have you put this?

Hope this helps.

higgins131

ya, i realize i was pretty undespcriptive there now. i have it set so that my character will not appear on the screen so its like a view (like looking at a keypad in some games, think larry vales). i will explain how this works out in simple commands. i walk to the desk, display the message, go to room 5 (the close desk view), click the button to open the desk, go to room 6 (the open desk view). now i want to experiment with this for later use and formality because if i leave room 6 and go back it takes me to room 5. so i programmed the "open desk" button's interact script like this :

SetGlobalInt(1,1);
if(GetGlobalInt(1)<2) {
GetGlobalInt(1)+1;
DisplayMessage(6);
DisplayMessage(3);
NewRoomEx(6,0,0);
}  


so it is very possible i made the mistake here as well. i have tried different combinations with the global bariable change too but i am not sure which ones worked so i used the ones that would let me save the script. i really appreciate u looking at this. any idea what i am doing wrong?

Ashen

OK, how's this (sorry for the long post):

In the first room, where you walk to the desk, set the desks 'Look at' interaction to:

MoveCharacter(JUSTIN,31,50);
while (character[JUSTIN].walking == 1) {
 wait (1);
}
DisplayMessage(0);
if (GetGlobalInt (1) ==0) {
 NewRoom (5);
}
else if (GetGlobalInt (1) ==1) {
 NewRoom (6);
}

Since the chacter won't be seen in the next rooms, you don't actually need to use NewRoomEx.
Then in Room 5, make the desk 'Use' interaction:

DisplayMessage(6);
DisplayMessage(3);
SetGlobalInt (1,1);
NewRoom (6);

to 'open' the desk, and in Room 6, make the desk 'Use' interaction:

DisplayMessage(6);
DisplayMessage(3);
SetGlobalInt (1,0);
NewRoom (5);

to close it again.
I think the problem with your script is it doesn't let GlobalInt 1 get above 2, as it resets it every time it's called. Another thing to bear in mind is that the message numbers are room dependant, so it might be easier to use:

Display ("Message Text Here.");

since you're working in the script editor anyway.

higgins131

yes! thank u very much. i added u to a list of credits that i'll eventually display in my game. after some of my own minor editing it all worked out. i needed ur base scripting first though. i did have to switch NewRoom back to NewRoomEx because with NewRoom it would just have my character standing in the corner of this giant desk. otherwise it all works just like i wanted. thanks a lot!

Gilbert

And as a side note,  remember, the line below is meaningless:
GetGlobalInt(1)+1;

You MUST use SetGlobalInt() to alter a global int's content, if you want to add 1 to global int #1, they the proper code is:
SetGlobalInt(1,GetGlobalInt(1)+1);

Ashen

Glad I could help.
On the 'Settings' page of the room editor, there's a 'Hide Player Character' option. If you don't want the character to be seen, this is easier than having to reset his location when you go back to the main view. Bit pointless if you've already sorted it out, but might save a little time if you've got a lot of rooms like this.

SMF spam blocked by CleanTalk