Code for Listing Children Objects?

XanMag

I'm trying to help someone out here so give me some info I can pass along please! lol

I've always had issues with containers... I want to make an object "openable" after completing a task. To do this, I made the object an 'openable/closable' container. I chose this because it is the only option that doesn't seem to automatically spit out a 'Leave blank for Default' option when attempting to open.

So... in the script to run when opening an object, I have a flag set that indicates that the previous task has been completed and I check for that flag in the 'If' statement. I print a message "You open it and look inside." Now, since this container does not appear to have the automatic 'list children when opened or looked at' option, how can I manually list the children of the envelope when opened and looked at? I thought it would be something like ListChildren(envelope), but that ain't working!

I'm probably making this too difficult. Help me out please. Thanks.


hegemonkhan

'GetDirectChildren(params)' or 'GetAllChildObjects (params)'

http://docs.textadventures.co.uk/quest/functions/getallchildobjects.html
http://docs.textadventures.co.uk/quest/functions/getdirectchildren.html

http://docs.textadventures.co.uk/quest/functions/allobjects.html
http://docs.textadventures.co.uk/quest/scopes.html
http://docs.textadventures.co.uk/quest/functions/dictionarycontains.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/got.html
http://docs.textadventures.co.uk/quest/functions/listcontains.html


the 'openable/closable' Object Type is for Objects that are to act like doors (open/close but don't hold anything inside of them)

choose the 'container_closed' or 'container_open' or 'container' if I remember right (I had a post somewhere where I tried to understand their organization and what they do... too lazy to try to look for it, or to re-study the different 'container' Object Types)

here:

http://docs.textadventures.co.uk/quest/elements/object.html (scroll down to the very button, click on the different Object Types, and study them - try to understand them)


or did you want these:

http://docs.textadventures.co.uk/quest/functions/corelibrary/formatobjectlist.html
http://docs.textadventures.co.uk/quest/asl_requirements.html
http://docs.textadventures.co.uk/quest/functions/populate.html


XanMag

I thought I tried entering that code and it didn't work. Just got an error. I probably syntaxed it wrong...


hegemonkhan

to display them...

you'd further need to do this:

DisplayList (parameters) ( http://docs.textadventures.co.uk/quest/functions/corelibrary/displaylist.html ) (the true/false parameter option is whether to have the displayed items numbered or not)

or manually:

x = 0
foreach (object_variable, GetDirectChildren (params)) {
  x = x + 1
  msg (x + ". " + object_variable.name) // or you can use the 'alias' String Attribute instead of the 'name' (ID) String Attribute
}

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums