Hi,
I'm trying to create a book where the player will glue pages. Only certain objects can be added. After the glue, the player cannot remove it.
I did something like this: created a transparent surface. Because I cannot figure out how to control what can be added, I designed the surface as closed, and the pages are automatically added to the book by an script when found. This all works fine, the player can access the pages, and cannot drop then.
However, the message when he tries to drop the page is the problem:
"Book is not open."
I can't figure out how to change this message to something such as "You don't want the tear the book apart" (ObjectNotOpen template)
So I went to plan B. I created a new type that inherits from surface, and I overrode the put and remove commands in order to control what can be added to the surface (and preventing anything from being removed).
It is kind of working, but I think I overdid the solution. The command override is global, so I had to copy the code from corecommands.aslx, adding an if such as:
<command name="removeSpell">
<pattern>remove #object1# from #object2#</pattern>
<script>
if (HasAttribute(object2, "no_remove")) {
msg ("you cannot remove this.")
} else if (not Contains(object2, object1)) { // copied from corecommands
msg (DynamicTemplate("ObjectDoesNotContain", object2, object1))
} else {
DoTake (object1, false)
}
Is there another way to do that?Could I call something like super() on command? if not, I would suggest to place all command logic in functions, so that the developer don´t need to copy code from corecommands.
Thanks
There's a lot of problems people have with containers: open/close/lock/unlock/etc, which I think is mostly due to how much underlying code there is for this stuff (a lot of 'helper' code/functions to make it more user-friendly and including showing up in the GUI/Editor stuff/options/tabs/etc)
there's a lot of ~ 'on entering/exiting/opening/closing/locking/unlocking/etc' Scripts, that often use strings (prompts/messages). You can also take a look at the 'templates' where you can find all of the default responses/prompts/messages, and change them.
if you look at this link (scroll down to the bottom, you can see the complexity of the nesting heirarcy of the 'containers' and like/unlike types):
http://docs.textadventures.co.uk/quest/elements/object.html ( scroll down to the bottom to the 'Object types defined by Core.aslx', and look at all the Attributes above too)