Place Objects In Containers

Edit: Sorry guys I worked it out.

Hi All,

I think I have a really simple one which for some reason I can't work out.

How do you place an object in a container while in game? I can't work out the command or how to set it up outside the game.

Cheers in advance.


Put [object1] in [object2]
😀😁
In code: object1.parent = object2


I have this same question and don't understand the code. Anyone that could help explain how to do it in the GUI, would be helpful.
Nevermind...I figured it out :) Thx


(filler for getting my edited post, updated/posted)


(this for is for a Text Adventure, so let me know, if you're doing a Game Book, for help on doing it with that)


IMPORTANT:

this is just a simple scripting, so there's no handling of what you try to do with it, meaning, you can completely screw up your game (as you can transfer any existing Object within another existing Object, and thus this can completely screw up your game, obviously), so be very careful with using this Command and its simple scripting during game play!


HELP:

can someone make/put the library code below into a new game file and upload it for them and/or take and upload screen shots of the Command's GUI/Editor's scripting for them to see how its done

or, explain to them how to make this code into a library file for them, and then in how to add it into their game file

(HK is tired after doing this code, lol, and is also very lazy and don't have an easy means of doing this stuff himself currently, and thus why I'm hoping someone else can do this stuff for me, lol)


during game play, you'd type in this (examples only) into the command/input text box bar (defaultly at the bottom of screen):

transfer toy into box

// or:

transfer box into toy

// or this (or then do it as another input command, lol):

transfer box into player

// or this (or then do it as another input command, lol):

transfer toy into player

IMPORTANT:

as I've already said/stressed, you can transfer any Object into any Object with my simple scripting/code for this Command, so you can play around with it during game play (what inputs you type in: what Objects into what Objects), but be careful as it'll screw up your game, if you transfer Objects into other Objects: that should never be able to happen / that should never happen


the 'surface' Inherited Attribute for the 'toy' and 'box' Objects, is just so you can see that it worked

<library>

  <object name="box">

    <inherit type="surface" />

    <attr name="parent" type="object">room</attr>

  </object>

  <object name="toy">

    <inherit type="surface" />

    <attr name="parent" type="object">room</attr>

  </object>

  <command name="transfer_cheat_command">

    <pattern>transfer #text_name_or_alias_of_transfering_object_parameter# into #text_name_or_alias_of_destination_object_parameter#</pattern>

    <script>

      if (text_name_or_alias_of_transfering_object_parameter = text_name_or_alias_of_destination_object_parameter) {

        msg ("ERROR: this simple code/scripting of mine doesn't handle both inputs being the same")

      } else {

        transfering_object_variable = GetObject (text_name_or_alias_of_transfering_object_parameter)

        destination_object_variable = GetObject (text_name_or_alias_of_destination_object_parameter)

        if (transfering_object_variable = null) {

          foreach (object_variable, AllObjects ()) {

            if (GetString (object_variable, "alias") = text_name_or_alias_of_transfering_object_parameter) {

              transfering_object_variable = object_variable

            }

          }

        }

        if (destination_object_variable = null) {

          foreach (object_variable, AllObjects ()) {

            if (GetString (object_variable, "alias") = text_name_or_alias_of_destination_object_parameter) {

              destination_object_variable = object_variable

            }

          }

        }

        on ready {

          if (not transfering_object_variable = null and not destination_object_variable = null) {

            set (transfering_object_variable, "parent", destination_object_variable)

          } else {

            if (tranfering_object_variable = null) {

              msg ("ERROR: wrong input (name/alias) of your transfering Object: your input doesn't exist as an Object in the game")

            }

            if (destination_object_variable = null) {

              msg ("ERROR: wrong input (name/alias) of your destination Object: your input doesn't exist as an Object in the game")

            }

          }

        }

      }

    </script>

  </command>

</library>

P.S.

or, did you just need help with something much more simple:

adding and setting up a 'put' Verb on your individual Objects, for putting Objects into that Object?

see the tutorial:

http://docs.textadventures.co.uk/quest/tutorial/index.html (index page)

http://docs.textadventures.co.uk/quest/tutorial/using_scripts.html (hopefully the 'put' Verb is also a built-in feature meaning that it can be added and easily set up through the GUI/Editor, in a same way that this link talks about doing the 'watch tv' stuff and etc, but if not, let us know and we can help you with it)

http://docs.textadventures.co.uk/quest/tutorial/using_containers.html


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

Support

Forums