Loading variables
#1
Posted 03 June 2012 - 07:02 PM
#2
Posted 03 June 2012 - 07:06 PM
I'm trying to load variables from one object in a room to another object in another room. Any ideas?
Well you can make the object persistent so it will be on the other room with the same variables
#3
Posted 03 June 2012 - 07:15 PM
Example: I click on a button to change a sprite in the next room, but it doesn't change it. This is somewhat my problem
#4
Posted 03 June 2012 - 07:33 PM
The problem is that the first object isn't meant to be on the next room.
Example: I click on a button to change a sprite in the next room, but it doesn't change it. This is somewhat my problem
Oh, then use Global Variables, example:
global.sprite=spr_this;
#5
Posted 03 June 2012 - 07:46 PM
This is what I got:
globalvar char;
Then I set the button to:
char = 14;
In the object I want after for the next room, I still dunno how to do with global variables. Just seems too weird :S
#6
Posted 03 June 2012 - 07:50 PM
Still, there's a problem. I first used a script to define a global variable.
This is what I got:
globalvar char;
Then I set the button to:
char = 14;
In the object I want after for the next room, I still dunno how to do with global variables. Just seems too weird :S
I think "globalvar" makes the variable temporary for that room only i think, use global.char = 14;
Edited by Debels, 03 June 2012 - 07:51 PM.
#7
Posted 03 June 2012 - 07:55 PM
#8
Posted 03 June 2012 - 08:08 PM
Unlike globalvar or var, 'global.' can't be defined anywhere else.
Once you defined it there you can use it anywhere else.
Edited by Jlm07, 03 June 2012 - 08:09 PM.
#9
Posted 03 June 2012 - 08:13 PM
global.anything = 1
#10
Posted 03 June 2012 - 08:26 PM
Use a global variable.
global.anything = 1
Thats what we said.........
#11
Posted 03 June 2012 - 08:47 PM
Actually, global variables can be defined anywhere (except maybe not in scripts... not sure) as long as they are defined before being used. It's best to just define them in the create event though, since it's more organized.Define it in the Create Event.
Unlike globalvar or var, 'global.' can't be defined anywhere else.
Once you defined it there you can use it anywhere else.
#12
Posted 03 June 2012 - 08:49 PM
I think "globalvar" makes the variable temporary for that room only i think, use global.char = 14;
Nope, it doesn't. It just means you don't have to write 'global.' everytime you are in your code.
#13
Posted 03 June 2012 - 08:54 PM
I think "globalvar" makes the variable temporary for that room only i think, use global.char = 14;
Nope, it doesn't. It just means you don't have to write 'global.' everytime you are in your code.
Oh, Thanks for removing that doubt of my head
#14
Posted 04 June 2012 - 12:01 PM
Try creating a sprite-less object, set the global variable, and then making it persistent.
#15
Posted 04 June 2012 - 01:25 PM
Show us the code/object information, please.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











