Global Set on/off Suggestion

Started by MillsJROSS, Sun 04/05/2003 06:56:21

Previous topic - Next topic

MillsJROSS

I'm not sure if this is even implemented already. So many changes have been made, it's hard to keep track. Here's my suggestion/question:

Is there a way to lets say when something is done you have a one line global script command that set globalInt(#,1/0)       On/off
So then we could have a script that enables us, if something has been set on, to affect the whole game. Ex: You press a button (which would turn the global function on) and then whenever you enter a room that is affected by the button, it detects whether this function has been set on not, and then acts accordingly (such as turning on/off an object).

Now this might already be implemented, as said, but I was thinking today, that when I get my computer back together in a couple of days (as I am currently using my parents) what functions I could really make good use of with AQ2. This is just one of the ideas I had, because I usually find some backwoods way to get everything to work similar to that in the end.

-MillsJROSS

Pumaman

I'm not quite sure what you're asking. You could just set a global int, and then check it in the Player Enters Room script for that room and turn the object off/on.

cornjob

I'm also not really sure what you're asking... But if you want a function that checks whenever you enter any room, try the function "on_event". The manual explains how it works.

MillsJROSS

Well basically I'm asking, is there a way to put an on and off switch globally that affects the whole of the game. It deosn't necessarily apply to objects being on or off. If, for example, I did an action that affected other rooms and characters, You would turn the switch On, so to speak, so that the game recognizes you've done something. Then whatever you need to show what has been done detects the now on button and will do whatever you tell it to.

Ex. I kick a door that somehow affects all other aspects in the game.

I'm sure there is already someway in which to do what I am asking, I just don't know if it's been simplified.

-MillsJROSS

scotch

You do that with Global Ints, generally if it's just going to be an on/off thing you set the into to 0 for off and 1 for on.

GetGlobalInt(int number); gets the int.. so if you wanted to let the player go through the door if it's kicked in you test it with
if(GetGlobalInt(300);==1) {NewRoom 2 etc..} else {Display("The door blocks your way.")}

when the door is kicked in you would do SetGlobalInt(300,1);

You should write down somewhere what ints you're using for what events or it can get confusing.

That sounds like it would solve what you're asking.

If you wanted to make a whole function off when the int is off you could just put
if(GetGlobalInt(300)!=0) { rest of the function}

MillsJROSS

Thanks! It actually isn't a problem for me yet, I was just thinking about ways I could form a puzzle and was wondering if there was an easy way to go about using that idea.

-MillsJROSS

SMF spam blocked by CleanTalk