Text Processor Inventory [SOLVED]

Anonynn
So I was wondering...I know you can do this stuff...

{if backpack.worn:} and so on.

But is there a text processor command for

{if backpack.carry:} like referring to something in your inventory list?

Oh...and how to make an item visible and invisible? Would that be... backpack.visible=True --- backpack.visible=False?


Thanks!

The Pixie
I think you can do this:
{if backpack.parent=player: You are carrying a backpack}

And yes to the visible thing.

Anonynn
Darn it. What I was hoping for didn't work.

I was hoping that equipping the wearable containers like the backpack and then making them invisible in the inventory would work. But the player cannot look at them or remove them from their inventory once they become invisible. I set it up to make the backpack for example, invisible when put on and visible again when taken off so it wouldn't take up inventory space. But alas!

Any ideas?

XanMag
You could make it a command and then it doesn't matter if the backpack is visible, right? Just set a flag that increases max volume.

The Pixie
You could add a second inventory pane just for the backpack (I did one for spells in Deeper). Then the player could collapse or expand it as he likes. Should be fairly easy to hide and show it altogether as the player picks up and drops the backpack.
viewtopic.php?f=18&t=3789

Anonynn
The secondary window pane would be great. I have no idea how to set it up though and make it blend with the rest of my game's color schemes. Would that take a lot to implement? And do I just download it like I do other libraries?

And you can send specific items to it?

Anonynn
Alrighty, so I downloaded and installed the "Additional Pane" ...and then set up the two functions as Jayna explained. Here they are..

Function
Name: SetInventory2Label
Return Type: String
Parameters: Bags

Function
Name: SetInventory2
Return Type: Object List
Parameters: backpack

And then set this on my backpack object.

After wearing the object:
SetInventory2 (backpack)

But when I test it in the game, the backpack doesn't move from the initial inventory and no second pane appears. What am I doing wrong?

The Pixie
Take a look at this, it might help (but might be out of date):
http://docs.textadventures.co.uk/quest/ ... nced_.html

Anonynn
So I'm on "Step 4" (although I already did some of the later steps) ...How would I apply this to the backpack?


      if (not this.parent = game.pov) {
this.parent = spells_known
this.inventoryverbs = Split ("Cast", " ")
msg (DynamicTemplate("SpellLearnt", this))
SetInventory2 (GetDirectChildren (spells_known))
}
else {
msg ("[SpellAlreadyKnown]")
}
]]></learn>

Here's what I think it might be...

        this.parent = containers_room 
this.inventoryverbs = Split ("Remove;Drop", " ")
SetInventory2 (GetDirectChildren (containers_room))


Looking okay?

The Pixie
This is not as straightforward as I first thought...

The Pixie
It is easier with spells because they have a simple verb unique to them - CAST.

It would be easier if you had new verbs for putting something in a rucksack, and kept that separate to PUT <this> IN <that>. You could have STOW <this>, but I cannot think of a good word for removing from the rucksack that will not be used for something else. EXTRACT maybe?

Anonynn

It would be easier if you had new verbs for putting something in a rucksack, and kept that separate to PUT <this> IN <that>. You could have STOW <this>, but I cannot think of a good word for removing from the rucksack that will not be used for something else. EXTRACT maybe?



Well, luckily nothing has to go INTO the backpack at all. The only function of "Containers" in my game now, are to increase your carry limit. There are two types of Containers too: Wearable like the "Backpack", and "Carryable" like the "Large Sacks". Perhaps I could just remove the wearable containers and make them all Carryable then all the verb would have to be is "Drop" .....do you think that would work?

The Pixie
Then I misunderstood your intention altogether, and you should ignore everything I have said so far!

This should be much easier. What you really want to do is change the value of player.maxobjects. Increase it by one when the backpack (or anything) is worn, decrease it by 1 when the backpack (or anything) is taken off, increase it by the backpack capacity when the backpack is picked up, and decrease that amount when the backpack is put down. The first two will be best done in the wearables library, in DoWear and DoRemove, I think.

Take and drop scripts for the backpack:
this.parent = player
player.maxobjects = player.maxobjects + 8
msg("You pick up the backpack; now you can carry lots more")

this.parent = player.parent
player.maxobjects = player.maxobjects - 8
msg("You drop the backpack; now you can carry much less")

Anonynn

Then I misunderstood your intention altogether, and you should ignore everything I have said so far!



Haha!

The first two will be best done in the wearables library, in DoWear and DoRemove, I think.



Yup! I have already modified them. This is what I have atm.

player.object: Attributes
maxvolume: integer 3
changedmaxvolume: script
if (player.maxvolume < 1) {
player.maxvolume = 1
if (volume > player.maxvolume) {
continue = false
if (HasString(game.pov, "containerfullmessage")) {
message = prefix + game.pov.containerfullmessage
}
else {
message = prefix + DynamicTemplate("FullInventory", object)
}
}
}


backpack.object
After Wearing
player.maxvolume = player.maxvolume + 13

After Removing
player.maxvolume = player.maxvolume - 13

Although, I can remove the "wear" feature since it isn't super critical. But either way, the new inventory pane is where I was hoping to put all the player's containers so they wouldn't take up space in the main inventory.

[quote]Take and drop scripts for the backpack:
this.parent = player
player.maxobjects = player.maxobjects + 8
msg("You pick up the backpack; now you can carry lots more")

this.parent = player.parent
player.maxobjects = player.maxobjects - 8
msg("You drop the backpack; now you can carry much less")[/quote]


Do you think I should just use maxobjects instead of volume? Or does it not matter?

HegemonKhan
if you want a total different design:

you could just have/create a single Object in your player's inventory be your 'storage', and then from inside of it, you can organize the Objects you put into it, for example:

the 'player' Object (his/her inventory):


........................'fire magic/spells' storage Object - (all your various learned fire spell objects)
........................|
........................|...'water magic/spells' storage Object - (all your various learned water spell objects)
........................|./
........................'magic/spells' Object storage - 'air magic/spells' storage Object - (all your various learned air spell objects)
'blah' Object....../
....................../..........................................'battle item' storage Object - (all your various battle item objects)
...................../........................................../
'storage' Object --- 'items' storage Object - 'healing/curing item' storage Object - (all your various healing/curing objects)
.....................\\_
......................\..\_'transformation' storage object - (all your various transformation objects)
'blah' Object.....\
.......................'equipment' storage Object - 'weapon' storage object - (all your weapon objects)
........................................................\
.........................................................'armor' storage object (all your various armor objects)


etc etc etc sub-divisions/categorizing/organizing (such as breaking up the weapons into further sub-storage of 'swords', 'axes', 'blunts/maces, etc', and same with the 'armor' too)

and then you'd have (if/switch) scripts that will check an Object for an identifying Attribute (ie: katana_object.type_of_object_string_attribute = "weapon", catnip_object.type_of_object_string_attribute = "transformation", etc), and place that Object into the correct storage Object (ie: katana_object.parent = weapon_storage_object, catnip_object.parent = transformation_storage_object)

---------------------

technically, you could use both, 'volume/weight' and 'maxobject/quantity', as they are two different types of logical values (people can only hold two things as they only have two hands - keeping this simple - not getting into using your arms, underarms/armpits, legs, teeth, etc, lol, and also people can only hold so much weight too) - if you want a complex item/equipment/storage/etc system, or choose one or the other, for a more simple system.

Anonynn
That might be a viable option if what I have planned doesn't work. I'm just iffy about the player carrying around containers since there is a lot of logic problems in Quest regarding it. But thanks for the potential option. :D :D !

HegemonKhan
this was just posted, quite impressive UI !!!!

viewtopic.php?f=3&p=42654#p42653

I hope to learn to do an interface eventually at this level... sighs

The Pixie
Just to be clear, that was not created in Quest. Makes me wonder if it could be done though...

The problem is you have to be a good story teller, and a coder and now you have to be an artist as well...

Alex
I have seen some really impressive UI done in Quest, using JavaScript and HTML to customise it. Unfortunately it looks like the best example of this I saw won't ever be released, but it was almost unrecognisable from how Quest usually looks.

Anonynn
Sorry to get off topic! xD

I'm still not sure why the second pane isn't appearing...and how I would get the backpack in there.

HegemonKhan
didn't mean to derail the thread, but just wanted to share that poster's UI, as a few people are trying to make a similar RPG-type of game, and would like to have a UI like that for their game, laughs.

I'm no artist, nor have I learned really how to do web/JS/html/xml page/interface design, so when I see really good art/UI, I'm really impressed by it.

Anonynn

didn't mean to derail the thread.



It's perfectly fine! I admire what they were able to do with their UI's. I can only draw people --- not good at coloring or anything like that so...major bummer.

Anyway, so I decided to forego the Second Pane since all it was causing was errors. I went ahead and removed all of the "wearable" containers and decided to put them in one place as HK suggested. My question is is there a way to keep the "Storage" item always on top in the inventory? or the always at the very bottom of the inventory? I would prefer the bottom.

HegemonKhan
you could instead use a Command (which would be similar to a person playing an actual game pressing a button to bring up their 'item storage' screen) and have a separate Object (hidden from the user) handling the item storaging, but this would involve a bit of the same scripting headache to get it working, if you'd rather free up the inventory from storage altogether, but I think you'd rather not have the scripting headache over the player's inventory being totally free of storage-objects. As, having just a single Object (which would be containing all your sub-storage Objects and within them the actual item Objects) as your storage Object in your inventory, is hardly cluttering it up, lol.

-------

I think you understand my design already (a single 'storage' Object directly in the inventory), but just in case, I describe/explain it more in the 'Stackable Library' by Sora:

viewtopic.php?f=18&t=3515&hilit=stackable+library

(maybe if I have the time during summer... I may try to jump into Sora' Stackable Library, trying to understand it, and creating a new updated library for the current version of quest, we'll see if I got the time... as I got to also use summer to understand assembly language and computer archiecture better, as I had to drop out, and will take it again, hopefully getting a B or A grade the second time around, sighs, on top of trying to work on my own quest game progression that I'd ike to do too, lol. Time, despite all the science about it, is quite finite, there's nothing infinite about time, lol)

-------

as to that... I'm not sure how quest does it's sorting (or if it doesn't: if the Object is added/created at the top of the 'player' Player Object, then it is shown at the top in the pane during game play). If quest does do some sort of automatic sorting... and you can't toggle it off, then your only option would be by naming it so it's in alpha-numer-ical order (assuming this is how it would do the sorting)

The Pixie
Anonynn wrote:Anyway, so I decided to forego the Second Pane since all it was causing was errors. I went ahead and removed all of the "wearable" containers and decided to put them in one place as HK suggested. My question is is there a way to keep the "Storage" item always on top in the inventory? or the always at the very bottom of the inventory? I would prefer the bottom.

As far as I can tell (and I could be wrong), Quest lists items in the order they appear in your game code. That would mean if the storage items are at the bottom of the pane on the left in the editor, they will be at the bottom of your list. I think I would set up a new room called storage items, and put them in there. Of course, you will want the pack to be in a specific place in the game, so in the game start script, set the parent attribute to where you want the item to start.

Anonynn

As far as I can tell (and I could be wrong), Quest lists items in the order they appear in your game code. That would mean if the storage items are at the bottom of the pane on the left in the editor, they will be at the bottom of your list. I think I would set up a new room called storage items, and put them in there. Of course, you will want the pack to be in a specific place in the game, so in the game start script, set the parent attribute to where you want the item to start.



If I put them in a storage room though, will the player still be able to interact with them and will they still count as the player holding them?

(maybe if I have the time during summer... I may try to jump into Sora' Stackable Library, trying to understand it, and creating a new updated library for the current version of quest, we'll see if I got the time... as I got to also use summer to understand assembly language and computer archiecture better, as I had to drop out, and will take it again, hopefully getting a B or A grade the second time around, sighs, on top of trying to work on my own quest game progression that I'd ike to do too, lol. Time, despite all the science about it, is quite finite, there's nothing infinite about time, lol)



Sounds like a lot of work! You still have to work on your own game you know :p

The Pixie
Anonynn wrote:If I put them in a storage room though, will the player still be able to interact with them and will they still count as the player holding them?

It only has to be there at the start of the game. In your start script move them to wherever the player will find them, and thereafter they can be handled just the same as normal.

Anonynn

It only has to be there at the start of the game. In your start script move them to wherever the player will find them, and thereafter they can be handled just the same as normal.



Sorry, I think finals are frying my brain @_@ So I create the room, let's say "Storage". Then in my game-object, "Start Script" --- I do what now? The player doesn't start with any container objects and receives one of them in the first room does that matter?

The Pixie
So in your start script you want something like this:
backpack.parent = firstroom
That will put the backpack in the room called firstroom at the start of the game. Then it will be just as before.

Anonynn
The thing is, the player doesn't auto-receive the backpack. They have a choice about picking it up or not. After(if) they do will they be able to interact with the backpack like "dropping" it afterward if they need to? Will it still count as the player "having the object" as well if it's sent to another room?

The Pixie
Doesn't matter, it will still be fine (assuming I am right about how Quest works, anyway).

The way I think it works is that Quest keeps a database where each object/room is a record. The order of those records is the order they appear in your game file. When the player picks things up, that is just changing a field for that record (i.e., the "parent" attribute), it does not change where that record is stored in the database. So when Quest does the inventory it goes through each record, picking out those for which the parent attribute is player, and adding them to the list. If your backpack is the last record (whereever it is in the game world), it will get added to the inventory list last, so will appear at the bottom.

So your backpack will only be in the special storage room right at the very start to ensure it is the last record in the database, then moved into the game by the start script. After that, you just handle it as normal; if dropped it goes into the current room, because that will only change the parent attribute, not its place in the database.

As I type this, I realise there is a flaw, however. Any items created during the game, for example anything cloned, will get added to the database, so will presumably appear after the backpack. It might be better to put the storage room at the top so the backpack is always top of the list.

By the way, on the Object tab there is an option to give things a special name for something in the lists on the right, so you could flag storage items with an asterisk or something.

Anonynn
So I created a room "Player Storage Room"

Added this code to the game.object, script...

backpack.parent = Player Storage Room
belt_pouch.parent = Player Storage Room

And the backpack appeared as normal like you said it would but when the player picked it up it remained in their inventory. We might be confused though!

I'm trying to store "storage" containers somewhere that doesn't take up a ton of space in the player inventory. Like....

Inventory
Storage [open]
- backpack
- belt pouch
1. inventory items.
2. inventory items.
3. inventory items.

Storage [closed]
1. inventory items.
2. inventory items.
3. inventory items...
etc.

Does that clear up what I want to happen xD?

So would I do something like

backpack.parent = Storage

So that when the player "takes" the item it's placed in there?

UPDATE

It works :D Thank you Pix!! and HK!

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

Support

Forums