error in script using character[].room and getglobalint

Started by Fabiano, Fri 06/08/2004 15:36:17

Previous topic - Next topic

Fabiano

Code: ags

if (IsKeyPressed(65)&&(GetGlobalInt(25)>0)) {
 
 character[GetGlobalInt(25)].room=character[0].room
 character[GetGlobalInt(25)].x=character[0].x
 character[GetGlobalInt(25)].y=character[0].y
 SetGlobalInt(25,0);
 LoseInventory((GetGlobalInt(25)));
}


i guess im missing something here. Can anyone shed me a light?
Yeah, yeah, It happens. A lot.

Radiant

What you're missing is an explanation of what you're trying to do and what actually happens.

At a guess, making a variable (GlobInt #3) refer to both a character and an inventory item may get you confused as they don't necessarily line up.
Also, where exactly are you putting this? Because the correct place would be on_key_press and then you'd be checking for keycode, not IsKP.

Fabiano

#2
uh...sorry :\

This part of the repeated execute is meant to say:

if you press key A and the global int 25 > 0, then the character X (meaning x is the number put on golbal int 25) appears in the same location as the character 0.

I'm using for a script that uses a key (a) to get and drop objects, each obj has a character (like, character 3 = inventory obj 3), but the ags always say (error parser in expression near "character") that is theÃ, 
Code: ags

"character[GetGlobalInt(25)].room=character[0].room"

so I'm doing something wrong, but i cannot find out what.
Yeah, yeah, It happens. A lot.

strazer

Code: ags

character[GetGlobalInt(25)].room=character[0].room
character[GetGlobalInt(25)].x=character[0].x
character[GetGlobalInt(25)].y=character[0].y


Are the semicolons missing in your script as well?

Fabiano

hehe... see? that happens when u focus on other things =)
thanks strazer
Yeah, yeah, It happens. A lot.

SMF spam blocked by CleanTalk