LucasSchachtMusic
Member
Hey guys!
It's me again with another noob question
I'm going to explain you what exactly I'm looking for first.
Here I have a picture of a lot of buttons, to which I'd like to assign a string and two coordinates.
So rightclicking one of these buttons saves the last stored mouse coordinate of the main game room. For example it stores the location of a house. it saves it to for example coord_x, and coord_y. Also the player can input a string to for example name these coordinates "interesting place".
Then later, when I click this button, It displays the string and I can quickly jump to that room and certain point. For example it takes the player directly to that interesting place. Everything works, except saving it, because everytime I load the game, the variables will be declared as "coord_x = 0; cooord_y = 0;" to prevent the undeclared variable error.
Okay so I thought of storing it in a DS Grid or an ini file...
Thing is: I'm absolutely not used to ds grids or maps etc, and I thought of giving each button an own ini file (which doesnt seem like the right solution). Can I for example store the button ID as section in the ini file? or are the button object ID's different everytime i open the game?
Would it be possible to do it like this:
1. open ini
2. write ini -> section: object id, coord x, coord y, string
3. ini close
?
or similar?
I'm pretty unexperienced with ini files, so I'd need an explanation for dummies here. Please try to give practical code examples, cause i really want to undestand it.
Maybe some of you followed my post about saving a sprite to an ini file which the user uploaded. Well that was a little bit more complicated, I didn't really get it to work and I'd like to store these coordinates for now!
So thanks for any help in advance!! )
EDIT:
I already have another object similar to these.
A text object. But it's called by another instance and everything works there, even though i am declaring the variable 'text' as an empty string in the create event...
1. I'm choosing an object in my room, to which I assign the text.
2. the object id is stored in a global variable (global.last_object)
3. global.last_object.text = get_string("","");
then when i save and load the game, the text is still there, even though the create event of the objects says: var text; text = "";
Do I maybe have to make my other buttons persistent or so?
EDIT #2:
Making them persistent seems to solve my problem...
Yes I could have tried it before asking, but I'm interested in my "questions" anyway.
It's me again with another noob question
I'm going to explain you what exactly I'm looking for first.
Here I have a picture of a lot of buttons, to which I'd like to assign a string and two coordinates.
So rightclicking one of these buttons saves the last stored mouse coordinate of the main game room. For example it stores the location of a house. it saves it to for example coord_x, and coord_y. Also the player can input a string to for example name these coordinates "interesting place".
Then later, when I click this button, It displays the string and I can quickly jump to that room and certain point. For example it takes the player directly to that interesting place. Everything works, except saving it, because everytime I load the game, the variables will be declared as "coord_x = 0; cooord_y = 0;" to prevent the undeclared variable error.
Okay so I thought of storing it in a DS Grid or an ini file...
Thing is: I'm absolutely not used to ds grids or maps etc, and I thought of giving each button an own ini file (which doesnt seem like the right solution). Can I for example store the button ID as section in the ini file? or are the button object ID's different everytime i open the game?
Would it be possible to do it like this:
1. open ini
2. write ini -> section: object id, coord x, coord y, string
3. ini close
?
or similar?
I'm pretty unexperienced with ini files, so I'd need an explanation for dummies here. Please try to give practical code examples, cause i really want to undestand it.
Maybe some of you followed my post about saving a sprite to an ini file which the user uploaded. Well that was a little bit more complicated, I didn't really get it to work and I'd like to store these coordinates for now!
So thanks for any help in advance!! )
EDIT:
I already have another object similar to these.
A text object. But it's called by another instance and everything works there, even though i am declaring the variable 'text' as an empty string in the create event...
1. I'm choosing an object in my room, to which I assign the text.
2. the object id is stored in a global variable (global.last_object)
3. global.last_object.text = get_string("","");
then when i save and load the game, the text is still there, even though the create event of the objects says: var text; text = "";
Do I maybe have to make my other buttons persistent or so?
EDIT #2:
Making them persistent seems to solve my problem...
Yes I could have tried it before asking, but I'm interested in my "questions" anyway.
Last edited: