#Thread to stop flooding chat

1 messages · Page 1 of 1 (latest)

rare solstice
#

Can't figure it out. Heres most of my full code thats necessary:

    local honey = 0
    if context.end_of_round and card.ability.extra.triggered == false then
      card.ability.extra.triggered = true
      for i, v in ipairs(G.consumeables.cards) do
        print(v.name)
        if v.center == G.P_CENTERS["honey"] then
          honey = honey + 1
          print(honey)
        end
      end
    end
end```

Spectral Card:

```local honey = {
    name = "Honey",
    key = "honey",
    set = "Spectral",
    config = {extra = {card_slots = 1, pack_slots = 1, voucher_slots = 1}},
    loc_vars = function(self, info_queue, center)
    end,
    pos = { x = 0, y = 0 },
    atlas = "honey",
    cost = 3,
    unlocked = true,
    discovered = true,
    can_use = function(self, card)
        return true
    end,
    use = function(self, card, area, copier)
        G.E_MANAGER:add_event(Event({
        func = (function()
            play_sound('generic1', 0.9 + math.random()*0.1, 0.8)
            play_sound('holo1', 1.2 + math.random()*0.1, 0.4)
            return true
        end)
          }))
    end,
    add_to_deck = function(self, card, from_debuff)
        change_shop_size(card.ability.extra.card_slots)
    end,
    remove_from_deck = function(self, card, from_debuff)
        change_shop_size(-card.ability.extra.card_slots)
    end,
}```
hardy thistle
rare solstice
#

Yes. For some reason, context.end_of_round triggers multiple times for some reason (maybe because I needed another context or something)

hardy thistle
#

yeah, it checks for each cardarea

#

you can fix that by checking if the cardarea's the right one. context.cardarea == G.jokers in this case

rare solstice
#

That makes sense.

hardy thistle
#

the first print, print(v.name) will not print, because names are supposed to be on the ability of a card. So, in this case, print(v.ability.name) should work

#

you said it crashes when indexing for the ability, but as far as I iknow, every joker and consumable needs to have one to be able to exist

rare solstice
#

So I did the v.ability.name and it printed the name, but this may conflict with other mods that may have the name "Honey" so I was wondering how to do the key one, which of course, doing either v.ability.key or v.key gives nil as I am assuming it might be stored somewhere else?

#

But if I can't find any other alternatives, might as well go for the name, since it actually worked

hardy thistle
#

v.center.config.key might work

rare solstice
#

Gives the "Attempt to index field 'center'" error

hardy thistle
#

sorry, i'm half asleep apparently today

#

config.center.key