Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Inventory help

edited February 2015 in Help! with 2.0
Hi,
I need help with Inventory and Shop Management and hope that you can show me an easier way then mine.

Actually, I have a shop inventory like this:
<<set $Shop =
"LeatherArmor" {
name: "Leather Armor",
type: "Armor",
price: 50,
desc: "a simple leather armor"
},
"PotS" {
name: "small Heal Pot",
type: "useable"
price: 10,
desc: "a small Heal Pot which regenerate 25 life"
},
}>>
Now I search for and easy way that list all items in the shop like this (without writing every by my own)
Item Name + Item Description + Item Price + Buy button
At the same moment, the item should disappear from the shop and have to be adding to the inventory, which list:
Item name + Item Description + wear/use
I hope that you can show me an easy way

Comments

  • It's probably not the answer you're after, but you could do one master list for shop and inventory. I'll use SugarCube markup to show what I mean:

    <<set $armor to 1>>
    <<if $armor is 1>>Armour. This armour is leather.<<if $coins gte 50>>[[Cost 50|purchase armor passage that sets armor to 2 and takes 50 from coins]].<<elseif>>Cost 50>>.<</if>><</if>

    Then for inventory:

    <<if $armor is 2>>Armour. This armour is leather.<</if>

    In this way you could set shops up by simply copying your master shop list, and at the top of the passage, using the <<set>> command to set the variables to what you want the shop to display. That way you'd simply have to copy paste one list out for every shop, and then just change the <<set>> commands at the top of each page to choose what each displays. It seems just as easy to me as what you are trying to do.

    E.g. if you want a shop without armour, you simply write:

    <<set $armor to 0>>
    <<if $armor is 1>>Armour. This armour is leather.<<if $coins = gte 50>>[[Cost 50||purchase armor passage that sets armor to 2 and takes 50 from coins]].<<elseif>>Cost 50>>.<</if>><</if>


    If you then defined the shop in the widgets passage, you could just write in individual passages:

    <<set $armor to 0>>
    <<shop>>
  • That's the problem. So I have to create for every item a own tag. But actually I have about 40 items and I want to create more. And that's a lot of typing and several new tags and if I create new items I have to create new tags. That's why I search for an macro or script or something else that automatically add the items from this list to the shop page.
  • How would that be different to creating the master list as a SugarCube widget and just calling the widget on each passage?

    Whatever solution you go with, you need to create a master list ~somewhere~. :)
  • Claretta wrote:

    How would that be different to creating the master list as a SugarCube widget and just calling the widget on each passage?

    Whatever solution you go with, you need to create a master list ~somewhere~. :)


    Okay thats an miss understood. I have a masterlist.

    example:
    <<set $Shop =
    "LeatherArmor" {
    name: "Leather Armor",
    class: "Armor",
    price: 50,
    desc: "a simple leather armor"
    },
    "SHealPot" {
    name: "small Heal Pot",
    class: "useable"
    price: 10,
    desc: "a small Heal Pot which regenerate 25 life"
    },
    }>>
    now i create 2 passages. a shop and an inventory.

    the shop should look like this:
    The shopowner has:

    "Item name"+"Description"+"Price"+"buy button"
    And this list should be generated out of my "masterlist". And if you buy a item it should be removed out of the shop and should be added to the player inventory. which should look like:
    Actually you have:

    "Item name"+"Description"+"use button"
    And all of this should be created automatically so that i only have to add items to my "masterlist" and it appear at the shop by its own.

    Actually i have to create 2 lists, 1 for shop and 1 for the inventory. And i have to type all by my own and I have to create a new variable for every item. and that i want to make easier. Is it possible or not? Anyone has a idea?
Sign In or Register to comment.