Page 1 of 1

How would I handle stacks?

PostPosted: Sat May 05, 2012 05:49
by tinoesroho
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
hit_with = puncher:get_wielded_item()
hit_with_name = hit_with:get_name()
hit_with_count = hit_with:get_count()
if hit_with_name == "moreores:copper_ingot" then
hit_with_count = hit_with:get_count()
total_amount = hit_with_count
    puncher:get_inventory():remove_item("main", hit_with)
puncher:get_inventory():add_item("main", "money:coin_gold hit_with:get_count()")


I'm trying to get my Automated Trader to count stacks of items. Sadly, this doesn't produce pay equal to the stack I feed into it. How can I get this to work?

PostPosted: Wed May 09, 2012 11:15
by Switch5681
I don't know the specifics of this language, but it looks like you're removing hit_with and then trying to use it to create your money. Is it possible that hit_with is being disposed when you remove it, so you're trying to use the count of a non-existant item?