How to create self-referencing objects?

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

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
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

How to create self-referencing objects?

Post by Gambit37 »

Here's a weird one:

How do I create an object that CONVERT_TO another that in turn CONVERT_TO the initial object?

For example, say I want an empty flask that CONVERT_TO a full flask that in turn CONVERT_TO an empty flask, ad infinitum?

I can't do it at present because when you define your new objects, RTC checks to see that it's CONVERT_TO object already exists... but in this case each one can't have a CONVERT_TO parameter without the other one already being defined!

This is a rather nasty catch-22 loop. How to get around it?

Don't suggest creating interim objects because the same thing applies!
Last edited by Gambit37 on Wed Jan 28, 2004 4:54 pm, edited 1 time in total.
User avatar
andyboy_uk
On Master
Posts: 647
Joined: Thu Feb 20, 2003 1:51 am
Location: London, UK

Post by andyboy_uk »

Can you clone the objects, like this

my_ flask_full
and
my_flask_empty

and put the convert to to switch to each other?

Or is that what you meant by interim objects?
Regards,

Andy
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

I don't understand your sample. Is the word 'and' important?

The problem is that RTC checks for any object listed in the CONVERT_TO paramter. If it doesn't already exist, it generates critical errors.

So it's not possible to do this:

MY_FLASK_EMPTY .... CONVERT_TO(MY_FLASK_FULL)
MY_FLASK_FULL .... CONVERT_TO(MY_FLASK_EMPTY)

...because the definition for MY_FLASK_EMPTY includes a CONVERT_TO reference to an object that has not yet been defined....
Post Reply