What's wrong with my code?

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

Moderators: Commodore, Zenith Nadir

FYNDR
Prepare for your utter dancification!
Posts: 61
Joined: Tue Jan 10, 2006 11:01 pm
Location: Still at large

What's wrong with my code?

Post by FYNDR »

For the final fight in my upcoming game Myseri, you sword fight this evil shadow wizard. The way it is supposed to work, if you are in contact with him for more than a few moments, you are stabbed and you die. However, if you touch him before then, it says CLANG! on the screen and your opponent sort of steps back before making another pass. Now, if you touch him on any side that isn't the front (i.e. from any place other than the direction he is going), it kills him. For whatever reason, it doesn't work this way:
@Dethcloak
/i/i/i/i
#send battle
#end
:battle
#cycle 1
#go seek
#if contact then flap
#send battle
#end
:flap
/i/i
#if contact then kill
#send flee
#end
:kill
#endgame
#end
:flee
#go opp seek
#go opp seek
#go opp seek
#if contact then flee
#send battle
#end
:touch
#if not blocked flow then win
Clang!
/i/i
#send flee
#end
:win
#die
#end
The coding is fairly simple, as you can see. I think the problem lies in the
#if not blocked flow then win statement because he isn't actually moving in any direction when he is in contact with you. Therefore, he cannot be
killed. Can anyone come up with any alternate coding for this that I've not thought of? Thanks.

~FYNDR
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

flow, i think, works only if you use #walk to move. I think that last #if statement is always going to be false because you're not using #walk.
*POW* *CLANK* *PING*
FYNDR
Prepare for your utter dancification!
Posts: 61
Joined: Tue Jan 10, 2006 11:01 pm
Location: Still at large

Post by FYNDR »

Yes, that was what I suspected... any ideas as to how to go about fixing it? I like having the idles in there so that you have time to dodge his attacks if need be, but perhaps there's another way?

~FYNDR
User avatar
Ellypses
Whaf yew vauhnt?
Posts: 145
Joined: Tue Aug 24, 2004 2:14 pm
Location: In hell called earth
Contact:

Post by Ellypses »

Code: Select all

@Dethcloak
/i/i/i/i#send battle
 
:battle
#cycle 1
#walk seek
/i#if contact then flap
#send battle
 
:flap
#walk idle
/i/i#if contact then kill
#send flee
#end
:kill
#endgame
 
:flee
/opp seek/opp seek/opp seek
#if contact then flee
#send battle
 
:touch
#if not blocked flow then win
Clang!
/i/i#send flee
 
:win
#die
It would be cool if you have that mean ass vain slicing samurai thingy when you win an engagement. 3 boulders opp seek, turn boulder to red fake, /i/i#die or whatever.
MadTom
<:D
Posts: 886
Joined: Fri May 13, 2005 6:37 am

Post by MadTom »

#send is redundant, just use #battle, #flap, etc.
FYNDR
Prepare for your utter dancification!
Posts: 61
Joined: Tue Jan 10, 2006 11:01 pm
Location: Still at large

Post by FYNDR »

Jur: Thanks! Now it works superfine, though it's a little easy to kill him. I'll just tweak it up a bit and see what I can do about the samurai blood thing.

Tomsacold: My middle name is Redundancy. Actually, it's Glenn.

~FYNDR
User avatar
Dr. Dos
OH YES! USE VINE WHIP! &lt;3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Madtom it's just a style.

Everybody has habits in their code. A lot of times i'll have something like

:loop
blah blah
#loop
#end
:touch
blah blah blah
#loop
#end

Even though both ends aren't needed.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
MadTom
<:D
Posts: 886
Joined: Fri May 13, 2005 6:37 am

Post by MadTom »

Yeah, that's true, I formed it as a habit early on when I was looking for ways to minimise memory usage in code. The 20,000 byte limit on boards was always really easy to break for me.

I suppose you could argue it's a tidier way of presenting the code, for one thing.
User avatar
Alexis Janson
wacky morning DJ
Posts: 307
Joined: Fri Feb 20, 2004 1:05 am

Post by Alexis Janson »

Tomsacold wrote:Yeah, that's true, I formed it as a habit early on when I was looking for ways to minimise memory usage in code. The 20,000 byte limit on boards was always really easy to break for me.

I suppose you could argue it's a tidier way of presenting the code, for one thing.
What good is tidy code in a GODLESS UNIVERSE?

That's right, I went there!
User avatar
mania-[ker]
Im Zamros
Posts: 202
Joined: Sat Mar 25, 2006 9:54 pm

Post by mania-[ker] »

Flimsy Parkins wrote:
Tomsacold wrote:Yeah, that's true, I formed it as a habit early on when I was looking for ways to minimise memory usage in code. The 20,000 byte limit on boards was always really easy to break for me.

I suppose you could argue it's a tidier way of presenting the code, for one thing.
What good is tidy code in a GODLESS UNIVERSE?

That's right, I went there!

well, assuming god doesn't exist, then yes, tidy code as we know it is a largely futile exercise. if god does exist, then he obviously would want us to be happy, or at least for him to be happy. it has been revealed several times that god is a pretty organized guy; he got pissed when adam and eve messed up his cool tree of knowledge, and every church or synagogue i've ever been is a pretty tidy place. so, it can be confirmed that if god exists, he would want tidy code, and if god doesn't exist, then tidy code is a mere creature comfort for our own good, and it doesn't matter either way.
now, there are two ways we can look at the situation: with god, and without god. if we have no way of proving that god is really there short of dying, it would make sense to have tidy code even in a godless universe. if god doesn't exist, we have tidy code to make ourselves happy, and if god does exist, we have tidy code not only to make ourselves happy, but to win favor with god. tidy code, god or not, will ensure us that upon our deaths we are comfortable knowing that if indeed there is a god then we are in his good light, and if there is no god, we at least pleased ourselves.
Image
FYNDR
Prepare for your utter dancification!
Posts: 61
Joined: Tue Jan 10, 2006 11:01 pm
Location: Still at large

Post by FYNDR »

...or maybe I just do it like that because that's how I learned it from the ZZT Editor Help and I lust for structure in all things?

Answer: Mmmmmm...... structure.....

~FYNDR
MadTom
<:D
Posts: 886
Joined: Fri May 13, 2005 6:37 am

Post by MadTom »

FYNDR: I made this guide to saving memory a while ago here: http://zzt.org/?p=gtsm

It's a bunch of ways to code more efficiently, along with some old tricks. I don't think it's been of much use to anyone but myself so far, but take a looksee anyhow
User avatar
Dr. Dos
OH YES! USE VINE WHIP! &lt;3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

don't try to salvage the user articles page.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
MadTom
<:D
Posts: 886
Joined: Fri May 13, 2005 6:37 am

Post by MadTom »

that's funny coming from the ONLY OTHER GUY WHO WROTE ONE

Yeah, I know it's dead! But the forums are basically the only part of the site that isn't, nowadays.
Ando
2SEXY4U
2SEXY4U
Posts: 810
Joined: Sat Sep 04, 2004 1:08 am
Location: Oak Harbor, WA
Contact:

Post by Ando »

Tomsacold wrote:But the forums are basically the only part of the site that isn't, nowadays.
That's sort of an exageration.
Post Reply