Announcement: Remember: you are giving away your fantastic ideas for free, and somebody else might even make money from them (or appear to). That's just how the world works! If you're worried about it, maybe you shouldn't post your ideas here.


Caravel Forum : DROD Boards : Feature Requests : Special Labels (especially "On Death")
New Topic New Poll Post Reply
Poster Message
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1530
Registered: 06-13-2015
IP: Logged
icon Special Labels (+3)  
I was fairly sure that a request for something like this exists, but my feeble thread-searching skills couldn't locate anything specific, so here it is. This is a request for some special labels in DROD script, comparable to the ones in RPG's scripting. Obviously the needs of DROD are distinct from those of RPG, but I think there are still some situations where you'd want a character to react to a situation in a way that interrupts its normal behavior loop.

On Death: The most important one to me personally. Anything that kills the entity, be it stabbing, burning, dropping into a pit or water, attack tile kill, blowing up...whatever, immediately jumps execution of the character's script to this label. This is basically necessary to make things like custom golems, constructs, fegundos, or anything else that's supposed to do something special when it "dies". And let me be perfectly clear on this as someone who has tried and semi-succeeded at doing this before: Currently existing workarounds are inadequate to this purpose. They require way too much overhead and work on the architect's part in a manner which heavily discourages the re-use of anything that attempts to function this way. They are very prone to weird bugs based on move order problems that one just plain shouldn't have to worry about.

On [Event]: A lesser request. For a number of room events like tarstuff growth, briar growth, eyes waking up, and so on, it'd probably be cool to have designated labels for an automatic interrupt that's triggered by those events.

Token: I think this has been requested elsewhere and something like it is possible mid-implementation, but I might as well say it just for the record. The concept in my head for this label is that the label either includes coordinates (which is more flexible) or refers to the location of the character, and jumps to this label whenever something that would've activated a token happens to the relevant location. That includes player/double stepping on the tile, "activate item at" from another script elsewhere, scripted entities and the like that can activate tokens. Fairly simple.

On Explosion/fuse: A nice label that would be helpful for "custom bombs", which amounts to just a way to detect that the tile it's on either had a lit fuse burn out on it (the way it does under a powder keg) or an explosion happen to it. Similar to the above, it could designate a tile, or possibly just check the tile under the character who's running it. I'm less confident that this needs to be a custom label rather than a wait for that could go inside of an if statement, but as long as I'm naming things I may as well include it. Actually, that also applies to the "Token" part too now that I think of it.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 11-10-2020 04:56 AM]
11-10-2020 at 04:52 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Special Labels (+1)  
I've been thinking about "On Death" label for a while now, and here is my proposed solution:

1. A new command Run label ... on ..., which will allow you to select a label to run and a list of situations where it runs. For now let's assume there is only one case - "my death", and let's talk about it specifically.
2. This would run the given label whenever this monster was killed.
3. The label would run in a separate context, meaning that if the monster survives it would not affect what command should run next when the character is processed, nor the stack of GoSubs.
4. The label would end with the command Return being called, when there are no more GoSubs to return from (or any other case when the script ends on its own).
5. The only way to avoid the monster dying would be to make it Disappear.

A lot of things can go wrong:

1. Recursion: character dying can try to kill another character which will trigger another label processing. There will have to be some upper limit on the number of nested kills done that way for sanity purposes.
2. Killing the killing entity (as in, whoever killed the entity that has its label running) can't be allowed directly (Attack tile) or indirectly (Building a pit).
3. Existing script handling code would have to be adapted to avoid those labels accidentally breaking something or not triggering.


Alternatively, something that will just automagically work:
1. When a character is killed but has "My Death" registered, they will disappear instead, and their reaction will be processed as soon as the killer turn finishes, before the next monster moves.
2. This would mean the responsibility of actually removing the character from the room would be on the architect.
3. This would also mean that there would be another pass at the end of room processing, to process the deaths of characters that happened after monsters finished moving - death by fire traps, floor spikes, explosions.

Okay, yep, I like the solution better. Actual interrupts would be hell of a mess with infinite edge cases, let's not go that way.

You may also ask "Skell why do you want the command to be Run label ... on ... rather than On ..." and the answer is... A bit less work to do, no need to preparse character's command list to locate all of those special labels. But I'll think about it.

As for the other suggestions:
- Token - token is indeed mentioned somewhere else so let's have one place to discuss it.
- On event/explosion/fuse - Many events in DROD have additional data attached to them and there should be a way to access it somehow. At the very least we could add "Wait for event ... at ...", at the very most we could add options to iterate through those datapoints and access their data. Either way those are separate from "On Death" and I don't plan to add actual interrupts.

____________________________
My website | Facebook | Twitter
11-10-2020 at 06:16 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1530
Registered: 06-13-2015
IP: Logged
icon Re: Special Labels (0)  
Hey, that solution sounds great to me! In situations similar to a custom fegundo/construct, presumably the architect can choose to have the character appearance change->reappear or something? Or if not, a generate entity->finish dying would be equally acceptable, I think.

EDIT (kind of a while later): I'm not really sure why I decided to lump more things into one thread when an "On Death" label was kind of the only thing I was really thinking about. I'd be extremely happy with a "wait for event at" to cover fuses, explosions and stuff as well, for the record.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 11-11-2020 05:41 AM]
11-10-2020 at 04:48 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Special Labels (0)  
I will be marking this thread as not a bug in favor of the proposal I extracted from my above post and put here.

____________________________
My website | Facebook | Twitter
11-24-2020 at 09:23 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Feature Requests : Special Labels (especially "On Death")
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.