Garrulous Glaahk Yellow Sub Posted July 28, 2004 Share Posted July 28, 2004 Since flags can get confusing, here is a failsafe use for some flags that are used only in the current town. Step One: Define variables equal to the number of flags you plan to use. Step Two: In INIT_STATE, use get_flag for the flags to reuse and have a variable equal that flag. i = get_flag(2,5); or something like that. Step Three: also in INIT_STATE, AFTER the variables of the respective flag's values, clear the flags to zero. set_flag(2,5,0); Step Four: In EXIT_STATE, have the variables set the flag back again. set_flag(2,5,i); And poof! The flags are reuseable. Once done with in the current town, and exited, then they are reset back again. Best applies to two or more story dungeons, since Variables are cleared upon traverse up and down. I have not worked on outdoor scripts much, but I am pretty sure the same thing can apply to a single or a section of outdoors. Be sure the right variable is put in the right flag. Example for use: You have a two story cave. You want something the player does in the upper affect the lower and stuff in lower affect upper. You have switches, and in your mind, they are numbered. You can recall the switches by using flags 0,1 0,2 etc for switches numbered that. Use the above method to failsafe it. It might be useless, but hey. It's still a fun thing to try. EDIT: The flags, that way, will reset when the player renters the part of the dungeon that has INIT_STATE. So for the INIT_STATE of only the first part, set a flag beginining with the town number (9) for example that is Town Number,0. like 9,0. Have it equal one after all the flag storing and flag clearing is done. And make an if statement so all that flag clearing crap ONLY happens when 9,0 == 0. And the flag will only go back to 0 on exit state, so add that chunk of code .... set_flag(9,0,0) .... 9 = town number... .... for exit state. That means the flags wont rest again until after they are restored on EXIT_STATE. Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted July 28, 2004 Share Posted July 28, 2004 Wow. Yeah, either that, or take notes like a normal person. I don't know if the BoA docs recommended this (I don't think they did), but the BoE docs recommended using flags whose x-coordinates agreed with your town number -- ie using flags (0,0), (0,1), (0,2), ... , (0,29) in town 0, flags (1,0), (1,1), ... , (1,29) in town 1, etc. Then just take notes on what your flags mean. It's not like you'll ever run out. I don't know why you would want to reuse them. That sounds far too dangerous. EDIT: Reading your method a bit further, I have no idea why you're messing around with variables. Just set the flags directly, and it should have the same effect. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Fort Posted July 28, 2004 Share Posted July 28, 2004 So, what you are saying is that you want to document the previous value of a flag when you enter a town in which you want to reuse certain flags, and then it is reset when exited. For all practical purposes, the flag's scope will only be inside the town. You should remember that there is a limit to how many variables you can declare in a single script, but this could be useful for those who like to have multipurposes for flags. Warn players about forcefully leaving the town with the editor. EDIT: Now for my personal opinion: I do not think that this is a good idea. You have up to 30 flags for each town number + outdoor sections. Mind you that you can have 100 outdoor sections, and even the largest scenarios didn't have that many, though the flags will still be there. I like running the extra flags in town over to the flags for outdoor sections that don't exist. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast *i Posted July 28, 2004 Share Posted July 28, 2004 Flags act as permanent, global, predefined variables, at least for the duration of the scenarios. This strategy seems unnecessary and really confusing. Just keep notes on existing flags and you should be fine. Link to comment Share on other sites More sharing options...
Curious Artila void*_dup1 Posted July 28, 2004 Share Posted July 28, 2004 I had objected that town variables are not stored in savefiles but, as keep has noted below and I have just checked, they ARE saved. Please ignore this post Link to comment Share on other sites More sharing options...
Well-Actually War Trall Fort Posted July 28, 2004 Share Posted July 28, 2004 Variables are saved, don't worry about that one too much. Link to comment Share on other sites More sharing options...
Recommended Posts