Page 1 of 2
Flag Limits
Posted: Fri Mar 30, 2007 10:20 am
by DarthJesus
Is there any editor or version of ZZT that will lift the flag limit? I'm sure this has been asked before but my searches were fruitless. This flag limit is completely ruining my game idea. :-(
Posted: Fri Mar 30, 2007 11:11 am
by nps
Nope! You're just going to have to be creative with your flags!
Posted: Fri Mar 30, 2007 3:53 pm
by Quantum P.
You cannot have more than 10 flags, but with some clever programming, you can often avoid hitting this limit! For example, you can combine flags (e.g., instead of #set red and #set blue, you #set redblue) - this gives near-infinite "flags" in theory, but code gets messier the more you have.
What's your game idea? There's a bunch of methods for cutting back on flags, and some of them may be more suited to what you're trying to do.
Posted: Fri Mar 30, 2007 6:07 pm
by gingermuffins
how long can the name of a flag be?
Posted: Fri Mar 30, 2007 6:46 pm
by Quantum P.
Only the first 20 characters of a flag matter. For example, the following code will loop:
Code: Select all
#set abcdefghijklmnopqrstuvwxyz
:loop
/i#char 1
/i#char 2
#if abcdefghijklmnopqrst loop
There are 26 letters in the alphabet, and T is the 20th letter.
Posted: Fri Mar 30, 2007 7:11 pm
by DarthJesus
My game idea is a scenario where you are stranded on a desert island. I have a good chunk of the game already made.
I don't know how creative I can get with the flags, because my inventory system hogs a good portion, if not all of them. In addition to that, I have at least one or two flags tracking how thirsty you are in long cycles. Also, god forbid, should you start bleeding, I have a few flags checking the severity of that too.
I guess it's just too ambitious for ZZT :( If anyone is interested, I could post what I have thus far and you could take a look, but i'm starting to think it's a lost cause.
Posted: Fri Mar 30, 2007 7:15 pm
by Dr. Dos
Are you using all your counters?
Thirst, bleeding level, and i are 3 flags. You could make an item storage box if you wanted to as long as you didn't actually need to carry a dozen items.
Well 4 flags since you'd need to keep track of the # of items you were carrying to make sure you don't go over the limit.
Posted: Fri Mar 30, 2007 7:49 pm
by DarthJesus
I'm not sure what you mean by counters. Do you mean gems, keys, etc?
My thirst code is something like this, cant remember exactly
Code: Select all
@Thirst
#End
:check
#Cycle 255
#IF not thirst Begin1
#IF thirst A
#check
#End
:A
#Clear thirst
#Begin1
#End
:Begin1
#If Not level1 set level1
#Begin2
#end
:Begin2
#If Thirst Check
#If Level1 Level1
#If level2 level2
#If level3 Level3
#check
:Level1
You are getting a bit thirsty
#Clear level1
#Set level2
#Begin2
#end
:Level2
You are getting very thirsty
#Clear level2
#Set level3
#Begin2
#End
etc, etc. So by this method i'm only setting one flag at a time. The bleeding routine is similar to this. I think my only solution, unfortunately, is to reduce the number of items you can find and use. In my original idea, the player could pick up items around the island and combine them to form weapons, tools, etc, but there are just too many, even when some of them are expended on a regular basis.
P.S: The thirst flag is set when the player drinks from a fresh water source, thus restarting the cycle o' thirst (patent pending)
I have my thirst, bloodloss, and inventory objects stored in a library, but I have no web hostin to upload it to. My inventory code works, but it's long and a bit convoluted. Also I never use comments :D
EDIT: Also, while we are on the subject of limits, what is the maximum world size? I'm up to about 64k thus far.
Posted: Fri Mar 30, 2007 10:19 pm
by Commodore
There are games as large as 300k but in my experience the files tend to get unstable around 250k. When it starts getting larger than 200 make a lot of backups.
Also yes they are talking about using gems and torches as counters.
Thirst would be easy this way, just have an object on every board #take from a counter every so often and if it can't you don't have water and start #taking health. Blood loss I'd stick with using flags, it would give you more control, but if you eliminate flags for thirst you've freed up some for other things.
You can also eliminate flags you know will always be set. For example if you are making an area and know that to get to that area you need certain items, you can hard code your inventory object to not even check for flags and just say you have the item.
Also what quantum said about combining flags is apt.
#Set rope
#if rope #if hook #do
#end
:do
#clear rope
#clear hook
#set ropehook
Posted: Fri Mar 30, 2007 10:40 pm
by Nixon
Well I think I have a way to allow you to have 58 flags at one time, for that many though the programming is a little tricky. I'll post up the program within the next day. I have made it possible to recognise all the flags, I just have to make the getting rid of the flag work.
edit: I can get rid of them but I don't have time to finish it.
Posted: Fri Mar 30, 2007 11:48 pm
by DarthJesus
Yes, please do share, im interested in what you have to show.
Also, using counters to track thirst would lend itself to certain abuses in the current model I have. In the game's current state, you can find fresh water sources in the form of streams that you can repeadetly drink from (the stream itself is a bunch of 'invisible' blue objects). That sets the thirst flag and starts the cycle over again. If it were a counter, you could drink and drink and drink until your 'thirst' is sky high and never have to worry about it again. Unless of course theres a way to check the counter for a certain value, but somehow I doubt it.
I should be doing this in Game Maker or something :D But i'm a sucker for ascii games. Leaves so much more to the imagination, ya know?
Posted: Sat Mar 31, 2007 12:04 am
by gingermuffins
Unless of course theres a way to check the counter for a certain value, but somehow I doubt it.
when subtracting from a counter, if there isn't enough there, you can redirect to a label without doing anything to the counter.
redirects to the label :toopoor
Code: Select all
@water
#end
:touch
#take gems 100 drink
#give gems 100
You're full of water.
#end
:drink
#give gems 10
You drink some water.
Posted: Sat Mar 31, 2007 12:07 am
by Zandor 12
It wouldn't be too hard to check your thirst counter for a certain value.
You could have an object on most boards that repeatedly tries to #take a huge amount of torches or gems or whatever you would use for the thirst counter; if the #take fails then nothing interesting happens and the object restarts, but if it successfully #takes the 255/499/999 torches/gems/score/whatever then your character dies from Drinking-Way-Too-Much-Water...osis or what have you. This should keep your character from having a thirst higher than or equal to whatever you're #taking.
Whatever you do, don't try to piggyback too many flags together. I had a flag in my game that tried to piggyback four flags together, and that's part of why the game still isn't out. Combining two flags is easy to do, but trying to go beyond that is a huge pain.
ARG G'BAR I was beaten to the punch by a better solution that doesn't require putting an object on every board. Listen to Gingermuffin, he knows things.
Posted: Sat Mar 31, 2007 12:56 am
by Quantum P.
It's nice to see such a good response to a programming question. Keep it up!
I've got a couple of ideas that I hope wouldn't make the code too difficult to write, but they're a bit hard to explain. I'll see if I can throw together an example.
Posted: Sat Mar 31, 2007 1:59 am
by DarthJesus
I implement gingermuffin's system. It works good. It doesn't have the same immersion value that my system does (no messages indicating level of thirst.. I.E, "You are DYING OF THIRST!!", but it saves a flag, and I don't use gems in this game any ways. Thanks gingermuffin!
Apparantly the bulk of my flags are being used on pick-up-able items. I've imposed an item limit, and made it un-neccesary to even pick up other items. For example, you can whittle a branch into a spear with your knife. Now the branch doesn't have to be in your inventory, just do it while it's on the ground.
Thanks again for the input, this thread has been very imformative. I'll let you know how my progress goes.