Sequential Cloned Items
Unadept
04 Jan 2016, 19:27Hello, Everyone,
I'm very, very new to this system, but I have a problem that reading through manuals, searching the forums or just guessing hasn't helped me solve. Maybe I'm using the wrong search words, but I thought I'd just ask the community.
As support for one of my tabletop games, I want to build a menu system that my players can look through to buy items from. Once a PC buys and item, I want it to show up in the Inventory. That's all super-simple.
The problem is that they may want more than one instance of an item, and each item may have different attributes. This means that I'd want to rename each cloned item as they come up. I know that the first clone is named, say, item1, second item2...
However, I want each cloned item to be named with a corresponding number, for example: "1: Item. 2: Item." The reason being that I want the PCs to quickly be able to identify, look at and potentially sell back any items they don't want. I can create a counter easily enough, but I can't manage to change the name or listalias with, say, a {player.count} attribute built into the name; it just won't let me.
Is there any way that I can rename cloned items in a sequential manner, so that they can be quickly differentiated from each other?
Many thanks.
I'm very, very new to this system, but I have a problem that reading through manuals, searching the forums or just guessing hasn't helped me solve. Maybe I'm using the wrong search words, but I thought I'd just ask the community.
As support for one of my tabletop games, I want to build a menu system that my players can look through to buy items from. Once a PC buys and item, I want it to show up in the Inventory. That's all super-simple.
The problem is that they may want more than one instance of an item, and each item may have different attributes. This means that I'd want to rename each cloned item as they come up. I know that the first clone is named, say, item1, second item2...
However, I want each cloned item to be named with a corresponding number, for example: "1: Item. 2: Item." The reason being that I want the PCs to quickly be able to identify, look at and potentially sell back any items they don't want. I can create a counter easily enough, but I can't manage to change the name or listalias with, say, a {player.count} attribute built into the name; it just won't let me.
Is there any way that I can rename cloned items in a sequential manner, so that they can be quickly differentiated from each other?
Many thanks.

jaynabonne
04 Jan 2016, 20:02You'll need to set the alias for the new clone based on the current count. Something like:
if you wanted it to be as you listed above.
A clarification: If the player has "1: Item." , "2:Item." and "3:Item." and they drop "2:Item.", do they then have "1:Item." and "3:Item."? In other words, is the numbering based on the number of items that have been created in the universe, or are you wanting some sort of dynamic numbering just for the items the player possesses?
newobject.alias = player.count + ": Item."
if you wanted it to be as you listed above.
A clarification: If the player has "1: Item." , "2:Item." and "3:Item." and they drop "2:Item.", do they then have "1:Item." and "3:Item."? In other words, is the numbering based on the number of items that have been created in the universe, or are you wanting some sort of dynamic numbering just for the items the player possesses?
Unadept
05 Jan 2016, 00:18I'm OK with each item being assigned a unique number that is not repeated; as cool as it would be to have each item in the inventory numbered 1-whatever, I'd rather do the easier thing that still makes it possible for the player to quickly distinguish between cloned items in the inventory.
Thanks, I'll give that a try in due course, see if I can get it to work (presently occupied until the morrow).
Thanks, I'll give that a try in due course, see if I can get it to work (presently occupied until the morrow).
HegemonKhan
05 Jan 2016, 01:12I too am unsure of what you're asking for...
--------------
do you want the cloned items to appear in the inventory as (using an example of a 'key' item):
1: key
2: key
3: key
as opposed to the naming from the cloning:
key1
key2
key3
----------------
do you want the items to be differentiated?
(the "name" ID Attribute would still be "key1", "key2", "key3", but we can use the 'alias' Attribute to give them different names as seen below)
1: skeleton key
2: gold key
3: silver key
------------
do you want the items to hold and display their quantity as well? for example:
1: skeleton key (99)
2: gold key (43)
3: silver key (70)
this is a bit beyond my level of coding, but there is Sora's Stackable Library (that you can look at), however, it hasn't been updated~converted to work with the current version of quest, unfortunately.
----------
if you want to display the:
1. skeleton key
2. gold key
3. silver key
in the big text box area on the left side, then an easy way to do it, is to add the items to an Objectlist, and use the 'DisplayList' Function ( http://docs.textadventures.co.uk/quest/ ... ylist.html ), for example:
(hopefully, quest automatically will display the "aliases", otherwise, you got to manually create your own list display, which I can show you how)
DisplayList (game.key_list, true)
// outputs:
// 1. skeleton key
// 2. gold key
// 3. silver key
vs:
DisplayList (game.key_list, false)
// outputs:
// skeleton key
// gold key
// silver key
--------------------
or, did you want something else done ???
--------------
do you want the cloned items to appear in the inventory as (using an example of a 'key' item):
1: key
2: key
3: key
as opposed to the naming from the cloning:
key1
key2
key3
----------------
do you want the items to be differentiated?
(the "name" ID Attribute would still be "key1", "key2", "key3", but we can use the 'alias' Attribute to give them different names as seen below)
1: skeleton key
2: gold key
3: silver key
------------
do you want the items to hold and display their quantity as well? for example:
1: skeleton key (99)
2: gold key (43)
3: silver key (70)
this is a bit beyond my level of coding, but there is Sora's Stackable Library (that you can look at), however, it hasn't been updated~converted to work with the current version of quest, unfortunately.
----------
if you want to display the:
1. skeleton key
2. gold key
3. silver key
in the big text box area on the left side, then an easy way to do it, is to add the items to an Objectlist, and use the 'DisplayList' Function ( http://docs.textadventures.co.uk/quest/ ... ylist.html ), for example:
(hopefully, quest automatically will display the "aliases", otherwise, you got to manually create your own list display, which I can show you how)
DisplayList (game.key_list, true)
// outputs:
// 1. skeleton key
// 2. gold key
// 3. silver key
vs:
DisplayList (game.key_list, false)
// outputs:
// skeleton key
// gold key
// silver key
--------------------
or, did you want something else done ???
Unadept
05 Jan 2016, 02:59Ideally, I'd like the
1: key
2: key
3: key
arrangement.
Indeed,
1: key
2: key
3: lock
4: lock
5: orange
would be totally acceptable and great.
Adding quantity as well would be awesome, though I think I can do that if I can just manage to change the listalias based on an attribute... I could also put it in the item description. That would be fine.
I'll play around and see if I can get the suggestions offered here to work for me, and thank you both for making them.
1: key
2: key
3: key
arrangement.
Indeed,
1: key
2: key
3: lock
4: lock
5: orange
would be totally acceptable and great.
Adding quantity as well would be awesome, though I think I can do that if I can just manage to change the listalias based on an attribute... I could also put it in the item description. That would be fine.
I'll play around and see if I can get the suggestions offered here to work for me, and thank you both for making them.
Unadept
05 Jan 2016, 03:38jaynabonne wrote:newobject.alias = player.count + ": Item."
This worked perfectly. Absolutely great.
Is there any way to have this work on all clones, so that I don't have to enter additional scripts for key1, key2, key3, key4, etc.?
And thanks again.