ZZT-OOP questions

Housing for low income families.

Moderators: nuero, Ando

Post Reply
User avatar
madhair60
newcomer
Posts: 5
Joined: Sun Sep 07, 2014 12:55 pm

ZZT-OOP questions

Post by madhair60 »

I've picked up a project from a good decade ago to work on again, and I'm running into a silly little ZZT-OOP issue. I'm sure it's an oversight on my part, but basically I have monsters that I've programmed to take, say, 5 health on contact, 20 health for the harder hitters. However, when the player's health falls below these numbers, the monster will not kill them. It'll hit them over and over again with no effect. Is there any way to remedy this?
Last edited by madhair60 on Mon Sep 08, 2014 8:43 am, edited 2 times in total.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP death-related question

Post by Commodore »

It could be you are taking too much.

Something like #take 20 health won't take health if the player only has 10

use this instead:

#take health 20 #endgame
*POW* *CLANK* *PING*
User avatar
madhair60
newcomer
Posts: 5
Joined: Sun Sep 07, 2014 12:55 pm

Re: ZZT-OOP death-related question

Post by madhair60 »

Brilliant, thanks.

I actually found a method -

#take health 20 kill
#end
:kill
You cannot withstand another blow.
You have died.
#endgame
#end

It checks if there is 20 health to take and if not, it skips to the "kill" command.
User avatar
madhair60
newcomer
Posts: 5
Joined: Sun Sep 07, 2014 12:55 pm

Re: ZZT-OOP death-related question

Post by madhair60 »

Oh no - neither ZZT nor Kevedit are loading my game for editing or playing anymore. It just causes an instant crash to desktop. DreamZZT says "cannot load".

Edit: I think I must have gone over 20k on a board and now my game won't load at all. Is it lost forever? :(

Edit 2: Ah, ZZTAE sheds light on things. I've gone over the 20k. Fixing now.

Edit 3: Gaaah, even getting it to 17k won't make it load in ZZT or Kevedit.

Edit 4 (Four!): OK, the problem is my title screen - it's corrupt and won't load even in ZZTAE. Anyone know a fix? I guess I could just export all the boards except that one.

Edit 5: Or not, 'cos ZZTAE doesn't seem to let you export boards. (!?!?)

Edit 6: Aaaaand FIXED! Turns out ZZTAE does have that function, it's just not "advertised". Hooray! My game lives!
User avatar
madhair60
newcomer
Posts: 5
Joined: Sun Sep 07, 2014 12:55 pm

Re: ZZT-OOP death-related question (Please help!)

Post by madhair60 »

Okay! One more question.

Is it possible to make every instance of an object on screen #die with one command?
User avatar
bitbot
Official Clamp School Defender
Posts: 328
Joined: Thu Mar 01, 2012 3:00 am
Location: earthbound
Contact:

Re: ZZT-OOP death-related question

Post by bitbot »

Hi madhair. Reviving an old game idea is best cause it ends up being chock full of nostalgia.

Forum tips: No need to update us on every edit unless someone replies or it's pertinent. Don't worry though, I fumble that up sometimes. :) If you change the name of this thread (by editing the first post's subject line) to something generic like ZZT-OOP questions, that will give you free reign and keep our forum tidy.
madhair60 wrote:neither ZZT nor Kevedit are loading my game for editing or playing anymore.
I recommend strictly using KevEdit for editing and ZZT for testing to avoid corruption.
madhair60 wrote: Is it possible to make every instance of an object on screen #die with one command?
@objecta
#all:death

@objects
#end
:death
#die
Image Image
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP death-related question (Please help!)

Post by Commodore »

Some useful tips involve using kevedit to set the cycle instead of using #cycle 1. Also your problem sounds a little like you renamed the zzt file in windows instead of saving a new world. This breaks files.

Some code thinning techniques:
create labels with as few letters as possible.
if an object uses a lot of #end commands (or restart commands) instead create a 1 letter label

Code: Select all

@object
:r

;a bunch of code

:e
#end
Even kevedit can break your world. Save multiple copies. I usually uses three different files, often I save the working files as 1world.zzt, 11world.zzt to make the names float to the top of the list.

Not sure why a 17k board broke your world. Maybe there is a smaller restriction on title screens.
*POW* *CLANK* *PING*
User avatar
bitbot
Official Clamp School Defender
Posts: 328
Joined: Thu Mar 01, 2012 3:00 am
Location: earthbound
Contact:

Re: ZZT-OOP death-related question (Please help!)

Post by bitbot »

Commodore wrote: Even kevedit can break your world. Save multiple copies. I usually uses three different files, often I save the working files as 1world.zzt, 11world.zzt to make the names float to the top of the list.
Nice approach. I used to backup like a maniac before KevEdit earned my trust, but sure enough a file got corrupted just the other day. Three copies sounds about right.. two current and one legacy.
Image Image
User avatar
madhair60
newcomer
Posts: 5
Joined: Sun Sep 07, 2014 12:55 pm

Re: ZZT-OOP questions

Post by madhair60 »

Yeah, sorry about the flurry of edits; that was "the process", me figuring out a fix, trying everything. Tidied it up; cheers.

Thanks for all the advice. I found a really rudimentary way to do the "clear all objects" thing, but now I have a better one. :)
Commodore wrote:Not sure why a 17k board broke your world. Maybe there is a smaller restriction on title screens.
The board was originally well over 20k. I had a load of spider-web objects, all of which recycled the same code instead of using #bind. I'm very rusty after a long while without using the program.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP questions

Post by Commodore »

You could also use #change object empty, but not if you want some of the objects to survive!
*POW* *CLANK* *PING*
Post Reply