Does DSB has object "lifetime" like RTC?

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.
Post Reply
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Does DSB has object "lifetime" like RTC?

Post by Qwerty »

As a subject, RTC can add "lifetime" to new object that item is disappeared or be executed action when its lifetime is expired. I made a code that magical item appears when you cast specify magic, and disappears when spell duration is expired.

Here are two different sample codes.(Behavior is almost same.)

Sample code:
http://www.mediafire.com/download/36ydm ... ample1.zip
http://www.mediafire.com/download/ui5c4 ... ample2.zip

I wish I could made these codes with adding lifetime like RTC, But I am not sure if DSB has it and tweak it.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Does DSB has object "lifetime" like RTC?

Post by Sophia »

You'll want to use an expire message. You have to do a bit more work than in RTC, but it's also more flexible.

http://www.dungeon-master.com/forum/vie ... 0&#p135970

By default, an object receiving an expire message simply disappears, which is often what you want, but you can write code to do anything else, too.
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Re: Does DSB has object "lifetime" like RTC?

Post by Qwerty »

Wow! This is what I REALLY want to! :shock: Thanks to add utility on_events for DSB!

P.S.
What a shame! Item disappearance with these on-events has some trouble while watching the item on eye-icon.

Code: Select all

PROGRAM CRASH!
Location: 0 0 0
Reason: Segmentation Fault
Stack Dump:
DSBmain
DSBgameloop
render_inventory_view
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Does DSB has object "lifetime" like RTC?

Post by Sophia »

It keeps trying to view the item even though it is now nonexistent. I'll fix that.
Post Reply