Flag Limits

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

Nixon
Ordinery
Posts: 48
Joined: Sat Dec 16, 2006 10:41 am

Post by Nixon »

This method uses two counters, you could probably do it with one but it would be a bit more painful. This is good for items, when a little delay is not a problem. You can use ammo, gems and torches all at once for this, I would imagine. It works by using number 0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16348 and 32768 (I didn't use all them in the example cause I'm lazy) Each number is like an object, and you plus them together when you have several, think binary. So that will get you 16 flags per counter, and if you have to use a counter for some of the storing temporary stuff, that means you can use 3 counters which is 48, plus the ten normal flags, that gives you 58 flags.

Heres a link to my example www.geocities.com/sitenixon/FLAGS.zip

it takes a bit of code to get rid of an object, but theres probably some smarter way of doing then how I did. Good luck.
User avatar
Dr. Dos
OH YES! USE VINE WHIP! <3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Zandor 12 wrote:Drinking-Way-Too-Much-Water...osis
And then you win a Wii for your children.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

Nixon wrote:0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16348 and 32768.
won't that mean I'll have 32768 instances of a flag indexed under 1? I mean I know how it's supposed to work, and I think it's in an encylopedia, but I could never figure it out. I'd download the example but I'm at a library.
*POW* *CLANK* *PING*
Nixon
Ordinery
Posts: 48
Joined: Sat Dec 16, 2006 10:41 am

Post by Nixon »

my mistake, it will only go up to 16348.

it works like this. Say you had an item that was number 4, that would give a score of 4. You run a check on all possible items by starting at 16348 and seeing if the score is equal or less than, if equal it subtracts the number, if it is smaller it moves to the next number. This happens till we get to 4, cause all the numbers before are too big, it takes the 4 and that makes zero, thus the number 4 has the item or whateva. So it looks like this

1 2 4 8 16 32 64 128 256 512 ....
0 0 1 0 0 0 0 0 0 0

Now if you had two numbers, say 2 and 16, that makes 18, so it would check back from 16348, get to 16 and subtract 16, leaving 2 and then the 2 would be subtracted once reaching 2. It would look like this

1 2 4 8 16 32 64 128 256 512 ....
0 1 0 0 1 0 0 0 0 0

I think it makes more sense looking at the code though, or if you know how to convert between binary and decimal.
gingermuffins
Posts: 371
Joined: Fri Sep 01, 2006 1:30 am

Post by gingermuffins »

I used to do something similar to that in klik n play because only eight counters would keep their values between screen changes (screens reset when you leave them.) It was easier though, because it could return the remainder of a division.


YOU FOUND MAH SECRET TEXT LOL
(ranting about old GCS's below)

KNP is sort of like an older version of Game Maker. It's been succeeded by Multimedia Fusion, which I guess is competing with Game Maker (I don't really know) but I don't like the direction they took their programs in so I don't use it anymore.

I made a lot of awful games on Klik n Play which were all lost years ago. It runs terribly on winXP now so I guess that's irrelevant. There were a few good ones though, Destruction Carnival, Cerebus, and some point-and-click adventure game where you're a young fox that has to chop down a tree for your neighbour. It had like three endings, and in one of them you chop down a tree from the neighbour's front lawn and you get in TROUBLE ok i'm done ranting
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

Here's a couple of modifications of the counter-based thirst engine:

http://zzt.org/quantum/temp/watereng.zip

It's not much: just an example of how you might implement level-of-thirst messages with a counter-based engine. Glad to hear that you're resolving some of the flag issues - in my opinion, removing unnecessary flags is better than adding virtual ones with a potentially complex engine.

With that said, I've been playing around with Nixon's idea, and I'm now quite interested in the challenge of writing potentially complex engines that allow for extra "flags"! Don't know if I'll come up with anything interesting, but it'll entertain me for the next few days.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

zzt entertaining?! who could have guessed?!
*POW* *CLANK* *PING*
Nixon
Ordinery
Posts: 48
Joined: Sat Dec 16, 2006 10:41 am

Post by Nixon »

Well how about we have a challenge to see who can have the most simultaneous "flags" possible at one time.
User avatar
thematrixeatsyou
‮Ouch.
Posts: 44
Joined: Wed Sep 06, 2006 8:50 am

Post by thematrixeatsyou »

And then there's the trick, which you have a temporary flag, and an object with a bunch of #ZAP-ped labels. Something like:

UNTESTED CODE ALERT! D:

Code: Select all

@flags
#cycle 1
#end
'get01
#set has
:get01
'set01
:clear01
#end
:set01
#restore set01
#restore get01
#zap clear01
#end
:clear01
#zap set01
#zap get01
#restore clear01
#end

'get02
#set has
:get02
'set02
:clear02
#end
:set02
#restore set02
#restore get02
#zap clear02
#end
:clear02
#zap set02
#zap get02
#restore clear02
#end

Code: Select all

#end
:touch
!s1;Set flag 1
!s2;Set flag 2
!c1;Clear flag 1
!c2;Clear flag 2
!t;Test flags
#end
:s1
#flags:set01
#end
:s2
#flags:set02
#end
:c1
#flags:clear01
#end
:c2
#flags:clear02
#end
:t
#clear has
#cycle 2
#flags:get01
/i
#if has fs1
Flag 1 is CLEARED.
#tr1
:fs1
Flag 1 is SET.
#clear has
:tr1
/i/i/i/i/i/i/i
#flags:get02
/i
#if has fs2
Flag 2 is CLEARED.
#tr2
:fs2
Flag 2 is SET.
#clear has
:tr2
This should be fairly expandable, but only works per-board.
AKA GreaseMonkey. This is my old nick.
Unless someone sneakily changes it while I'm not looking.
Oh well.

Playing around with timing hacks.
Post Reply