Messages and item states

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Messages and item states

Post by Joramun »

How do you make an item start "inactivated" like a teleporter not teleporting until you activate it, or even having a particular state where it calls the teleport function only when it recieves the M_ACTIVATE message ?

- I would gladly have to new messages : M_ENABLE, and M_DISABLE.
A disabled object would respond ONLY to the M_ENABLE message, by becoming enabled. It would otherwise : block dsb_message_chain (except the M_ENABLE message, maybe), be invisible in the dungeon, and overall considered as non existent in the game.
An enabled object, is just a normal object.
If you think that's there an existing way of doing what i imply, please explain !
What Is Your Quest ?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

:arrow: Relaying messages :
make dsb_msg_chain(id, target) work
in a different way :

Code: Select all

when (id) receives a message (M) :
 if (id.msg) equals (nil) then
  relay (M) to (target)
 else
  relay (id.msg) to (target)
Then to make basic relay I just need a dummy item called "relay" that has a msg exvar.

:arrow: The other solution is making a relay item that automatically chains its message toward all of his targets when activated.
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Messages and item states

Post by Sophia »

Joramund wrote:How do you make an item start "inactivated"
Calling dsb_disable() on the instance as soon as it's spawned should do it, right?
Joramund wrote:If you think that's there an existing way of doing what i imply, please explain !
I don't really understand what you want, here.
However, maybe it's not needed any more. Look at 0.10, I added "x_relay" and "x_counter" types that should do what is needed for RTSB. (The x_ is because they're for emulation and I don't know how much use they'd be in from-scratch DSB dungeons)
Joramund wrote:make dsb_msg_chain(id, target) work in a different way
This is an interesting idea, but I'm a bit against it because that requires checking the "msg" exvar. Right now a msg chain is handled by the engine and is "blind"-- it will work regardless of exvars or anything else, in case the designer is ambitious and has created a totally new (and weird) messaging system.
So, I think "x_relay" should do for now.
But please let me know if you have any more questions/problems. :)
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Re: Messages and item states

Post by Joramun »

Sophia wrote:
Joramund wrote:How do you make an item start "inactivated"
Calling dsb_disable() on the instance as soon as it's spawned should do it, right?
Sophia wrote:
Joramund wrote:If you think that's there an existing way of doing what i imply, please explain !
I don't really understand what you want, here.
The confusion comes from the fact that I thought of a "deactivated" item as an item in its alternate state, while "disabled" meant invisible in the dungeon. But since there is no such difference in dsb, my idea was pointless. Sorry :oops:
Sophia wrote:However, maybe it's not needed any more. Look at 0.10, I added "x_relay" and "x_counter" types that should do what is needed for RTSB. (The x_ is because they're for emulation and I don't know how much use they'd be in from-scratch DSB dungeons)
That rocks. I should be able to release RTSB and the DM dungeon really soon !
What Is Your Quest ?
Post Reply