Stacking Objects
Sora574
03 Mar 2013, 00:13Is it possible to 'stack' objects? I couldn't find any mention of this, so I decided to ask.
Basically, what I mean is if you have an object named "This1" with the alias "This", and you have another object "This2" with the same alias "This", can you make the inventory, instead of saying "This" and "This", say "This (2)"?
I thought about just making this into a status attribute, but if I decide that I want more than just one stackable object, the status bar would be filled with "This: 3" "Something: 4" "Object: 2" along with everything else, including health, score, ammo, money, armor, etc...
The ways I've tried are:
[list][*]Dictionaries[/*:m]
[*]Lists[/*:m]
[*]Game attributes, which seems impossible unless this can be used:
[*]Player attributes (same as game)[/*:m][/list:u]
Basically, what I mean is if you have an object named "This1" with the alias "This", and you have another object "This2" with the same alias "This", can you make the inventory, instead of saying "This" and "This", say "This (2)"?
I thought about just making this into a status attribute, but if I decide that I want more than just one stackable object, the status bar would be filled with "This: 3" "Something: 4" "Object: 2" along with everything else, including health, score, ammo, money, armor, etc...
The ways I've tried are:
[list][*]Dictionaries[/*:m]
[*]Lists[/*:m]
[*]Game attributes, which seems impossible unless this can be used:
game. + object.alias = 1
<!--In other words, game.This = 1-->
[/*:m][*]Player attributes (same as game)[/*:m][/list:u]
HegemonKhan
03 Mar 2013, 02:17I don't think you can actually physically~digitally combine two objects, lol.
(Matter can't take up another matter's space)
So, you kinda have to use an attribute for creating a single quantity of a type of object. And you likely don't want to actually have physically 100 objects (like of "Potion1 = heals 50 HP") either.
------
as for how to do it, I'm not sure, as I haven't yet tried to do it myself (even though I think I said it would be fun and a good lesson in trying to do it for me ~ laziness, lol).
I'd guess you might do it maybe something like this (but I've no idea ~ just guessing):
foreach (example: scopeinventory)
if Has~Get (various ways: using name~alias_text, boolean or integer attributes, or object types)
add to object list (hopefully there's another way to do this... or your list is going to be really long, lol)
object list count
then set the object list count to the display: potion1 (99)
and, you'll need to do something about the objects themselves:
destroy~remove them, move them to a "junk pile" storage_object_with_null_parent, or move them back to their original locations.
--------
as for storage, I got it set up for (Pixe's) learned spells (I'll work on an equipment and item storage at some point), if you're interested in taking a look at it, let me know.
-----------
well...
you have to have:
potion1 (99)
potion2 (99)
potion3 (99)
etc
as how do you otherwise tell? potion1/2/3 (99/99/99) ??? (hmm... maybe this could be done lol)
or even worse... potion123/food123/shoes123 (99/99/99/50/50/50/2/2/2) .....
though, I'm sure you could also make it look like this too:
potion1 (99), potion2 (99), potion3 (99), and etc...
----------
also
Status Attribute isn't the only way to show something... lol
there's kinda the main (the text) game screen you can use...
I'm actually needing to do this myself, so this is just a very simple form, I will work on this, making it better, but not now, lol.
(Matter can't take up another matter's space)
So, you kinda have to use an attribute for creating a single quantity of a type of object. And you likely don't want to actually have physically 100 objects (like of "Potion1 = heals 50 HP") either.
------
as for how to do it, I'm not sure, as I haven't yet tried to do it myself (even though I think I said it would be fun and a good lesson in trying to do it for me ~ laziness, lol).
I'd guess you might do it maybe something like this (but I've no idea ~ just guessing):
foreach (example: scopeinventory)
if Has~Get (various ways: using name~alias_text, boolean or integer attributes, or object types)
add to object list (hopefully there's another way to do this... or your list is going to be really long, lol)
object list count
then set the object list count to the display: potion1 (99)
and, you'll need to do something about the objects themselves:
destroy~remove them, move them to a "junk pile" storage_object_with_null_parent, or move them back to their original locations.
--------
as for storage, I got it set up for (Pixe's) learned spells (I'll work on an equipment and item storage at some point), if you're interested in taking a look at it, let me know.
-----------
well...
you have to have:
potion1 (99)
potion2 (99)
potion3 (99)
etc
as how do you otherwise tell? potion1/2/3 (99/99/99) ??? (hmm... maybe this could be done lol)
or even worse... potion123/food123/shoes123 (99/99/99/50/50/50/2/2/2) .....
though, I'm sure you could also make it look like this too:
potion1 (99), potion2 (99), potion3 (99), and etc...
----------
also
Status Attribute isn't the only way to show something... lol
there's kinda the main (the text) game screen you can use...
I'm actually needing to do this myself, so this is just a very simple form, I will work on this, making it better, but not now, lol.
<command name="show_stats_command">
<pattern>stats<pattern>
<script>
ClearScreen
show_stats_function
wait {
ClearScreen
}
</script>
</command>
<function name="show_stats_function">
msg (game.pov.hp)
msg (game.pov.mp)
msg (game.pov.strength)
msg (game.pov.endurance)
etc...
</function>
[code]<command name="show_items_command">
<pattern>items<pattern>
<script>
ClearScreen
show_items_function
wait {
ClearScreen
}
</script>
</command>
<function name="show_items_function">
msg (item_storage.object1.quantity)
etc...
</function>
<command name="show_spells_command">
<pattern>spells<pattern>
<script>
ClearScreen
show_spells_function
wait {
ClearScreen
}
</script>
</command>
<function name="show_spells_function">
msg (err...not sure how to do this atm, lol)
</function>
TriangleGames
03 Mar 2013, 03:34I haven't worked out all the kinks yet, but here's what I'm looking at doing for this if/when I need to.
1. Make a "storage" version of the object (let's call it quiver)
2. Give it two attributes, quantity as an integer and unit as a string
3. Set the attributes to whatever is appropriate (lets say, 12 and arrows
3. Make the object's initial take script set up the object's listalias attribute like so:
listalias = "quiver: " + quiver.quantity + quiver.unit
4. Set up a function to handle reducing quantity when the object is used (it should also check to make sure supply is sufficient)
5. Set up the objects use (or other verb, such as "shoot") with an IF statement that calls the function
this will allow the function to check supplies and handle updating the quantity of any such objects in your game, while using the IF statement to handle the effects of the individual object
That's as far as I've gotten. The problem at this point is, dealing with additional pick-up items that increase the quantity. I'm thinking it will involve either (A) having the pick-up item always add the same amount, or (B) having a re-usable variable name that you set in the take script of the object. I have to think about that part a little more.
What I have working right now is just a roll of duct tape. It uses the function I wrote effectively, but it doesn't ever need to add more to the quantity. You can check it out in this little game I've been using for experiments like this. The tape is on the shelves. You can just "use" the duct tape. (Note also that both "duck tape" and "duct tape" will work. It is in fact "Duck Tape Brand" duct tape.)
1. Make a "storage" version of the object (let's call it quiver)
2. Give it two attributes, quantity as an integer and unit as a string
3. Set the attributes to whatever is appropriate (lets say, 12 and arrows
3. Make the object's initial take script set up the object's listalias attribute like so:
listalias = "quiver: " + quiver.quantity + quiver.unit
4. Set up a function to handle reducing quantity when the object is used (it should also check to make sure supply is sufficient)
5. Set up the objects use (or other verb, such as "shoot") with an IF statement that calls the function
this will allow the function to check supplies and handle updating the quantity of any such objects in your game, while using the IF statement to handle the effects of the individual object
That's as far as I've gotten. The problem at this point is, dealing with additional pick-up items that increase the quantity. I'm thinking it will involve either (A) having the pick-up item always add the same amount, or (B) having a re-usable variable name that you set in the take script of the object. I have to think about that part a little more.
What I have working right now is just a roll of duct tape. It uses the function I wrote effectively, but it doesn't ever need to add more to the quantity. You can check it out in this little game I've been using for experiments like this. The tape is on the shelves. You can just "use" the duct tape. (Note also that both "duck tape" and "duct tape" will work. It is in fact "Duck Tape Brand" duct tape.)
Sora574
03 Mar 2013, 03:57Thanks for the help, but...
The main problem is the part where you would have to remove certain objects. After you remove them, you can't get them back. Of course, this could work easily with something like a potion or some kind of arrow system, but what I'm talking about is the possibility of picking an object up, let's say an apple, then picking another one up, making the inventory say apple (2), and also being able to drop them, and then pick them back up.
Also, another problem is adding a bunch of objects to a list. For that, the list would have to have a specific name, like apple_list. Then I would have to add every single apple in the game to the list as I pick them up, and make every other apple linked to each other in order to be able to drop anything. Example:
(I'm on my tablet right now so I don't even know if that would work...)
This would take a very long time, not to mention then having to also code for every. Single. Other. Apple. Especially if you want more than just 3 apples.
Maybe there's an easier way though...
The main problem is the part where you would have to remove certain objects. After you remove them, you can't get them back. Of course, this could work easily with something like a potion or some kind of arrow system, but what I'm talking about is the possibility of picking an object up, let's say an apple, then picking another one up, making the inventory say apple (2), and also being able to drop them, and then pick them back up.
Also, another problem is adding a bunch of objects to a list. For that, the list would have to have a specific name, like apple_list. Then I would have to add every single apple in the game to the list as I pick them up, and make every other apple linked to each other in order to be able to drop anything. Example:
<!--Apple1 on take-->
if (ListCount(apple_list) > 0) {
if (ListCount(apple_list) = 1) {
this.issecondonlist = true
}
if (ListCount(apple_list) = 2) {
this.isthirdonlist = true
}
list add (apple_list, this)
if (apple2.isfirstonlist) {
apple2.alias = apple2.originalalias + ListCount(apple_list)
}
else if (apple3.isfirstonlist) {
apple3.alias = apple3.originalalias + ListCount(apple_list)
}
MakeObjectInvisible (this)
}
else {
this.isfirstonlist = true
this.originalalias = this.alias
this.alias = this.alias + ListCount(apple_list)
}
<!--Then, here's a drop script for Apple1-->
if (this.isfirstonlist) {
this.isfirstonlist = false
list remove (apple_list, this)
if (apple2.issecondonlist) {
MakeObjectVisible (apple2)
apple2.alias = apple2.originalalias + ListCount(apple_list)
apple2.issecondonlist = false
apple2.isfirstonlist = true
}
else if (apple3.issecondonlist) {
MakeObjectVisible (apple3)
apple3.alias = apple3.originalalias + ListCount(apple_list)
apple3.issecondonlist = false
apple3.isfirstonlist = true
}
this.alias = this.originalalias
}
else if (this.issecondonlist) {
<!--More stuff (saving time by not writing it)-->
}
else if (this.isthirdonlist) {
<!--Even more stuff->
}
<!--Plus every other apple-->
(I'm on my tablet right now so I don't even know if that would work...)
This would take a very long time, not to mention then having to also code for every. Single. Other. Apple. Especially if you want more than just 3 apples.
Maybe there's an easier way though...
Sora574
03 Mar 2013, 06:03Attached is an example of what I was talking about above (I finally got to my computer)
First of all, I think it only works in 5.4 beta. You could try changing the asl version from <asl version="540"> to <asl version="530"> though.
Second, although it technically 'works', the dropping is a pain, because you have to click the inventory and use the 'drop' button. Then, it says 'drop apple (2)' instead of just 'drop apple' as a command.
Also, look at the scripting itself. That took a great deal of time just for 3 apples. If there's not an easier way, someone needs to make one.
First of all, I think it only works in 5.4 beta. You could try changing the asl version from <asl version="540"> to <asl version="530"> though.
Second, although it technically 'works', the dropping is a pain, because you have to click the inventory and use the 'drop' button. Then, it says 'drop apple (2)' instead of just 'drop apple' as a command.
Also, look at the scripting itself. That took a great deal of time just for 3 apples. If there's not an easier way, someone needs to make one.
HegemonKhan
03 Mar 2013, 08:49I don't exactly fully understand your coding (nothing on your part, I'm just a noob, so I'm having a bit of trouble following along with your item iteration layers, I haven't really learned this aspect of coding yet very well), nor do I still exactly understand what you're trying to achieve or in how you want to achieve it, but it seems like you're tackling your goals in the wrong way or method.
the "display amount" [Red_Apples (99), Green_Apples (99), etc) and the objects themselves, are two separate entities, so I think you're over complicated it in this regard. Move your objects to a storage object, and also then just adjust your display amounts (see my code below, I think I've got the right~good ideas on doing this). Or do it however you want, but work with each (the objects and the display amounts) separately, and then just connect them (e.i. = whatever you do with your objects, then simply have the display amount adjust to it).
------------
I really think my coding methods below (if, I or you or whoever, can get them to work, lol) solves all of your problems and what you want to achieve. Though, I'm still no entirely sure what it is you want and~or what are your goals or the means of getting those goals that you want, meh. So, maybe my coding stuff isn't what you want, heh. I tried, at least.
Unfortunately, I can't yet test if this works, as I got some trouble shooting problems (at least with) my "storage_function" script block (grr), and so if anyone wants to figure out what is wrong with it, I'd be thankful, as then I can see (and if hopefully there's no more trouble shooting problems after this, lol) if this coding of mine would work or not. But, anyways, here is my coding, Sora, maybe it'll be enough to help you (if it can do so), even though I got some trouble shooting problems with it, as maybe you can take these ideas, and plug it into your own coding (which you can probably do without any trouble shooting errors, lol. Sighs, I'm still a noob, can't write coding without errors, and it's still hard for me to figure out what the errors are, as I don't know coding well enough to know what I have exactly wrong immediately, either). So, I haven't yet completed my code, as I want to check it thus far, though, I'm sure the rest of the code, you can already do yourself, if this code of mine works, as what is left isn't too difficult, I don't think. Well, if the display amount isn't quite finished yet, that isn't too hard to do ~ get completed, though for me, figuring out how to do the "withdraw" function will be difficult, as to how to get it to select the spefic item you want to move from the storage to your inventory, lol.
If someone could find~fix the trouble shooting problem part of my code, I'd be really thankful, as I'd like to keep working on this code (if I don't have more trouble shooting problems, that is, lol), to see if I can get it to work for Sora, hehe
so, here's my code of my attempt at trying to code this stuff you want myself for you, lol:
here's some useful codes:
http://quest5.net/wiki/Contains
http://quest5.net/wiki/ListCount
http://quest5.net/wiki/ListContains
http://quest5.net/wiki/DictionaryCount
http://quest5.net/wiki/DictionaryContains
http://quest5.net/wiki/Foreach
http://quest5.net/wiki/For
and maybe the main code that you might need:
(it returns~creates an object list of all child items within a parent item!)
http://quest5.net/wiki/GetAllChildObjects
~OR~
http://quest5.net/wiki/GetDirectChildren
(one sec)
ooo, this one seems really useful too:
http://quest5.net/wiki/FormatObjectList
I hope something here helps you!
the "display amount" [Red_Apples (99), Green_Apples (99), etc) and the objects themselves, are two separate entities, so I think you're over complicated it in this regard. Move your objects to a storage object, and also then just adjust your display amounts (see my code below, I think I've got the right~good ideas on doing this). Or do it however you want, but work with each (the objects and the display amounts) separately, and then just connect them (e.i. = whatever you do with your objects, then simply have the display amount adjust to it).
------------
I really think my coding methods below (if, I or you or whoever, can get them to work, lol) solves all of your problems and what you want to achieve. Though, I'm still no entirely sure what it is you want and~or what are your goals or the means of getting those goals that you want, meh. So, maybe my coding stuff isn't what you want, heh. I tried, at least.
Unfortunately, I can't yet test if this works, as I got some trouble shooting problems (at least with) my "storage_function" script block (grr), and so if anyone wants to figure out what is wrong with it, I'd be thankful, as then I can see (and if hopefully there's no more trouble shooting problems after this, lol) if this coding of mine would work or not. But, anyways, here is my coding, Sora, maybe it'll be enough to help you (if it can do so), even though I got some trouble shooting problems with it, as maybe you can take these ideas, and plug it into your own coding (which you can probably do without any trouble shooting errors, lol. Sighs, I'm still a noob, can't write coding without errors, and it's still hard for me to figure out what the errors are, as I don't know coding well enough to know what I have exactly wrong immediately, either). So, I haven't yet completed my code, as I want to check it thus far, though, I'm sure the rest of the code, you can already do yourself, if this code of mine works, as what is left isn't too difficult, I don't think. Well, if the display amount isn't quite finished yet, that isn't too hard to do ~ get completed, though for me, figuring out how to do the "withdraw" function will be difficult, as to how to get it to select the spefic item you want to move from the storage to your inventory, lol.
If someone could find~fix the trouble shooting problem part of my code, I'd be really thankful, as I'd like to keep working on this code (if I don't have more trouble shooting problems, that is, lol), to see if I can get it to work for Sora, hehe

so, here's my code of my attempt at trying to code this stuff you want myself for you, lol:
<asl version="530">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<pov type="object">player</pov>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<experience type="int">0</experience>
<level type="int">0</level>
<strength type="int">0</strength>
<statusattributes type="stringdictionary">level = ;experience = ;strength =</statusattributes>
</object>
<object name="experience_potion_100">
<inherit name="editor_object" />
<alias>potion100</alias>
<potion type="boolean">true</potion>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
drink_experience_potion_100_function
</drink>
</object>
<object name="experience_potion_300">
<inherit name="editor_object" />
<alias>potion300</alias>
<potion type="boolean">true</potion>
<quality_type type="int">300</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
drink_experience_potion_300_function
</drink>
</object>
<object name="strength_elixir_100">
<inherit name="editor_object" />
<alias>elixir100</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
drink_strength_elixir_100_function
</drink>
</object>
<object name="strength_elixir_300">
<inherit name="editor_object" />
<alias>elixir300</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">300</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
drink_strength_elixir_300_function
</drink>
</object>
</object>
<turnscript name="game_turns_turnscript">
<enabled />
<script>
level_up_function
game_turns_function
</script>
</turnscript>
<command name="items_command">
<pattern>items</pattern>
<script>
items_function
</script>
</command>
<command name="storage_command">
<pattern>storage</pattern>
<script>
storage_function
</script>
</command>
<command name="restore_items_command">
<pattern>restore</pattern>
<script>
restore_items_function
</script>
</command>
<function name="items_function">
ClearScreen
msg ("potion100 ( " + ListCount (GetDirectChildren (potion_100_storage)) + ")")
msg ("potion300 ( " + ListCount (GetDirectChildren (potion_300_storage)) + ")")
msg ("elixir100 ( " + ListCount (GetDirectChildren (elixir_100_storage)) + ")")
msg ("elixir300 ( " + ListCount (GetDirectChildren (elixir_300_storage)) + ")")
wait {
ClearScreen
}
</function>
<function name="restore_items_function">
foreach (obj,GetDirectChildren (item_game_storage)) {
MoveObject (obj,room)
}
</function>
<function name="storage_function"><![CDATA[
show menu ("What do you want to do?",split("deposit;withdraw",";"),true) {
switch (result) {
case ("deposit") {
foreach (obj,ScopeInventory ()) {
if (GetBoolean (obj,"potion") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (potion_100_storage.capacity < 9) {
if (potion_100_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj,potion_100_storage)
potion_100_storage.capacity = potion_100_storage.capacity + GetAttribute (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your potion 100 storage for the potion you want to store.")
}
} else if (potion_100_storage.capacity = 9) {
msg ("Your potion 100 storage is already full.")
}
} else if (GetInt (obj,"quality_type") = 300) {
if (potion__300_storage.capacity < 9) {
if (potion_300_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj,potion_300_storage)
potion_300_storage.capacity = potion_300_storage.capacity + GetAttribute (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your potion 300 storage for the potion you want to store.")
}
} else if (potion_storage.capacity = 9) {
msg ("Your potion storage is already full.")
}
} else if (GetBoolean (obj,"elixir") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (elixir_100_storage.capacity < 9) {
if (elixir_100_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj,elixir_100_storage)
elixir_100_storage.capacity = elixir_100_storage.capacity + GetAttribute (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your elixir 100 storage for the elixir that you want to deposit.")
}
} else if (elixir_storage.capacity = 9) {
msg ("Your elixir storage is already full.")
}
} else if (GetInt (obj,"quality_type") = 300) {
if (elixir_300_storage.capacity < 9) {
if (elixir_300_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj,elixir_300_storage)
elixir_300_storage.capacity = elixir_300_storage.capacity + GetAttribute (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your elixir 300 storage for the elixir that you want to deposit.")
}
} else if (elixir_300_storage.capacity = 9) {
msg ("Your elixir 300 storage is already full.")
}
}
} else {
msg ("This object can't be stored.")
}
}
}
case ("withdraw") {
show menu ("What do you want to do?", split ("potion;elixir",";"),true) {
switch (result) {
case ("potion") {
msg (inclompleted)
}
case ("elixir") {
msg (incompleted)
}
}
}
}
}
}
]]></function>
<function name="drink_experience_potion_100_function">
game.pov.experience = game.pov.experience + 100
MoveObject (experience_potion_100,item_game_storage)
</function>
<function name="drink_experience_potion_300_function">
game.pov.experience = game.pov.experience + 300
MoveObject (experience_potion_300,item_game_storage)
</function>
<function name="drink_strength_elixir_100_function">
game.pov.strength = game.pov.strength + 300
MoveObject (strength_elixir_100,item_game_storage)
</function>
<function name="drink_strength_elixir_300_function">
game.pov.strength = game.pov.strength + 300
MoveObject (strength_elixir_300,item_game_storage)
</function>
<function name="game_turns_function">
game.pov.turns = game.pov.turns + 1
</function>
<function name="level_increase_function">
game.pov.level = game.pov.level + 1
</function>
<function name="level_experience_overflow_function">
game.pov.experience = game.pov.experience - (game.pov.level * 100 + 100)
</function>
<function name="level_up_function"><![CDATA[
if (game.pov.experience >= game.pov.level * 100 + 100) {
level_experience_overflow_function
level_increase_function
level_up_function
}
]]></function>
<object name="item_player_storage">
<parent>null</parent>
<inherit name="editor_object" />
<object name="potion_storage">
<inherit name="editor_object" />
<object name="potion_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="potion_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
<object name="elixir_storage">
<inherit name="editor_object" />
<object name="elixir_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="elixir_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
</object>
<object name="item_game_storage">
<inherit name="editor_object" />
<parent>null</parent>
</object>
</asl>
here's some useful codes:
http://quest5.net/wiki/Contains
http://quest5.net/wiki/ListCount
http://quest5.net/wiki/ListContains
http://quest5.net/wiki/DictionaryCount
http://quest5.net/wiki/DictionaryContains
http://quest5.net/wiki/Foreach
http://quest5.net/wiki/For
and maybe the main code that you might need:
(it returns~creates an object list of all child items within a parent item!)
http://quest5.net/wiki/GetAllChildObjects
~OR~
http://quest5.net/wiki/GetDirectChildren
(one sec)
ooo, this one seems really useful too:
http://quest5.net/wiki/FormatObjectList
I hope something here helps you!
Sora574
03 Mar 2013, 20:04I fixed the storage_function problem (all you needed was to insert a } at the end of the function script), but all of your statusattributes were set wrong. You tried to attach them to the game, while the player had nothing. But then, you tried to add and subtract player attributes. I fixed, for the most part, all the problems except for the potions not correctly adding to the statuses correctly (I think it might be wrong? You can change it yourself if it is) Here's what I ended up with:
However, this isn't what I'm looking for. Maybe you did something wrong somewhere, but taking the potions doesn't add to the number of potions you have. All it does is give you the object 'potion100' or 'potion300' and then when you drink it, it adds to the status attribute and takes away the object...
That's not what I want.
Like I said before, I want something like the apples.
I don't want a storage object that holds a bunch of objects, I want a bunch of objects that are in different locations.
For example, 1 brick in a room, another brick in a different room, 2 bricks in another room (not in a pile that you pick up...)... does that make sense?
I changed this code to 5.3 (not sure if it works correctly though) try it out and see if anyone can make it simpler:
<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<pov type="object">player</pov>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<experience type="int">0</experience>
<level type="int">0</level>
<strength type="int">0</strength>
<statusattributes type="stringdictionary">
<item>
<key>experience</key>
<value></value>
</item>
<item>
<key>level</key>
<value></value>
</item>
<item>
<key>strength</key>
<value></value>
</item>
<item>
<key>turns</key>
<value></value>
</item>
</statusattributes>
<turns type="int">0</turns>
</object>
<object name="experience_potion_100">
<inherit name="editor_object" />
<alias>potion100</alias>
<potion />
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
<value>Drink</value>
</displayverbs>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Drink</value>
</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
drink_experience_potion_100_function
</drink>
</object>
<object name="experience_potion_300">
<inherit name="editor_object" />
<alias>potion300</alias>
<potion />
<quality_type type="int">300</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
<value>Drink</value>
</displayverbs>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Drink</value>
</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
drink_experience_potion_300_function
</drink>
</object>
<object name="strength_elixir_100">
<inherit name="editor_object" />
<alias>elixir100</alias>
<elixir />
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
<value>Drink</value>
</displayverbs>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Drink</value>
</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
drink_strength_elixir_100_function
</drink>
</object>
<object name="strength_elixir_300">
<inherit name="editor_object" />
<alias>elixir300</alias>
<elixir />
<quality_type type="int">300</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
<value>Drink</value>
</displayverbs>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Drink</value>
</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
drink_strength_elixir_300_function
</drink>
</object>
</object>
<turnscript name="game_turns_turnscript">
<enabled />
<script>
level_up_function
game_turns_function
</script>
</turnscript>
<command name="items_command">
<pattern>items</pattern>
<script>
items_function
</script>
</command>
<command name="storage_command">
<pattern>storage</pattern>
<script>
storage_function
</script>
</command>
<command name="restore_items_command">
<pattern>restore</pattern>
<script>
restore_items_function
</script>
</command>
<object name="item_player_storage">
<inherit name="editor_object" />
<object name="potion_storage">
<inherit name="editor_object" />
<object name="potion_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="potion_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
<object name="elixir_storage">
<inherit name="editor_object" />
<object name="elixir_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="elixir_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
</object>
<object name="item_game_storage">
<inherit name="editor_object" />
</object>
<function name="items_function">
ClearScreen
msg ("potion100 ( " + ListCount (GetDirectChildren (potion_100_storage)) + ")")
msg ("potion300 ( " + ListCount (GetDirectChildren (potion_300_storage)) + ")")
msg ("elixir100 ( " + ListCount (GetDirectChildren (elixir_100_storage)) + ")")
msg ("elixir300 ( " + ListCount (GetDirectChildren (elixir_300_storage)) + ")")
wait {
ClearScreen
}
</function>
<function name="restore_items_function">
foreach (obj, GetDirectChildren (item_game_storage)) {
MoveObject (obj, room)
}
</function>
<function name="storage_function"><![CDATA[
show menu ("What do you want to do?", split("deposit;withdraw",";"), true) {
switch (result) {
case ("deposit") {
foreach (obj, ScopeInventory ()) {
if (GetBoolean (obj,"potion") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (potion_100_storage.capacity < 9) {
if (potion_100_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj, potion_100_storage)
potion_100_storage.capacity = potion_100_storage.capacity + GetAttribute (obj,"capacity")
}
else {
msg ("There is not enough capacity remaining in your potion 100 storage for the potion you want to store.")
}
}
else if (potion_100_storage.capacity = 9) {
msg ("Your potion 100 storage is already full.")
}
}
else if (GetInt (obj,"quality_type") = 300) {
if (potion__300_storage.capacity < 9) {
if (potion_300_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj, potion_300_storage)
potion_300_storage.capacity = potion_300_storage.capacity + GetAttribute (obj,"capacity")
}
else {
msg ("There is not enough capacity remaining in your potion 300 storage for the potion you want to store.")
}
}
else if (potion_storage.capacity = 9) {
msg ("Your potion storage is already full.")
}
}
else if (GetBoolean (obj,"elixir") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (elixir_100_storage.capacity < 9) {
if (elixir_100_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj, elixir_100_storage)
elixir_100_storage.capacity = elixir_100_storage.capacity + GetAttribute (obj,"capacity")
}
else {
msg ("There is not enough capacity remaining in your elixir 100 storage for the elixir that you want to deposit.")
}
}
else if (elixir_storage.capacity = 9) {
msg ("Your elixir storage is already full.")
}
}
else if (GetInt (obj,"quality_type") = 300) {
if (elixir_300_storage.capacity < 9) {
if (elixir_300_storage.capacity + GetAttribute (obj,"capacity") < 9) {
MoveObject (obj, elixir_300_storage)
elixir_300_storage.capacity = elixir_300_storage.capacity + GetAttribute (obj,"capacity")
}
else {
msg ("There is not enough capacity remaining in your elixir 300 storage for the elixir that you want to deposit.")
}
}
else if (elixir_300_storage.capacity = 9) {
msg ("Your elixir 300 storage is already full.")
}
}
}
else {
msg ("This object can't be stored.")
}
}
}
case ("withdraw") {
show menu ("What do you want to do?", split ("potion;elixir",";"), true) {
switch (result) {
case ("potion") {
msg (inclompleted)
}
case ("elixir") {
msg (incompleted)
}
}
}
}
}
}
}
]]></function>
<function name="drink_experience_potion_100_function">
game.pov.experience = game.pov.experience + 100
MoveObject (experience_potion_100, item_game_storage)
</function>
<function name="drink_experience_potion_300_function">
game.pov.experience = game.pov.experience + 300
MoveObject (experience_potion_300, item_game_storage)
</function>
<function name="drink_strength_elixir_100_function">
game.pov.strength = game.pov.strength + 300
MoveObject (strength_elixir_100, item_game_storage)
</function>
<function name="drink_strength_elixir_300_function">
game.pov.strength = game.pov.strength + 300
MoveObject (strength_elixir_300, item_game_storage)
</function>
<function name="game_turns_function">
game.pov.turns = game.pov.turns + 1
</function>
<function name="level_increase_function">
game.pov.level = game.pov.level + 1
</function>
<function name="level_experience_overflow_function">
game.pov.experience = game.pov.experience - (game.pov.level * 100 + 100)
</function>
<function name="level_up_function"><![CDATA[
if (game.pov.experience >= game.pov.level * 100 + 100) {
level_experience_overflow_function
level_increase_function
level_up_function
}
]]></function>
</asl>
However, this isn't what I'm looking for. Maybe you did something wrong somewhere, but taking the potions doesn't add to the number of potions you have. All it does is give you the object 'potion100' or 'potion300' and then when you drink it, it adds to the status attribute and takes away the object...
That's not what I want.
Like I said before, I want something like the apples.
I don't want a storage object that holds a bunch of objects, I want a bunch of objects that are in different locations.
For example, 1 brick in a room, another brick in a different room, 2 bricks in another room (not in a pile that you pick up...)... does that make sense?
I changed this code to 5.3 (not sure if it works correctly though) try it out and see if anyone can make it simpler:
<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Stacking Test">
<gameid>83fe6da1-7c90-4891-a686-b1475cef702d</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<showhealth type="boolean">false</showhealth>
<start type="script">
game.apple_list = NewObjectList()
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="apple1">
<inherit name="editor_object" />
<take />
<alias>apple</alias>
<isfirstonlist type="boolean">false</isfirstonlist>
<issecondonlist type="boolean">false</issecondonlist>
<isthirdonlist type="boolean">false</isthirdonlist>
<ontake type="script"><![CDATA[
if (ListCount(game.apple_list) > 0) {
if (ListCount(game.apple_list) = 1) {
this.issecondonlist = true
}
if (ListCount(game.apple_list) = 2) {
this.isthirdonlist = true
}
list add (game.apple_list, this)
if (apple2.isfirstonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
}
else if (apple3.isfirstonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
}
MakeObjectInvisible (this)
}
else {
list add (game.apple_list, this)
this.isfirstonlist = true
this.alias = this.originalalias + " (" + ListCount(game.apple_list) + ")"
}
]]></ontake>
<ondrop type="script">
this.alias = this.originalalias
if (this.isfirstonlist) {
this.isfirstonlist = false
list remove (game.apple_list, this)
if (apple2.issecondonlist) {
MakeObjectVisible (apple2)
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
apple2.issecondonlist = false
apple2.isfirstonlist = true
if (apple3.isthirdonlist) {
apple3.isthirdonlist = false
apple3.issecondonlist = true
}
}
else if (apple3.issecondonlist) {
MakeObjectVisible (apple3)
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
apple3.issecondonlist = false
apple3.isfirstonlist = true
if (apple2.isthirdonlist) {
apple2.isthirdonlist = false
apple2.issecondonlist = true
}
}
}
else if (this.issecondonlist) {
this.issecondonlist = false
list remove (game.apple_list, this)
if (apple2.isthirdonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
apple2.isthirdonlist = false
apple2.issecondonlist = true
}
else if (apple3.isthirdonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
apple3.isthirdonlist = false
apple3.issecondonlist = true
}
}
else if (this.isthirdonlist) {
this.isthirdonlist = false
list remove (game.apple_list, this)
if (apple2.isfirstonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
}
if (apple3.isfirstonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
}
}
</ondrop>
<originalalias>apple</originalalias>
</object>
<object name="apple2">
<inherit name="editor_object" />
<take />
<alias>apple</alias>
<isfirstonlist type="boolean">false</isfirstonlist>
<issecondonlist type="boolean">false</issecondonlist>
<isthirdonlist type="boolean">false</isthirdonlist>
<ontake type="script"><![CDATA[
if (ListCount(game.apple_list) > 0) {
if (ListCount(game.apple_list) = 1) {
this.issecondonlist = true
}
if (ListCount(game.apple_list) = 2) {
this.isthirdonlist = true
}
list add (game.apple_list, this)
if (apple1.isfirstonlist) {
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
}
else if (apple3.isfirstonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
}
MakeObjectInvisible (this)
}
else {
list add (game.apple_list, this)
this.isfirstonlist = true
this.alias = this.originalalias + " (" + ListCount(game.apple_list) + ")"
}
]]></ontake>
<ondrop type="script">
this.alias = this.originalalias
if (this.isfirstonlist) {
this.isfirstonlist = false
list remove (game.apple_list, this)
if (apple1.issecondonlist) {
MakeObjectVisible (apple1)
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
apple1.issecondonlist = false
apple1.isfirstonlist = true
if (apple3.isthirdonlist) {
apple3.isthirdonlist = false
apple3.issecondonlist = true
}
}
else if (apple3.issecondonlist) {
MakeObjectVisible (apple3)
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
apple3.issecondonlist = false
apple3.isfirstonlist = true
if (apple1.isthirdonlist) {
apple1.isthirdonlist = false
apple1.issecondonlist = true
}
}
}
else if (this.issecondonlist) {
this.issecondonlist = false
list remove (game.apple_list, this)
if (apple1.isthirdonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
apple1.isthirdonlist = false
apple1.issecondonlist = true
}
else if (apple3.isthirdonlist) {
apple1.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
apple3.isthirdonlist = false
apple3.issecondonlist = true
}
}
else if (this.isthirdonlist) {
this.isthirdonlist = false
list remove (game.apple_list, this)
if (apple1.isfirstonlist) {
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
}
if (apple3.isfirstonlist) {
apple3.alias = apple3.originalalias + " (" + ListCount(game.apple_list) + ")"
}
}
</ondrop>
<originalalias>apple</originalalias>
</object>
<object name="apple3">
<inherit name="editor_object" />
<take />
<alias>apple</alias>
<isfirstonlist type="boolean">false</isfirstonlist>
<issecondonlist type="boolean">false</issecondonlist>
<isthirdonlist type="boolean">false</isthirdonlist>
<ontake type="script"><![CDATA[
if (ListCount(game.apple_list) > 0) {
if (ListCount(game.apple_list) = 1) {
this.issecondonlist = true
}
if (ListCount(game.apple_list) = 2) {
this.isthirdonlist = true
}
list add (game.apple_list, this)
if (apple1.isfirstonlist) {
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
}
else if (apple2.isfirstonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
}
MakeObjectInvisible (this)
}
else {
list add (game.apple_list, this)
this.isfirstonlist = true
this.alias = this.originalalias + " (" + ListCount(game.apple_list) + ")"
}
]]></ontake>
<ondrop type="script">
this.alias = this.originalalias
if (this.isfirstonlist) {
this.isfirstonlist = false
list remove (game.apple_list, this)
if (apple1.issecondonlist) {
MakeObjectVisible (apple1)
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
apple1.issecondonlist = false
apple1.isfirstonlist = true
if (apple2.isthirdonlist) {
apple2.isthirdonlist = false
apple2.issecondonlist = true
}
}
else if (apple2.issecondonlist) {
MakeObjectVisible (apple2)
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
apple2.issecondonlist = false
apple2.isfirstonlist = true
if (apple1.isthirdonlist) {
apple1.isthirdonlist = false
apple1.issecondonlist = true
}
}
}
else if (this.issecondonlist) {
this.issecondonlist = false
list remove (game.apple_list, this)
if (apple1.isthirdonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
apple1.isthirdonlist = false
apple1.issecondonlist = true
}
else if (apple2.isthirdonlist) {
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
apple2.isthirdonlist = false
apple2.issecondonlist = true
}
}
else if (this.isthirdonlist) {
this.isthirdonlist = false
list remove (game.apple_list, this)
if (apple1.isfirstonlist) {
apple1.alias = apple1.originalalias + " (" + ListCount(game.apple_list) + ")"
}
if (apple2.isfirstonlist) {
apple2.alias = apple2.originalalias + " (" + ListCount(game.apple_list) + ")"
}
}
</ondrop>
<originalalias>apple</originalalias>
</object>
</object>
</asl>
HegemonKhan
03 Mar 2013, 20:55thanks, for helping to find my problem, and the additional problems I had too, though now that I have the script block done, thanks to you, I can probably have dealt with my other problems (having a problem with a script block is annoying, as it isn't easy to find the problem, as the error doesn't narrow it down for you, as it's often off-screen for me, and I can't move around the box as it is too long, lol). Though it makes me mad, a simple missing { or } ... that kept my code block from working, lol
----------------
what~how would the coding (in general, non-quest, coding language) look like anyways for what you want to do? Can quest be able to do the type of coding you need, or not?
----------------
what~how would the coding (in general, non-quest, coding language) look like anyways for what you want to do? Can quest be able to do the type of coding you need, or not?
Sora574
03 Mar 2013, 21:11Yeah, sometimes it's super hard to remember putting the end } especially. I wish it would just automatically do it for you, but I doubt that's possible.
I don't know, actually. As I showed above, there's an extremely complicated way that I found but I think someone with more experience would have to modify the source code itself to implement an easier way...
As for what it would look like, I was thinking something along the lines of (and this is just words, not actual code, to make it the simplest possible way of explaining it)
HegemonKhan wrote:what~how would the coding (in general, non-quest, coding language) look like anyways for what you want to do? Can quest be able to do the type of coding you need, or not?
I don't know, actually. As I showed above, there's an extremely complicated way that I found but I think someone with more experience would have to modify the source code itself to implement an easier way...
As for what it would look like, I was thinking something along the lines of (and this is just words, not actual code, to make it the simplest possible way of explaining it)
if the player has an object with the alias 'apple', and the player picks up an object with the alias 'apple', make 'apple' and 'apple' show in the inventory as 'apples ( number of apples in inventory)
then, if you drop an apple, remove 1 apple from the inventory and add it to the room the player is currently in
HegemonKhan
04 Mar 2013, 16:59ya... I thought I had all the ending " } " 's that were needed, doh! It's a pain to find what the problem is, when it's an entire script block, and you can't see what the error is as it's off the screen. When I was working on my combat system function, I had errors with a script block with it too, pain in the arse, I had to cut piece by piece of it from the bottom up, pasting it, onto a notepad file, and then test the shortened script block, see if it works without errors, if it still has errors, check the shortened script block code, to see if I can see the error in it now, but if not, cut off another chunk of it from the bottom, paste over to the notepad, see if the shortened shortned script block works now, etc etc etc., then when done, I pasted back the chunks of it I pasted over into notepad, such a pain in the arse! And, usually the code works (which is my first concern, as I'm a noob, and am not positive if my coding will even work or not), but it's just some minor 1-3 typo or forgetting errors by me of a missing code character or whatever. On the one hand, it's a relief, to know that my code as a whole actually works, with only simple human error on my part, but on the another hand, it's annoying too, as for just a simple few errors, all that work to find it, GRR!
----------------
ah, that is very clear in what you want, hehe.
maybe, you could use the list iteration code stuff, so you don't literally have to add every line of code yourself, for each apple, added~removed to~from your "show display". Like how you can tell the cycling of a list to increase from the next item, I don't know how to explain this that well, hopefully you know what I'm talking about, as this is something that is next on my list of things to learn about (the use of lists, dictionaries, iteration, and etc), as this stuff is a major component of doing coding.
-------------
if you can't find a way to code it, do you really need to do it your way exactly?
As if you don't want to have your picked up apples all in your inventory as hidden (invisible), except for the one apple that is first on your list to be used or dropped, I don't see why you couldn't use my method. The storage system can be made either as a null parent object (which is what I had chosen to do) or you could make it in your inventory too (a single "storage book" which then has more "sub storage books", and etc etc. for example:
game.pov.inventory
-> storage_object (immoveable closed container object), alias: storage
->-> item_storage
->->-> consumable_items
->->->-> apple_items
->-> equipment_storage
->->-> weapons
->->-> armors
->->-> clothing
->-> spell_storage
->->-> fire_spells
->-> etc etc
or as a null parent "object structure ~ Data Storage" type of object:
(the way I was doing the coding in my previous post)
<object name="storage_object">
-> <alias>storage</alias>
-> <parent>null</parent>
->-> item_storage
->->-> consumable_items
->->->-> apple_items
->-> equipment_storage
->->-> weapons
->->-> armors
->->-> clothing
->-> spell_storage
->->-> fire_spells
->-> etc etc
</object>
As I think the same effect can be achieved of the things you want, with my coding method. You can just as easily be able to drop the apples, and have it change your "show display", you'd just need the extra steps of moving back and forth from the storage to your inventory to the room~drop~take.
Because the only difference I can see with your method, is that it enables you to have all the apples remain in your inventory, as hidden apples, except for the one apple you want to use or drop. I wouldn't what the understand the reason for this would be though.
Unless, you can't connect the "show display" [ Apples (99) ] and~or as it being a status attribute (shown in the pane), but I'm sure you can connect it, I think... lol.
oooo....
I just re-read your post, so you want the inventory display itself to show the "show display" [ Apples (99) ], and not the status attribute pane to do so?
---------
let me get my coding working myself, if you want to use it, hopefully I can get it done by end of today (12 to 24 hrs), as I had not started to work on it yet. I should be able to get it working now that you got me past the script block error, heopfully, lol.
----------------
ah, that is very clear in what you want, hehe.
maybe, you could use the list iteration code stuff, so you don't literally have to add every line of code yourself, for each apple, added~removed to~from your "show display". Like how you can tell the cycling of a list to increase from the next item, I don't know how to explain this that well, hopefully you know what I'm talking about, as this is something that is next on my list of things to learn about (the use of lists, dictionaries, iteration, and etc), as this stuff is a major component of doing coding.
-------------
if you can't find a way to code it, do you really need to do it your way exactly?
As if you don't want to have your picked up apples all in your inventory as hidden (invisible), except for the one apple that is first on your list to be used or dropped, I don't see why you couldn't use my method. The storage system can be made either as a null parent object (which is what I had chosen to do) or you could make it in your inventory too (a single "storage book" which then has more "sub storage books", and etc etc. for example:
game.pov.inventory
-> storage_object (immoveable closed container object), alias: storage
->-> item_storage
->->-> consumable_items
->->->-> apple_items
->-> equipment_storage
->->-> weapons
->->-> armors
->->-> clothing
->-> spell_storage
->->-> fire_spells
->-> etc etc
or as a null parent "object structure ~ Data Storage" type of object:
(the way I was doing the coding in my previous post)
<object name="storage_object">
-> <alias>storage</alias>
-> <parent>null</parent>
->-> item_storage
->->-> consumable_items
->->->-> apple_items
->-> equipment_storage
->->-> weapons
->->-> armors
->->-> clothing
->-> spell_storage
->->-> fire_spells
->-> etc etc
</object>
As I think the same effect can be achieved of the things you want, with my coding method. You can just as easily be able to drop the apples, and have it change your "show display", you'd just need the extra steps of moving back and forth from the storage to your inventory to the room~drop~take.
Because the only difference I can see with your method, is that it enables you to have all the apples remain in your inventory, as hidden apples, except for the one apple you want to use or drop. I wouldn't what the understand the reason for this would be though.
Unless, you can't connect the "show display" [ Apples (99) ] and~or as it being a status attribute (shown in the pane), but I'm sure you can connect it, I think... lol.
oooo....
I just re-read your post, so you want the inventory display itself to show the "show display" [ Apples (99) ], and not the status attribute pane to do so?
---------
let me get my coding working myself, if you want to use it, hopefully I can get it done by end of today (12 to 24 hrs), as I had not started to work on it yet. I should be able to get it working now that you got me past the script block error, heopfully, lol.
HegemonKhan
04 Mar 2013, 21:21.
.
here is my working code:
(version 5.3 though, I don't wanna switch over to 5.4 yet as it is still beta and I'd have to learn 5.4 changes too, lol)
try it out, it's not the best coding, but it's functional, and it's "tweakable" too (ask me, and I can, well I should be able to, tweak it to your needs). It's only missing the code for depositing and withdrawing individual objects one at a time. Also, I have the storage as a null parent object with two commands to display the two types of quantities, but I can easily tweak it instead to have the storage objects be in your inventory with the status attribute displaying the two quantities in your status pane. I just did the former setup, as it doesn't clutter up your status pane nor your inventory pane.
Ask me, if you have any problems or questions, or if you need explanations of what I'm doing, or what is going on, in my code.
.
here is my working code:
(version 5.3 though, I don't wanna switch over to 5.4 yet as it is still beta and I'd have to learn 5.4 changes too, lol)
<asl version="530">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<pov type="object">player</pov>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
<start type="script">
msg ("Type in \"helpme\" for helpme command")
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<experience type="int">0</experience>
<level type="int">0</level>
<strength type="int">0</strength>
<statusattributes type="stringdictionary">level = ;experience = ;strength =</statusattributes>
</object>
<object name="experience_potion_100_1">
<inherit name="editor_object" />
<alias>potion1001</alias>
<potion type="boolean">true</potion>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
obj = experience_potion_100_1
drink_experience_potion_100_function (obj)
</drink>
</object>
<object name="experience_potion_300_1">
<inherit name="editor_object" />
<alias>potion3001</alias>
<potion type="boolean">true</potion>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
obj = experience_potion_300_1
drink_experience_potion_300_function (obj)
</drink>
</object>
<object name="strength_elixir_100_1">
<inherit name="editor_object" />
<alias>elixir1001</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
obj = strength_elixir_100_1
drink_strength_elixir_100_function (obj)
</drink>
</object>
<object name="strength_elixir_300_1">
<inherit name="editor_object" />
<alias>elixir3001</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
obj = strength_elixir_300_1
drink_strength_elixir_300_function (obj)
</drink>
</object>
<object name="experience_potion_100_2">
<inherit name="editor_object" />
<alias>potion1002</alias>
<potion type="boolean">true</potion>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
obj = experience_potion_100_2
drink_experience_potion_100_function (obj)
</drink>
</object>
<object name="experience_potion_300_2">
<inherit name="editor_object" />
<alias>potion3002</alias>
<potion type="boolean">true</potion>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
obj = experience_potion_300_2
drink_experience_potion_300_function (obj)
</drink>
</object>
<object name="strength_elixir_100_2">
<inherit name="editor_object" />
<alias>elixir1002</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
obj = strength_elixir_100_2
drink_strength_elixir_100_function (obj)
</drink>
</object>
<object name="strength_elixir_300_2">
<inherit name="editor_object" />
<alias>elixir3002</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
obj = strength_elixir_300_2
drink_strength_elixir_300_function (obj)
</drink>
</object>
<object name="experience_potion_100_3">
<inherit name="editor_object" />
<alias>potion1003</alias>
<potion type="boolean">true</potion>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
obj = experience_potion_100_3
drink_experience_potion_100_function (obj)
</drink>
</object>
<object name="experience_potion_300_3">
<inherit name="editor_object" />
<alias>potion3003</alias>
<potion type="boolean">true</potion>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
obj = experience_potion_300_3
drink_experience_potion_300_function (obj)
</drink>
</object>
<object name="strength_elixir_100_3">
<inherit name="editor_object" />
<alias>elixir1003</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
obj = strength_elixir_100_3
drink_strength_elixir_100_function (obj)
</drink>
</object>
<object name="strength_elixir_300_3">
<inherit name="editor_object" />
<alias>elixir3003</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
obj = strength_elixir_300_3
drink_strength_elixir_300_function (obj)
</drink>
</object>
<object name="experience_potion_100_4">
<inherit name="editor_object" />
<alias>potion1004</alias>
<potion type="boolean">true</potion>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
obj = experience_potion_100_4
drink_experience_potion_100_function (obj)
</drink>
</object>
<object name="experience_potion_300_4">
<inherit name="editor_object" />
<alias>potion3004</alias>
<potion type="boolean">true</potion>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
obj = experience_potion_300_4
drink_experience_potion_300_function (obj)
</drink>
</object>
<object name="strength_elixir_100_4">
<inherit name="editor_object" />
<alias>elixir1004</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">100</quality_type>
<capacity type="int">1</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 100 strength.")
obj = strength_elixir_100_4
drink_strength_elixir_100_function (obj)
</drink>
</object>
<object name="strength_elixir_300_4">
<inherit name="editor_object" />
<alias>elixir3004</alias>
<elixir type="boolean">true</elixir>
<quality_type type="int">300</quality_type>
<capacity type="int">3</capacity>
<take />
<drop />
<use />
<give />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the str elixir, receiving 300 strength.")
obj = strength_elixir_300_4
drink_strength_elixir_300_function (obj)
</drink>
</object>
</object>
<turnscript name="game_turns_turnscript">
<enabled />
<script>
level_up_function
game_turns_function
</script>
</turnscript>
<command name="help_me_command">
<pattern>helpme</pattern>
<script>
help_me_function
</script>
</command>
<command name="items_command">
<pattern>items</pattern>
<script>
items_function
</script>
</command>
<command name="storage_command">
<pattern>storage</pattern>
<script>
storage_function
</script>
</command>
<command name="restore_items_command">
<pattern>restore</pattern>
<script>
restore_items_function
</script>
</command>
<command name="take_all_command">
<pattern>takeall</pattern>
<script>
take_all_function
</script>
</command>
<command name="drop_all_command">
<pattern>dropall</pattern>
<script>
drop_all_function
</script>
</command>
<command name="capacity_command">
<pattern>capacity</pattern>
<script>
capacity_function
</script>
</command>
<function name="help_me_function">
msg ("Commands: takeall, dropall, storage, items, capacity, restore")
</function>
<function name="take_all_function">
foreach (obj,ScopeReachableNotHeld ()) {
MoveObject (obj,game.pov)
}
</function>
<function name="drop_all_function">
foreach (obj,ScopeInventory ()) {
MoveObject (obj,game.pov.parent)
}
</function>
<function name="items_function">
msg ("potion 100 (" + ListCount (GetDirectChildren (potion_100_storage)) + ")")
msg ("potion 300 (" + ListCount (GetDirectChildren (potion_300_storage)) + ")")
msg ("elixir 100 (" + ListCount (GetDirectChildren (elixir_100_storage)) + ")")
msg ("elixir 300 (" + ListCount (GetDirectChildren (elixir_300_storage)) + ")")
</function>
<function name="capacity_function">
msg ("potion 100 storage: " + potion_100_storage.capacity + " / 9")
msg ("potion 300 storage: " + potion_300_storage.capacity + " / 9")
msg ("elixir 100 storage: " + elixir_100_storage.capacity + " / 9")
msg ("elixir 300 storage: " + elixir_300_storage.capacity + " / 9")
</function>
<function name="restore_items_function">
foreach (obj,GetDirectChildren (item_game_storage)) {
MoveObject (obj,room)
}
</function>
<function name="storage_function"><![CDATA[
show menu ("What do you want to do?",split("deposit;withdraw",";"),true) {
switch (result) {
case ("deposit") {
foreach (obj,ScopeInventory ()) {
if (GetBoolean (obj,"potion") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (potion_100_storage.capacity < 9) {
if (GetInt (potion_100_storage,"capacity") + GetInt (obj,"capacity") <= 9) {
MoveObject (obj,potion_100_storage)
potion_100_storage.capacity = GetInt (potion_100_storage,"capacity") + GetInt (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your potion 100 storage for the potion you want to store.")
}
} else if (potion_100_storage.capacity = 9) {
msg ("Your potion 100 storage is already full.")
}
} else if (GetInt (obj,"quality_type") = 300) {
if (potion_300_storage.capacity < 9) {
if (GetInt (potion_300_storage,"capacity") + GetInt (obj,"capacity") <= 9) {
MoveObject (obj,potion_300_storage)
potion_300_storage.capacity = GetInt (potion_300_storage,"capacity") + GetInt (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your potion 300 storage for the potion you want to store.")
}
} else if (potion_300_storage.capacity = 9) {
msg ("Your potion storage is already full.")
}
}
} else if (GetBoolean (obj,"elixir") = true) {
if (GetInt (obj,"quality_type") = 100) {
if (elixir_100_storage.capacity < 9) {
if (GetInt (elixir_100_storage,"capacity") + GetInt (obj,"capacity") <= 9) {
MoveObject (obj,elixir_100_storage)
elixir_100_storage.capacity = GetInt (elixir_100_storage,"capacity") + GetInt (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your elixir 100 storage for the elixir that you want to deposit.")
}
} else if (elixir_100_storage.capacity = 9) {
msg ("Your elixir storage is already full.")
}
} else if (GetInt (obj,"quality_type") = 300) {
if (elixir_300_storage.capacity < 9) {
if (GetInt (elixir_300_storage,"capacity") + GetInt (obj,"capacity") <= 9) {
MoveObject (obj,elixir_300_storage)
elixir_300_storage.capacity = GetInt (elixir_300_storage,"capacity") + GetInt (obj,"capacity")
} else {
msg ("There is not enough capacity remaining in your elixir 300 storage for the elixir that you want to deposit.")
}
} else if (elixir_300_storage.capacity = 9) {
msg ("Your elixir 300 storage is already full.")
}
}
} else {
msg ("This object can't be stored.")
}
}
}
case ("withdraw") {
show menu ("What do you want to do?", split ("potion;elixir",";"),true) {
switch (result) {
case ("potion") {
show menu ("What do you want to do?", split ("100;300",";"),true) {
switch (result) {
case ("100") {
withdraw_potion_100
}
case ("300") {
withdraw_potion_300
}
}
}
}
case ("elixir") {
show menu ("What do you want to do?", split ("100;300",";"),true) {
switch (result) {
case ("100") {
withdraw_elixir_100
}
case ("300") {
withdraw_elixir_300
}
}
}
}
}
}
}
}
}
]]></function>
<function name="withdraw_potion_100">
foreach (obj,GetDirectChildren (potion_100_storage)) {
potion_100_storage.capacity = GetInt (potion_100_storage,"capacity") - GetInt (obj,"capacity")
MoveObject (obj,game.pov)
}
</function>
<function name="withdraw_elixir_100">
foreach (obj,GetDirectChildren (elixir_100_storage)) {
elixir_100_storage.capacity = GetInt (elixir_100_storage,"capacity") - GetInt (obj,"capacity")
MoveObject (obj,game.pov)
}
</function>
<function name="withdraw_potion_300">
foreach (obj,GetDirectChildren (potion_300_storage)) {
potion_300_storage.capacity = GetInt (potion_300_storage,"capacity") - GetInt (obj,"capacity")
MoveObject (obj,game.pov)
}
</function>
<function name="withdraw_elixir_300">
foreach (obj,GetDirectChildren (elixir_300_storage)) {
elixir_300_storage.capacity = GetInt (elixir_300_storage,"capacity") - GetInt (obj,"capacity")
MoveObject (obj,game.pov)
}
</function>
<function name="drink_experience_potion_100_function" parameters="obj">
game.pov.experience = game.pov.experience + 100
MoveObject (obj,item_game_storage)
</function>
<function name="drink_experience_potion_300_function" parameters="obj">
game.pov.experience = game.pov.experience + 300
MoveObject (obj,item_game_storage)
</function>
<function name="drink_strength_elixir_100_function" parameters="obj">
game.pov.strength = game.pov.strength + 100
MoveObject (obj,item_game_storage)
</function>
<function name="drink_strength_elixir_300_function" parameters="obj">
game.pov.strength = game.pov.strength + 300
MoveObject (obj,item_game_storage)
</function>
<function name="game_turns_function">
game.turns = game.turns + 1
</function>
<function name="level_increase_function">
game.pov.level = game.pov.level + 1
</function>
<function name="level_experience_overflow_function">
game.pov.experience = game.pov.experience - (game.pov.level * 100 + 100)
</function>
<function name="level_up_function"><![CDATA[
if (game.pov.experience >= game.pov.level * 100 + 100) {
level_experience_overflow_function
level_increase_function
level_up_function
}
]]></function>
<object name="item_player_storage">
<parent>null</parent>
<inherit name="editor_object" />
<object name="potion_storage">
<inherit name="editor_object" />
<object name="potion_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="potion_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
<object name="elixir_storage">
<inherit name="editor_object" />
<object name="elixir_100_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
<object name="elixir_300_storage">
<inherit name="editor_object" />
<capacity type="int">0</capacity>
</object>
</object>
</object>
<object name="item_game_storage">
<inherit name="editor_object" />
<parent>null</parent>
</object>
</asl>
try it out, it's not the best coding, but it's functional, and it's "tweakable" too (ask me, and I can, well I should be able to, tweak it to your needs). It's only missing the code for depositing and withdrawing individual objects one at a time. Also, I have the storage as a null parent object with two commands to display the two types of quantities, but I can easily tweak it instead to have the storage objects be in your inventory with the status attribute displaying the two quantities in your status pane. I just did the former setup, as it doesn't clutter up your status pane nor your inventory pane.
Ask me, if you have any problems or questions, or if you need explanations of what I'm doing, or what is going on, in my code.
Sora574
04 Mar 2013, 21:53Hmm...
I actually don't understand what you did.
Well, not really what, it's more like... Why?
It looks like you're using a 'storage' command to insert and withdraw objects from storage units. (?) This would come in handy for a bank (so don't throw out the coding -- you may be on to something) but I don't see why you wouldn't just make it automatic, for this purpose.
I also don't understand why all the potions and elixirs are numbered. (potion1001, potion3001, elixir1001, elixir3001...) Perhaps this is just saying the amount of strength or experience it gives you, followed by a number to distinguish them from each other?
Plus, the 'storage' command only seems to work if you have everything in your inventory, and then it makes storage objects (?) named 'potion3004' and 'elixir3004'... This isn't really 'stacking', it's more like pouring a bunch of drinks into the same cup -- which comes to another bug (?) you can drink the entire storage unit. But it only gives you 300 of whatever.
Did I miss something here?...
I actually don't understand what you did.
Well, not really what, it's more like... Why?
It looks like you're using a 'storage' command to insert and withdraw objects from storage units. (?) This would come in handy for a bank (so don't throw out the coding -- you may be on to something) but I don't see why you wouldn't just make it automatic, for this purpose.
I also don't understand why all the potions and elixirs are numbered. (potion1001, potion3001, elixir1001, elixir3001...) Perhaps this is just saying the amount of strength or experience it gives you, followed by a number to distinguish them from each other?
Plus, the 'storage' command only seems to work if you have everything in your inventory, and then it makes storage objects (?) named 'potion3004' and 'elixir3004'... This isn't really 'stacking', it's more like pouring a bunch of drinks into the same cup -- which comes to another bug (?) you can drink the entire storage unit. But it only gives you 300 of whatever.
Did I miss something here?...
HegemonKhan
04 Mar 2013, 22:43Sora574 wrote:Hmm...
I actually don't understand what you did.
Well, not really what, it's more like... Why?
It looks like you're using a 'storage' command to insert and withdraw objects from storage units. (?) This would come in handy for a bank (so don't throw out the coding -- you may be on to something) but I don't see why you wouldn't just make it automatic, for this purpose.
I also don't understand why all the potions and elixirs are numbered. (potion1001, potion3001, elixir1001, elixir3001...) Perhaps this is just saying the amount of strength or experience it gives you, followed by a number to distinguish them from each other?
Plus, the 'storage' command only seems to work if you have everything in your inventory, and then it makes storage objects (?) named 'potion3004' and 'elixir3004'... This isn't really 'stacking', it's more like pouring a bunch of drinks into the same cup -- which comes to another bug (?) you can drink the entire storage unit. But it only gives you 300 of whatever.
Did I miss something here?...
1. "...but I don't see why you wouldn't just make it automatic, for this purpose (Sora)" and "...Plus, the 'storage' command only seems to work if you have everything in your inventory (Sora),"
oh certainly, I could make the code so that the object goes directly into the storage upon taking the object. I just set it up this way, so you have more control by having it be the 2 steps that it is:
take<->drop = game.pov (inventory) <-> room
~AND~
deposit<->withdraw = game.pov (inventory) <-> storage
-- though I'm not sure how you would use the object this way (well if you use the other setup of having the storage be within the inventory, then this wouldn't be a problem)
actually...
if you have the storage be null parented, then you must (or as far as I know, lol) have it be two separate steps, in order to be able to have the ability to use the objects, as I did in my code. (nevermind, now that my mind is thinking on this, you could make a command and function to be able to use your objects while they're in the null parented storage).
if you have the storage be childed to your inventory, then you can directly move (take~drop) the objects between storage and room, while still being able to use the objects. (would you like me to tweak~alter the code for this method~setup for you?).
2. "I also don't understand why all the potions and elixirs are numbered. (potion1001, potion3001, elixir1001, elixir3001...) Perhaps this is just saying the amount of strength or experience it gives you, followed by a number to distinguish them from each other (Sora)?"
yep, just for me (or you or whoever) to keep track of what is going on, mostly for trouble shooting, lol. You can change the names and aliases, to whatever you want (though you have to change it elsewhere in the code too, due to not having the best code done, sorry, I was just trying to put together something as fast as possible, so it's rather sloppy coding, lol).
four types of objects:
1) potion100 = +100 experience and 1 capacity*
2) potion300 = +300 experience and 3 capacity*
3) elixir100 = +100 strength and 1 capacity*
4) elixir300 = +300 strength and 3 capacity*
*capacity = think of this as like it's "weight" or "size" or "quantity"
four of each type of object (4x4=16 objects lol):
potion_100_1 (name) = potion1001 (alias)
potion_100_2 (name) = potion1002 (alias)
potion_100_3 (name) = potion1003 (alias)
potion_100_4 (name) = potion1004 (alias)
elixir_100_1 (name) = elixir1001 (alias)
elixir_100_2 (name) = elixir1002 (alias)
elixir_100_3 (name) = elixir1003 (alias)
elixir_100_4 (name) = elixir1004 (alias)
potion_300_1 (name) = potion3001 (alias)
potion_300_2 (name) = potion3002 (alias)
potion_300_3 (name) = potion3003 (alias)
potion_300_4 (name) = potion3004 (alias)
elixir_300_1 (name) = elixir3001 (alias)
elixir_300_2 (name) = elixir3002 (alias)
elixir_300_3 (name) = elixir3003 (alias)
elixir_300_4 (name) = elixir3004 (alias)
3. "...and then it makes storage objects (?) named 'potion3004' and 'elixir3004'... (Sora)"
no, they're moved.
there's the 16 objects (potions, elixirs, 100, 300)
drinking them:
moves them into a separate object (item_game_storage) that stores (holds, parents) them. And, the restore command then moves them back into the room. I do this instead of destroying or removing them, so they can be reused, via the restore command, hehe.
using the storage command and then deposit, moves all of them (from your inventory) into their proper sub storage objects, which you can view by the commands: (items) and (capacity):
potion_100_storage = object.potion (boolean=true) and object.quality_type (int=100)
elixir_100_storage = object.elixir (boolean=true) and object.quality_type (int=100)
potion_300_storage = object.potion (boolean=true) and object.quality_type (int=300)
elixir_300_storage = object.elixir (boolean=true) and object.quality_type (int=300)
item_player_storage (object with null parent for your storage, just like the item_game_storage but it is instead for when you consume~drink them a holding pen outside~hidden of~from the game player's knowledge, versus to the item_player_storage)
-> potion_storage
->-> potion_100_storage (max capacity = 9)
->-> potion_300_storage (max capacity = 9)
-> elixir_storage
->-> elixir_100_storage (max capacity = 9)
->-> elixir_300_storage (max capacity = 9)
4. "...This isn't really 'stacking', it's more like pouring a bunch of drinks into the same cup -- which comes to another bug (?) you can drink the entire storage unit. But it only gives you 300 of whatever (Sora)"
I think you were just confused as to what I was doing in my code, as this is the same "stacking" as you do, so I'm confused. I'm pretty sure it works correctly, I tested this pretty well, it should give the correct amounts (see above, #2, and below too).
also, the level up works like this:
0 exp (0 total experience) = level 0
+100 exp (100 total experience) = level 1 = 100 exp counter
(the experience counter is set back to 0)
+200 exp (300 total experience) = level 2 = 200 exp counter
(the experience counter is set back to 0)
+300 exp (600 total experience) = level 3 = 300 exp counter
(the experience counter is set back to 0)
+400 exp (1,000 total experience) = level 4 = 400 exp counter
(the experience counter is set back to 0)
+500 exp (1,500 total experience) = level 5 = 500 exp counter
(the experience counter is set back to 0)
also, the if your experience is more than is needed for the level up, the remaining experience is carried over (kept~used) for towards the next level up.
for example,
0 experience + potion300 =
> start: 0 experience = level 0
> 100 experience (of the 300 experience potion) = level 1
> remaining experience (from the 300 epxerience potion) = 200 experience = 200 experience towards level 2 (need 200 experience) = and thus = level 2
> remaining experience (from the 300 epxerience potion) = 0 experience = 0 experience towards level 3 (need 300 experience)
100 experience + potion300 =
> start: 100 experience = level 1
> 200 experience (of the 300 experience potion) towards level 2 (need 200 experience) = and thus = level 2
> remaining experience (from the 300 epxerience potion) = 100 experience = 100 experience towards level 3 (need 300 experience)
HegemonKhan
04 Mar 2013, 23:41here would be a code to count the object from the inventory (just thought of it just now, lol):
~OR~
---------------
err, maybe you could just do:
this.alias = this.originalalias + "(" + ListCount (game.pov) + ")"
and etc etc etc coding...
ach... this is too advanced for me...
game.pov = inventory = objectlist
ListCount adds up the amount of objects in the objectlist
how do you tell it to only add up certain objects (via their attributes) ???
but how do you set it up, so that it displays "apple (99)" in the inventory or even possibly to actually "stack" the objects... ???
foreach (obj,ScopeInventory ()) {
if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 100) {
list add (game.potion_100_list,obj)
} else if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 300) {
list add (game.potion_300_list,obj)
} else if (GetBoolean (obj,"elixir") = true and GetInt (obj, "quality_type" = 100) {
list add (game.elixir_100_list,obj)
} else if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 300) {
list add (game.elixir_300_list,obj)
}
}
// then just do your display code
this.alias = this.originalalias
this.alias = this.originalalias + " (" + ListCount(game.listname_list) + ")"
etc etc etc
// but you still got to figure out what you want to do with all of the objects, lol and meh
~OR~
foreach (obj,ScopeInventory ()) {
if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 100) {
list_count
} else if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 300) {
list_count
} else if (GetBoolean (obj,"elixir") = true and GetInt (obj, "quality_type" = 100) {
list_count
} else if (GetBoolean (obj,"potion") = true and GetInt (obj, "quality_type" = 300) {
list_count
}
// this doesn't work, but I think it *MAY* be somewhat on the right track... I hope... lol
<function name="list_count" parameters="obj">
foreach (objobj,ScopeInventory ()) {
if (objobj.name = obj.name) {
objobjobj = obj
this.alias = this.originalalias + " (" + ListCount(foreach (objobjobj, ScopeInventory ()) + ")"
}
}
</function>
// but you still got to figure out what you want to do with all of the objects, lol and meh
---------------
err, maybe you could just do:
this.alias = this.originalalias + "(" + ListCount (game.pov) + ")"
and etc etc etc coding...
ach... this is too advanced for me...
game.pov = inventory = objectlist
ListCount adds up the amount of objects in the objectlist
how do you tell it to only add up certain objects (via their attributes) ???
but how do you set it up, so that it displays "apple (99)" in the inventory or even possibly to actually "stack" the objects... ???
TriangleGames
05 Mar 2013, 00:57HegemonKhan wrote:...
how do you set it up, so that it displays "apple (99)" in the inventory or even possibly to actually "stack" the objects... ???
Set the "listalias" attribute for the object to affect the way it appears in the inventory display.
You'll need to reference some variable containing the number of items currently held, such as a "quantity" attribute for the item.
It'll look something like this:

And the result looks like so:

(FYI: Not that this matters, but just for the record, that's "Duck Tape" brand duct tape.

HegemonKhan
05 Mar 2013, 01:15awesome (and "duh", now that I'm looking at it, lol. Stupid HK!), hehe. thank You Triangle!
though, I guess we still got Sora's dilemna of what he wants with the apples, of cycling through the apple objects and adjusting the apple.alias, sighs.
I give up on it, maybe you can help him~her, lol.
though, I guess we still got Sora's dilemna of what he wants with the apples, of cycling through the apple objects and adjusting the apple.alias, sighs.
I give up on it, maybe you can help him~her, lol.
TriangleGames
05 Mar 2013, 03:26Okay, I finally have a fully working prototype for how I intend to handle "stacking" objects. Please, try this out and see what you think. It's possible that I'm still missing something about what you want to do, but I THINK this should work just fine. Again, this doesn't literally combine/stack objects, but for all intents and purposes (that I can think of) it will appear to the player as if that's what happened.
EDIT: A couple of suggestions for really testing this out:
Try typing in "take" and "drop," especially for the potion, to see why I aliased the marble the way I did.
Touch the pole to injure yourself, so you can see the potion work when you drink it.
EDIT: A couple of suggestions for really testing this out:
Try typing in "take" and "drop," especially for the potion, to see why I aliased the marble the way I did.
Touch the pole to injure yourself, so you can see the potion work when you drink it.
Sora574
05 Mar 2013, 06:11Nice job TriangleGames...
You actually made me realize something:
I HAVE to have a container.
But, it doesn't have to look or act like a container. It has to look and act like whatever you put INTO the container, which essentially makes the container non-existent...
Then, I figured out that instead of using lists to store all the objects, I need to use dictionaries, because the dictionaries have keys, so it doesn't have to be a specific object that I refer to later on. (I even tricked the dictionary into letting me use an integer as a string by forcing a translation into a string...)
So... Taking everything I've learned and combining it, I made a demo that has 3 functions that can all easily be translated into a library.
I don't think I could've learned any of this without you two, so big thanks to both of you. (HK and Triangle)
As always, you can change the <asl version="540"> to <asl version="530"> if you're using 5.3...
Now, without further ado, here's my simple (yet somehow incredibly complicated) demo:
You actually made me realize something:
I HAVE to have a container.
But, it doesn't have to look or act like a container. It has to look and act like whatever you put INTO the container, which essentially makes the container non-existent...
Then, I figured out that instead of using lists to store all the objects, I need to use dictionaries, because the dictionaries have keys, so it doesn't have to be a specific object that I refer to later on. (I even tricked the dictionary into letting me use an integer as a string by forcing a translation into a string...)
So... Taking everything I've learned and combining it, I made a demo that has 3 functions that can all easily be translated into a library.
I don't think I could've learned any of this without you two, so big thanks to both of you. (HK and Triangle)
As always, you can change the <asl version="540"> to <asl version="530"> if you're using 5.3...
Now, without further ado, here's my simple (yet somehow incredibly complicated) demo:
HegemonKhan
05 Mar 2013, 17:49Thanks both of you, though I'll have to study these, as it's still hard for me to just follow (read the code) along when it involves this type of stuff. I'm learning a lot and this is one area that I need to learn, so thanks to both of you!