Inventory
Potion
Potion
Potion
Coin
Potion
Coin
Potion: 4
Coin: 2
HegemonKhan wrote:the only problem, is that even with the stackable feature, you can still have too many items cluttering up the inventory
sonic102 wrote:What about disambiguation problems? Is that tested?
sonic102 wrote:Also, how do I limit a stack? I only want to allow 10 potions, for example, and no more.
object = [Name of the object you want to limit]
container = GetObject(object.alias + "_container")
if (container.stacked_count > 10) {
unstack (container)
msg ("You can only carry 10 of that.")
}
sonic102 wrote:For example, I have a green potion with the alias potion and a regular potion with the alias potion, which stacks into one. If I say 'drink potion', which potion will it drink?
sonic102 wrote:Ah. I thought it would ask a question, "Which potion did you mean, the green potion or the regular potion?". But that would be hard to code.
HegemonKhan wrote:I simply meant that you can still have a bunch of different type of objects, thus the stacking won't help, as your inventory will still be cluttered, a storage will be needed if you got too many different types of items. The stacking is awesome, but I don't think there's any other way to deal with lots of different types of objects, other than with using some storage system for it.
potions (99)
keys (50)
arrows (70)
food (40)
silver_coins (30)
gold_coins (60)
herbs (20)
remedies (10)
rope (5)
seeds (80)
magic_walnuts (63)
cup_of_wishes (88)
candies (77)
chocolates (66)
statues (55)
ore (44)
lumber (33)
vespian_gas (22)
oil (11)
marble (82)
bombs (35)
magic_powder (69)
tinctures (42)
elixirs (71)
rocks (52)
etc
can you recognize what games any of (some) of these things are from? lol
HegemonKhan wrote:the stackable library~coding + a storage system is the best
this.alias + "_container"
<!--In other words, potion_container"-->
Sora574 wrote:"sonic102"
Ah. I thought it would ask a question, "Which potion did you mean, the green potion or the regular potion?". But that would be hard to code.
I know not the meaning of the word 'hard'.
But yes, it is pretty hard. I'm working on a way to do it, though, so it's only a matter of time.
value = what player typed after the verb (i.e. if they typed "drink potion" value will be "potion")
scope = ScopeInventory()
foreach (obj, scope) {
name = LCase(GetDisplayAlias(obj))
CompareNames (name, value, obj, fullmatches, partialmatches)
if (obj.alt <> null) {
foreach (altname, obj.alt) {
CompareNames (LCase(altname), value, obj, fullmatches, partialmatches)
}
}
}
if (ListCount(fullmatches) = 1) {
JustDrinkIt(ObjectListItem(fullmatches, 0))
}
else if (ListCount(fullmatches) = 0 and ListCount(partialmatches) > 0) {
menu = NewStringDictionary()
GenerateMenuChoices(menu, partialmatches)
ShowMenu ("Which potion do you want to drink?", menu) {
if (result = null) {
// handle menu cancel
}
else {
JustDrinkIt(GetObject(result))
}
}
}
else {
// todo: fail miserably
}
<library>
<!-- My Own Notes -->
// final_melee_damage = sum_of_all_elemental_damage_types + final_physical_damage
// final_physical_damage = critical_hit * actual_physical_damage + actual_physical_damage * physical_damage_multiplier
// physical_damage_multiplier = (strength - endurance) / 100
// accuracy = dexterity - speed
// evasion = agility - speed
// piercing = attack_rating - armor_class
// parrying = dexterity - agility
// blocking = agility - dexterity
// actual_physical_damage = physical_damage - physical_resistance
// actual_fire_damage = fire_damage - fire_resistance
// actual_water_damage = water_damage - water_resistance
// actual_air_damage = air_damage - air_resistance
// actual_earth_damage = earth_damage - earth_resistance
// actual_light_damage = light_damage - light_resistance
// actual_dark_damage = dark_damage - dark_resistance
// actual_holy_damage = holy_damage - holy_resistance
// actual_unholy_damage = unholy_damage - unholy_resistance
// sum_of_all_elemental_damage_types = actual_fire_damage + actual_water_damage + actual_air_damage + actual_earth_damage + actual_light_damage + actual_dark_damage + actual_holy_damage + actual_unholy_damage
// battle_turn_initiative = speed vs speed
</library>
<library>
<!-- Game Libraries -->
<!-- Templates -->
<!-- Dynamic Templates -->
<!-- Verbs -->
<!-- Commands -->
<!-- Functions -->
<!-- Turnscripts -->
<!-- Types (Object Types) -->
<!-- Objects -->
<!-- Game Object -->
<!-- Player (POV) Objects -->
<!-- Room Objects -->
<!-- Item (Object) Objects -->
<!-- "Object Structures" or "Data Storage" (Objects) -->
<!-- Boolean Object Structures -->
<!-- Integer Object Structures -->
<!-- String Object Structures -->
<!-- Script Object Structures -->
<!-- Lists -->
<!-- String Lists -->
<!-- Object Lists -->
<!-- Dictionaries -->
<!-- String Dictionaries -->
<!-- Object Dictionaries -->
<!-- Script Dictionaries -->
<!-- Attributes -->
<!-- Boolean Attributes -->
<!-- Integer Attributes -->
<!-- String Attributes -->
<!-- Script Attributes -->
<!-- My Own Notes -->
</library>