Adding a second inventory/object pane

jaynabonne
Attached is some code for creating an additional inventory/object pane. The zip file contains three files:

1) InvPane2.js - This file is the one that actually creates the additional pane. It also has a function to allow setting the list contents. You need to include this JS file in your game file. The pane is created automatically when this file is included.
2) InvPane2.aslx - This file contains an ASLX function you can call to set the list contents. You need to include this library in your game file. There are two functions:
- SetInventory2Label: Call this function, passing the new label as a string, to set the pane's label (the text at the top)
- SetInventory2: Call this function, passing an object list, to set the objects into the pane.
3) AdditionalPane.aslx - This is a sample test game file that shows the second pane in operation. You don't need this file in your game.

The list is set up to work the same as the standard inventory pane. Clicking on an object shows the verbs available. Also, you *must* call SetInventory2 to set or update the pane list contents as desired. This is a separate pane and will not be updated automatically. (A way to do this is to use a turn script.)

jaynabonne
Note: the sample game is a bit lame and probably needs some explaining. I have two objects in another room that I added into the second pane. Since they're in another room, none of the verbs will actually work. So please ignore those errors if you try it out!

Pertex
And do you think it will be possible to use the verbs, too?

jaynabonne
Yes, the verbs will work, assuming the objects are within scope. Perhaps I should change the sample app... I just wanted to see different objects in the two panes. ;)

Entropic Pen
Hey Jay, it's me again,

I'm all about making sure that the User Interface is as easy on the user as possible, and I wanted to use this code to move a whole group of objects that the player will always keep on his person into a pane called "Equipment". I've got everything set up except that when I attempt to use my "Equipment", it is not in scope.

I was thinking of using Sora(insert three-digit number here)'s "Stackable" Library to put all the equipment in, but that would require those annoying pop-up boxes, and also your scripting would really stand out.

jaynabonne
I'm not sure which verbs/commands you want to use, but if you create your own custom commands, then you can just use #text# instead of #object# and look up the object yourself.

If this continues to be a problem, then I can look at extending the pane to use more than just verbs. I was keeping it parallel to the main inventory, but if the use cases point it in a different direction, I can code it that way (or for both). For instance, instead of having the verb be used explicitly, there could be a double level (name/command or verb) where what's displayed is not what's executed.

Could you explain a bit more what you'd like to do? Would it be the same verbs as normal or different commands?

Entropic Pen
jaynabonne wrote:I'm not sure which verbs/commands you want to use, but if you create your own custom commands, then you can just use #text# instead of #object# and look up the object yourself.

If this continues to be a problem, then I can look at extending the pane to use more than just verbs. I was keeping it parallel to the main inventory, but if the use cases point it in a different direction, I can code it that way (or for both). For instance, instead of having the verb be used explicitly, there could be a double level (name/command or verb) where what's displayed is not what's executed.

Could you explain a bit more what you'd like to do? Would it be the same verbs as normal or different commands?


I need it to work much like the main inventory pane, but to where I can use the verbs displayed on the secondary pane without the game giving me the "You can't see that" message.

jaynabonne
So basically, you'd want to be able to use the standard verbs on non-present objects. I'll have to think about how to do that. What I think you need is some sort of new scope or an addition to a scope, some sort of "reachable", but where they don't show up in the inventory list but can still be manipulated.

Entropic Pen
Alright, I found a work-around by making the "Equipment" objects scenery (so that they cannot be shown in the "Objects and Places" Pane), and had them part of a turnscript that will make sure the location of the Equipment is the same location as the player.

And yes... it works.

The Pixie
I had a quick play around with this. Is there an easy way to get from #text# to an object in an unusual scope (i.e., another room)? All I did was just test against each name and alias, not even bothering with "alt", but somewhere in Quest it must do this already; is that code usable, or is it buried in stuff.

Anyway, I extended the demo a bit, with the second window used to hold spells:

Entropic Pen
The Pixie wrote:I had a quick play around with this. Is there an easy way to get from #text# to an object in an unusual scope (i.e., another room)? All I did was just test against each name and alias, not even bothering with "alt", but somewhere in Quest it must do this already; is that code usable, or is it buried in stuff.



Now this is more like it! Thanks Pixie!

jaynabonne
The Pixie wrote:I had a quick play around with this. Is there an easy way to get from #text# to an object in an unusual scope (i.e., another room)? All I did was just test against each name and alias, not even bothering with "alt", but somewhere in Quest it must do this already; is that code usable, or is it buried in stuff.


I think the closest function is ResolveNameInternal. Unfortunately, that function take a list type string (object or exit) and looks up the actual object list in hard-coded fashion rather than just taking the object list, which would have made it more reusable. But you could probably copy that function up, rename it, and then have it use the out-of-room children list.

The Pixie
I will look at ResolveNameInternal, first glance suggests it should be easy enough. I realise I actually suggested this for Quest nearly two years ago, shame it has just got pushed back to "Quest (future)" as it looks pretty easy.
viewtopic.php?f=10&t=2559&start=30#p18890

Alex
It will only be a core lib change so anybody could do this really...

MrFRZ
Hey guys, Im trying to edit the side panel for my game as well but instead of adding a pane I'd like to remove the compass pane while leaving the inventory etc. Is there an easy way to do this? If its too complicated I suppose I can just leave it unused but I'd like to try to remove it

MrFRZ
Also, I would like to add another panel but I only need it to display text. This panel will be labeled "Time" and I want to show the date and time here. It wont be a clock that continually counts as you play, it will simply be a text that I can update when I want (like when moving from room to room). Is there a way to create another pane where I can just show whatever text I want to, like how you can say: print("this text") to show up on the main screen?

HegemonKhan
the 'status' pane using the special 'statusattributes' String dictionary Attribute for your 'game' Game Object or Player Objects, can already do this for you.

Though, if you want to separate the 'time' to its own pane, than (this stuff is beyond my ability) you may want to look into how the 'status' pane works, or just wait for Pixie or whoever else is good with quest's coding, to help you, laughs.

MrFRZ
I'd rather have a separate pane for the time, as in the status pane all the information is about your character (health, group's approval of you, strength, etc.) but, like I said in the previous post, I'm not trying to get too complicated with this game. If its too hard to create an entirely new pane then players (and myself) can deal with the time being in the status pane as its not game changing lol. Thanks for your help though, I may end up using this for the time and other things.

The Pixie
Take a look at this post, where I do a similar thing, adding a new pane in this case with commands on it.
viewtopic.php?f=18&t=5111#p36310

It is done by adding an attribute to game, I called it stuff, with all the extra HTML, outputing that at the start of the game, then putting it into place with JQuery. You would have to use more JQuery to update the text during play.

InfectedBehaviour
Could it also be setup in away that if a character picks up a bag, Only then the second inventory will appear. Also if the character puts down the bag, That the second inventory then disappears. Plus adjusting the second inventory to only hold so many items/objects?

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

Support

Forums