#Unsure about how calculate returning and context checks work...

1 messages · Page 1 of 1 (latest)

dull dagger
#

Hi again,

I was having some issues figuring out how to use calculate returning and context checks in calculate functions, I am using stickers as a way to have two seals on one card for a silly little mod I decided to make, however I have no clue how to do so. (I first planned to use Draw, but the documentation for it was way too vague, and I felt stickers would be better to manage.)

The reason why the context variable is necessary is because I need to edit a card ability values beforehand, as returning values did not work either, I had this issue for a bit and I am quite confused why this happens.

This is a code snippet that references to this issue I am having trouble with:

calculate = function(self, card, context)
print(#G.hand.cards * 0.05 + 1)
if context.cardarea == G.play and context.main_scoring then
return {
card = card,
Xmult = (#G.hand.cards * 0.05 + 1),
message = "test",
colour = G.C.MULT
}
end
end

context.cardarea == G.play works fine, but context.main_scoring doesn't, plus the return function would hardly work with jokers, not stickers nor enhancements.

I'm still practicing the SMODS API, so I might have done stupid mistakes, bare with me.

reef pine
#

What smods version are you on?

dull dagger
#

this i believe

dull dagger
reef pine
#

very much so

#

thats nearly 6 months old

dull dagger
#

damn

#

ok so it worked, i suppose it was outdated