#đŸ’»ăƒ»modding-dev

1 messages · Page 698 of 1

brittle yacht
#

what kind of .toml is it

frosty rampart
#

it's literally just a file you create with the .toml extension
and it's just plaintext, you can edit it in notepad or whatever

brittle yacht
#

or is it like items where it dsoesnt matter what name is

frosty bone
#

is there any way to code a consumable that gives +4 mult when a hand is played

frosty rampart
brittle yacht
#

kk

frosty bone
red flower
#

just code it like a joker

frosty rampart
#

^ you can just give the consumable a calculate function

frosty bone
#

but i also want it to give money when used

frosty rampart
#

you can give it both a calculate function and a use function

red flower
#

it can have both calculate and use

frosty rampart
#

you need this block at the top of the file (from the link i sent you)

brittle yacht
#

oh ight

keen totem
#

is the '+X extra chips' on bonus card or perma chips possible to recreate with a modded enhancement

frosty bone
keen totem
#

because those two stack their description to include both values

#

and im unsure if you can do that with a modded enhancement

hearty lagoon
#

Im trying to make a seal that when held in hand at the end of the round, it copies its playing card. I have the cloning part working however i cant get the message to pop up nor jokers like hologram to upgarde or mime to retrigger

brittle yacht
# frosty rampart you need this block at the top of the file (from the link i sent you)
version = "1.0.0"
priority = 0

[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS['j_smiley'])"
position = "at"
payload = "SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS['j_smiley'])"
match_indent = true```
frosty rampart
#

you shouldn't be trying to manually load the toml file, the mod loading process will take care of it automatically

brittle yacht
#

oh ight

naive coral
#

how do i make a card not move when clicked/selected

brittle yacht
#

still isnt putting in the custom cards into the cutscene thingy

frosty rampart
#

you shouldn't have edited the pattern, only the payload

brittle yacht
#

ooooh

frosty rampart
#

the pattern is the original code the patch is searching for, and the payload is the replacement code (or inserted code depending on what the position is set to)

brittle yacht
#

that makes sense

#

thank you very much

#

i gotta start putting some of you into the credits

#

it is fixed now

#

thank you very much

lament agate
#

custom edition is e_modprefix_editionname

#

right

red flower
#

ye

lament agate
#

thanks

#

mwah

frosty bone
frosty rampart
#

more jokerforge issues i think? try deleting the line that's just })) after the end of the calculate function

viscid talon
#

@frosty bone

#

assume that every single "if" statement will need a corresponding "end"

#

as of the three brackets, delete those. its likely a generation error

frosty bone
primal robin
tidal hemlock
#

what do i need to fix for the text to appear above

#

yes im keeping the vremade defined in fear of it breaking something

white zinc
#

i've been going insane trying to make a joker that essentially treats stone cards as not part of your hand size (e.g. having 2 stone cards in your hand would let you draw 2 more cards). i'm probably overlooking some really easy solution to this but i'm actually at a bit of a loss for how this would be done logically in terms of contexts and how/when you'd draw cards. "draw_card(G.deck,G.hand, 90,'up', nil)" would let you draw a card from your deck, but you'd need to loop this for the amount of stone cards in your deck. what if you then drew another stone card?

frosty bone
viscid talon
frosty bone
#

ok

#

figured iy out

lament agate
#

Where to see list of Joker's attributes

daring fern
dawn knoll
#

How do I make it to where a joker makes cards with a specific enhancement to act as any suit?

lament agate
#

what check should i write to detect if an Ante is changing

silk latch
frosty rampart
frosty rampart
frosty rampart
silk latch
#

oh.

daring fern
frosty bone
dawn knoll
frosty bone
#

25

dawn knoll
#

maybe remove the commas in line 37 and 38

glass scaffold
#

Alright, revisiting this after a while.

This snippet has where the function from engine/controller.lua is modified, but when I open the game, the Settings automatically open and all key presses are doubled.

glass scaffold
daring fern
glass scaffold
frosty bone
red flower
#

<@&1133519078540185692>

primal robin
#

huh, did I missed something

lament agate
#

does Balatro supports ogg

glass scaffold
lament agate
#

thanks

silk latch
lament agate
#
calculate = function(self, card, context)

        if context.individual
        and context.cardarea == G.play then

            if context.other_card:is_suit("Hearts") then

                context.other_card.debuff = true
            end
        end
        if context.joker_main then
            local tmult = 0
            for _, playing_card in ipairs(G.play.cards) do

                if playing_card.debuff == true and playing_card:is_suit("Hearts") then
                    tmult = tmult + card.ability.extra.mult
                end
            end
            return {
                mult = tmult
            }
        end
    end,

    update = function(self, card, dt)

        if G.play then
            for _, playing_card in ipairs(G.play.cards) do

                if playing_card:is_suit("Hearts") then
                    playing_card.debuff = true
                end
            end
        end
    end
#

any ideas on why the code doesnt count my debuffed cards

#

as in it doesnt output the mult

red flower
#

is_suit("Hearts", true) to count debuffed iirc

dawn knoll
#

how do i get a joker to add money to a card with a specific enhancement when played

red flower
glass scaffold
#

Is it possible to modify the Lucky Card enhancement when a certain Joker is held?
(Only the enhancement, not the odds in the entire game.)

wanton jolt
#

what do you mean by modify

glass scaffold
wanton jolt
#

it is possible im sure without even hooking or taking ownership

daring fern
wanton jolt
#

there it is

gilded blaze
#

what are you trying to do

silk latch
#

Find the highest speed value over the last few seconds, while ignoring any nil values.

gilded blaze
#

cursor's moving speed?

bright crane
#

Anyone know of a way to create a deck that bans all vanilla jokers?

silk latch
red flower
bright crane
naive coral
#

how can i make a joker not move up and down when clicked on, just staying in place.

daring fern
naive coral
#

are there any example in mods you can think of? would just making it perma pinned be easier do you think

forest cobalt
#

is there a way to make a joker make a card draw face down

#

tryna make a joker called redacted files

#

but i cant get the face down cards to work

#

oh shit i just deleted my code for the joker whoops

dapper sun
naive coral
#

when you click a card and it goes up and down

dapper sun
#

i'd just hook Card:highlight to return early under certain conditions

naive coral
#

hook very scary tho

dapper sun
#

imagine a hook like this

#

replacing the function with what you want

#

and you grab the old function beforehand so you can control when the normal function behaviour is run

#

like

#
local old_func = func
function func(card)
    -- only run normal code if condition is met
    if card.area ~= G.jokers then
        old_func(card) -- the function's existing behaviour
    end
end```
daring fern
dapper sun
#

ohhh

forest cobalt
#

ARGHHHHHHHHH I Hate Coding!

dapper sun
#

if the function usually returns a value, return the old_func

forest cobalt
#

im going batshit insane

daring fern
forest cobalt
forest cobalt
gilded blaze
hearty lagoon
#

it works now, thanks!

keen totem
#

how often is "in_pool" recalculated?

red flower
keen totem
#

technically could I make in_pool include a chance to return true, otherwise return false

#

obviously you can just use object weights

#

which is easier

#

and less stupid

silk latch
# silk latch Yeah

And then there's the issue of it seemingly not actually scoring properly at all?

gilded blaze
#

and this existed long before object weights were introduced

silk latch
gilded blaze
#

loc_vars only gets called every time the description pops up, not every frame

silk latch
#

yeah, but it still doesn't even show up in the description

#

y'know, when it gets called

brazen rock
#

how would i make a seal retrigger a card a certain amount of times?

faint yacht
#
if context.repetition then return { repetitions = 420 } end
brazen rock
#

thanks

vital jewel
#

Managed to sort this out, theoretically, would it be possible for cards with one of the new suits(lets say roses) to gave an ability (probably xmult or retriggers)where it scales depending on the amount of cards with a matching suit in played hand or held in hand

#

Kinda like an enhancement

red flower
red flower
#

have you wrote something with a calculate function before

vital jewel
#

Just got into this hobby

red flower
sturdy compass
#

If you want a video tutorial that goes over Calculate I have this here. The same exact principles apply to Mod Calculate https://youtu.be/1yWK09pzo0U

sturdy compass
#

o7

red flower
#

ABGMBM

viscid talon
#

how do you make a crossmod joker i forgot

wanton jolt
#

@viscid talon make sure the mod is installed

#

you can have multiple ways to do it

#

i do it two different ways on feli's jokeria

viscid talon
#

ah ok

wanton jolt
#

check modules/inscryption/jokers/deathcards.lua

#

and my main.lua

viscid talon
#

im currently following smth toga sent me and im a bit confused

#

oke

wanton jolt
#

dont take my function to check if a mod exists because i think theres one called next(SMODS.find_mod(""))

median rose
#

How would I get a list of jokers in the joker slots along with the current cards the player has in their hands

primal robin
#

Does SMODS.Back have generate_UI?

#

Same for SMODS.Stake

tidal hemlock
glossy sky
#

how would I remove an owned joker without destroying it?

viscid talon
#

yippee first crossmod c:

red flower
glossy sky
#

I have a use button on a joker and want the joker to disappear after use, without calling smods.destroy_cards

glossy sky
#

the Joker creates an item that can create the used Joker afterwards, and since the mod has a Joker that scales each time a Joker is destroyed, you can just infinitely swap back and forth

red flower
#

does it use joker_type_destroyed

glossy sky
#

yeah

red flower
#

i think card:remove() is the only thing that bypasses that

glossy sky
#

yeah that works. thanks!

tidal hemlock
flint spindle
#

I'm trying to make the Standard tag give multiple booster packs, but it's creating both of these booster packs at the same time and it causes some very weird stuff to happen. How do I make it so the game doesn't create the 2nd booster pack until the first one goes away, or is there an easier way to create booster packs than this?

red flower
#

not really

#

you would need to wait for the booster to be closed to open another one and thats a bit of a pain

flint spindle
#

dang

#

alright i gotta get busy then

#

thx

#

how do I change the number of cards shown / number of cards to be selected in a booster pack?

red flower
median rose
#

I'm trying to get the cards within the play area when a round first starts after the cards flying from the deck animation. I tried hooking to new_round. But the number of cards is always 0.

local new_round_ref =  new_round
function new_round()
    local ret = new_round_ref()
    -- print the amount of cards the player has in their hand
    print("Number of cards in hand " .. #G.hand.cards)
    return ret
end

I assume that function was calling before the hand was set, so I tried something similar with draw_from_deck_to_hand, but I don't see any of the print statements in the log.

local draw_from_deck_to_hand_ref = draw_from_deck_to_hand
function draw_from_deck_to_hand()
    -- Do something before the original code
    print("draw_from_deck_to_hand before")
    local ret = draw_from_deck_to_hand_ref()
    -- Do something after the original code
    print("draw_from_deck_to_hand after")
    -- print the amount of cards the player has in their hand
    print("Number of cards in hand " .. #G.hand.cards)
    return ret
end

What function should I be looking for in this context? Also I realized the animation to get the cards does not appear when you are loading a save into a round. Would I need to hook a separate function for that?

wintry solar
#

what's the aim?

median rose
#

I want to be able to check whenever the "state" of said hand changes. Whether that be from playing a hand, using justice on a card, doing a new run

red flower
#

try the first one in an event, like

G.E_MANAGER:add_event(Event({
    func = function()
        print(#G.hand.cards)                
        return true
    end
}))

but honestly if you want constantly check for state you might as well do it in Game:update

median rose
red flower
#

no, the game itself does it for some cards

#

vanilla has less reason to do it than you lmao

median rose
# red flower try the first one in an event, like ```lua G.E_MANAGER:add_event(Event({ fun...

Sorry, for the boatload of follow up questions, but where exactly am I supposed to put this? I'm looking through the wiki https://github.com/Steamodded/smods/wiki/Guide-‐-Event-Manager for events. And while I do see the condition property, I feel like using it gives me the same problem I am looking for now, which is checking when the hand cards length is greater than 0.

I can try to put this in update, but I would need to make sure that the user is in a game, and is in a round. Otherwise, I expect I will crash (like I did when I put this code inside my main file.) I don't mean for you to give me the answer, I'm just very noobish at this language and code

median rose
#

ohhhhh

red flower
#

you can also try

G.E_MANAGER:add_event(Event({
    func = function()
        if next(G.hand.cards) then
          print(#G.hand.cards)                
          return true
        end
    end
}))

to explicitly wait until the hand has something but i think just an event might work

median rose
#

I tried doing this with small variations, but regardless of what the delay is, it seems to be printing immediately as 0

local new_round_ref =  new_round
function new_round()
    local ret = new_round_ref()
    -- print the amount of cards the player has in their hand
    G.E_MANAGER:add_event(Event({
        trigger = "after",
        delay = 10, 
        func = function()
            print(#G.hand.cards)
            return true
        end,
        blocking = false
    }))
    return ret
end

The closest I got was this version in which it printed 1 pressuambly bc 0 is a falsey value. If it's the same as JS

local new_round_ref =  new_round
function new_round()
    local ret = new_round_ref()
    -- print the amount of cards the player has in their hand
    G.E_MANAGER:add_event(Event({
        func = function()
            if next(G.hand.cards) then
                print(#G.hand.cards)                
            return true
            end
        end,
        blocking = false
    }))
    return ret
end
red flower
#

0 is truthy

#

but it makes sense because next(G.hand.cards) would be true if there's 1 card

#

i didnt expect it to run one at the time tho lol

#

i would try an event in G.FUNCS.draw_from_deck_to_hand then, like smods does for context.hand_drawn or if you are using the smods api then just check for that context

brittle yacht
daring fern
frosty rampart
frosty rampart
brittle yacht
#

no

#

vanilla jokers

#

theres specfic ones that arent already in a vanilla pool

frosty rampart
#

ah oki

brittle yacht
#

so what do i do

#

im confuzzled

median rose
# red flower i would try an event in G.FUNCS.draw_from_deck_to_hand then, like smods does for...

I did some digging and I think certificate does what I want. It seems to add the new card after the animation is done. I'm not going to send the entire calculate function since it's large, but the part I'm sending is what I think I need.

calculate = function(self, card, context)
        if context.first_hand_drawn then
            pressumably this is where I would put the print statement
            print(#G.hand.cards)
        end

I'm not sure what you mean by the api calls. I'm aware of the documentation https://github.com/Steamodded/smods/wiki/API-Documentation, but I'm not sure how use them for functions in this context.

daring fern
# brittle yacht im confuzzled
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS['j_joker'])"
position = "at"
payload = '''
local jokers = {}
for k, v in pairs(G.P_CENTER_POOLS.Joker) do
    if not v.original_mod then
        table.insert(jokers, v.key)
    end
end
SC = Card(G.ROOM.T.w/2 - SC_scale*G.CARD_W/2, 10. + G.ROOM.T.h/2 - SC_scale*G.CARD_H/2, SC_scale*G.CARD_W, SC_scale*G.CARD_H, G.P_CARDS.empty, G.P_CENTERS[jokers[math.random(#jokers)]])
'''
match_indent = true
brittle yacht
#

oop

#

hello

frosty rampart
#

that patch will give you any joker that is modded

#

if you have a specific set of jokers in mind, just put all the strings in the jokers table instead of doing the for loop

daring fern
frosty rampart
#

right my bad

#

but yea my point still stands

brittle yacht
#

v.key is the pool i want, right? or do i need to insert all of the specific jokers i want

frosty rampart
#

you need to insert all of the specific jokers you want
so instead of the loop and the first line of the payload that somethingcom gave you, you'd just have this

local jokers = {
  "j_smiley",
  ... -- whatever other joker keys you want
}

and then the last two lines of the payload can stay

tidal hemlock
brittle yacht
#

ok yes it works

#

thank you very much

red flower
median rose
red flower
#

yeah

#

thats what i did for playlog at least

median rose
red flower
#

do you want to grab the data every time something changes? if so there are some things that can't be done with contexts

red flower
#

i would use update then lol

median rose
timid zinc
#

is there a way to make the boss blind not change the background or music?

red flower
# median rose and what would that function look like?
ModGlobal = { cards_in_hand = 0 }

local game_update_ref = Game.update
function Game:update(...)
    if G.hand and G.hand.cards and ModGlobal.cards_in_hand ~= #G.hand.cards then
        print(#G.hand.cards)
        ModGlobal.cards_in_hand = #G.hand.cards
    end
    return game_update_ref(self, ...)
end

or something like that, checking for specific changes would be a bit more involved

#

if you have a specific list of what you want to check you might be able to find a function to hook for each tho

#

combining that with the calculate function

median rose
#

Consumables means if they're used in the context of an ongoing round. Not like when you open a booster pack

red flower
#

ah if you want to check for the specific cards then it's a lot easier

#

in would recommend you check the link for my mod i sent earlier since it does all of that

median rose
#

Yes, the only reason why I mentioned money before was for jokers like bootstraps or shwashbuckler

#

since that affects their scoring value

#

Ok, thank you, I will check it out later. My brain is fried

red flower
brittle yacht
#

anybody know the sprite size for cardsleeves

red flower
#

same as a joker iirx

#

c

brittle yacht
#

kk

#

thank you n'

primal robin
#

Peak UI structure moment

daring fern
gaunt folio
#

trying to make this trigger per negative joker owned much like baseball card does, how can i make this work? doesnt currently work.

brittle yacht
wind steppe
#

(the center is like the base definition for all instances of that joker, so it won’t have things specific to one copy of a joker like editions)

gaunt folio
wind steppe
#

oh wait yeah

gaunt folio
#

its meant to act like how baseball card does btw

wind steppe
#

make sure the edition exists before getting its key

#

editionless cards have nil there

daring fern
tidal hemlock
gaunt folio
#

ok got it

wind steppe
flint spindle
#

I'm trying to modify the standard tag to open multiple booster packs, but if I just duplicate the booster pack code (or duplicate it under an add_event function), it opens all the packs at the same time and weird stuff happens. Is there an easier way to create booster packs, or how do I stop the next pack from opening until the previous one finishes? (should mention that I'm building this off of the standard tag from VanillaRemade)

red flower
#

i just like checking the key more

wind steppe
#

i don’t know where that code is unfortunately so i can’t help with that

primal robin
#

Well, preparing this kind of UI was a bit of challenge ngl

#

or maybe I not supposed to do all of that because back is center and I can just throw it into generate_card_ui isnt it

tidal hemlock
#

this has something to do with colors (specifically the color of vortexes) but idk how to fix it

#

nvm keep_base_colours = true was what was causing the problem

primal robin
#

It doesnt work tho

#

Holy shit

#

Am I wizard or smth

red flower
primal robin
#

I stole some code from Galdur to make my life a liiiiitle bit easier xd

#

I was planning to extract detailed tooltips from rendered text but Eremel used solution with just checking parsed string

#

Is info_queue works for decks btw?

#

By that I mean info_queue[#info_queue + 1] = G.P_CENTERS.b_back, does it displays deck properly?

slate turtle
#

how do i implement a custom rarity

red flower
red flower
slate turtle
#

like how to define it

#

oh and also how to give said rarity to a joker

#

hello

red flower
#

(check vanillaremade)

red flower
forest cobalt
#

poop

primal robin
#

Peak decks development

#

a lot of stuff to do still!

flint spindle
#

is there a way I can see a giant list of all the context.types for tags?

red flower
#

eval
immediate
new_blind_choice
voucher_add
tag_add
round_start_bonus
store_joker_create
shop_start
store_joker_modify
shop_final_pass

#

i will add them to vanillaremade while im at it

flint spindle
#

tyty

median rose
#

I have this class in an seperate file from my main

-- game_state.lua
-- Class to hold the state that will be transferred to the calculator
local GameState = {}
GameState.__index = GameState

function GameState.new()
    local self = setmetatable({}, GameState)
    self.playing_cards = {} -- the playing cards in hand during a round
    return self
end

function GameState:set_playing_cards(playing_cards)
    local copy = {}
    for key, value in pairs(playing_cards) do
        copy[key] = value
    end
    self.playing_cards = copy
end

function GameState:print_playing_cards()
    for _, card in ipairs(self.playing_cards) do
        print(card.base.id .. " of " .. card.base.suit)
    end
end

return GameState

When I try to call it in my main file, I get an error

-- main.lua
local GameState = require('game_state.lua')
local game_state = GameState.new()
daring fern
flint spindle
#

is there any way to use one of the weirder non-tag contexts with tags? (Specifically context.ending_booster)

daring fern
flint spindle
#

what does that look like ;-;

#

ive never heard of this wizardry

#

is there a page on steammodded I can look at

#

oh nvm I found online help

#

tytyty

raven jewel
#

need help codeing a skin mod

junior tapir
#

I'm trying to make an enhancement immutable and indestructible, maybe there is another way but my implementation won't work

## Make enhancement unable to be overridden; doesn't work
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = '''
function Card:set_ability(center, initial, delay_sprites)
'''
position = 'after'
payload = '''
if self.config.center == 'm_lucky' then return {} end -- not even 'then return end'
'''
match_indent = true

## Make enhancement indestructable; doesn't work
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = '''
function Card:start_dissolve(dissolve_colours, silent, dissolve_time_fac, no_juice)
'''
position = 'after'
payload = '''
if self.config.center == 'm_lucky' then return {} end
'''
match_indent = true
daring fern
# junior tapir I'm trying to make an enhancement immutable and indestructible, maybe there is a...
local oldcardsetability = Card.set_ability
function Card:set_ability(center, initial, delay_sprites)
    if self.config.center.key == 'm_lucky' then return nil end
    return oldcardsetability(self, center, initial, delay_sprites)
end

local oldstartdissolve = Card.start_dissolve
function Card:start_dissolve(dissolve_colours, silent, dissolve_time_fac, no_juice)
    if self.config.center.key == 'm_lucky' then self.getting_sliced = nil; return nil end
    return oldstartdissolve(self, dissolve_colours, silent, dissolve_time_fac, no_juice)
end
lament agate
#

how do you change how much a joker takes up a slot again

faint yacht
#

Specify extra_slots_used in config.

lament agate
median rose
#

I have this cod that gets the playing cards the in the hand when starting a blind

SMODS.current_mod.calculate = function(self, context)
    if context.hand_drawn or context.other_drawn then
        local cards = context.hand_drawn or context.other_drawn
    end
end

Is there a similar way to that here when resuming a run from the main menu in this code? There's no context, so idk if it would be different

local game_start_run_ref = Game.start_run
function Game:start_run(args, ...)
    if args.savetext then
        print("Player loaded into a game")
    end
    return ret
end
mystic river
#

G.hand.cards

white zinc
#

if i'm trying to add a custom UI box around where the money and round counter is, would this be the area in the code i would want to inject stuff into?

lament agate
#

how do you turn off this split screen

primal robin
lament agate
primal robin
#

or, move it to right edge, also works

lament agate
#

For some reason, this card is unusable with cards in hand despite having this as the condition

#

Nevermind. i put the code on the wrong fucking consumable

mystic river
#

yeah that would do it

lament agate
#

😭

#

SORRY

mystic river
#

I've done the same thing before
you won't believe how hard it is to debug when the problem is "you're editing the wrong file"

lament agate
#

BAHAHAHAHA

#

mood

#

😭

tulip pecan
#

Does anybody know what Drawstep order JokerDisplay uses for their information boxes?

maiden phoenix
#

They don't use drawsteps I think

#

@red flower

red flower
#

it's pure UI

#

it's attached to the joker so they get drawn when their children get drawn

tulip pecan
#

gotcha

red flower
#

may i know why youre asking

tulip pecan
#

I want to put a button at the bottom of a card while it's selected, and order -30 was putting it behind JokerDisplay

#

i got around it by doing order = (JokerDisplay and 9999 or -30) to show it on top, but i wasn't sure if there was a better way

#

I figured since you can always see joker display even when the card wasn't selected, putting the button on top would be fine when it's selected

rigid solar
#

In Pokermon, in Smeargle's loc_vars , there's this piece of code to add a tooltip about the Joker that's being copied. Can anyone explain to me how that works in the end? There's a bug I'm trying to fix where variables in the card's name aren't being included

red flower
rigid solar
#

which part

#

just name or all of it implying there's a simpler way

red flower
#

hmm no i see what it's doing

rigid solar
#

copy is the card being copied btw, not smeargle itself, kinda confusing by just looking at this code

red flower
#

try adding vars = new_config too

#

and be in the newest smods dev

#

basically "name_text" didn't accept vars until recently, smods got around that by making tooltip names use "name" (and it also adds styling)

#

but adding a tooltip without the center bypasses that i think

red flower
rigid solar
#

i'll test both

#

{set = 'Joker', key = other_center.key, config = new_config, vars = new_config } doesnt work

#

or well, it's the same as before

red flower
#

what if you do vars = { "test", "test" } just to see

rigid solar
#

that's really weird

#

so the variables for the text are taken from config, but for the name are taken in vars

#

??

red flower
#

đŸ€·â€â™‚ïž

rigid solar
#

Anyways thanks it works well

viscid talon
#
-- Wheelbarrow
SMODS.Joker {
    key = "wheelbarrow",
    config = { extra = { odds = 7, xmult = 1, xmult_gain = 0.2 } },
    pos = { x = 6, y = 3 },
    cost = 7,
    rarity = 2,
    blueprint_compat = false,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        local numerator, denominator = SMODS.get_probability_vars(card, 1, card.ability.extra.odds, 'j_hatch_wheelbarrow')
        return { vars = { numerator, denominator, card.ability.extra.xmult, card.ability.extra.xmult_gain } }
    end,

    calculate = function(self, card, context)
        if context.stay_flipped and context.to_area == G.hand and SMODS.pseudorandom_probability(card, 'j_hatch_wheelbarrow', 1, card.ability.extra.odds) then
            return {
                stay_flipped = true
            }
        end
        if context.press_play then -- quite literally pressing play
            local count = 0        -- adds backfacing cards to table
            for k, v in pairs(G.hand.highlighted) do
                if v.facing == 'back' then
                    count = count + 1
                end
            end
            if count > 0 then
                card.ability.extra.xmult = card.ability.extra.xmult + card.ability.extra.xmult_gain
            end
        end
        if context.joker_main then
            return {
                xmult = card.ability.extra.xmult
            }
        end
    end
}
#

how do i make it so the joker gains xmult ONLY for played cards, not scored cards

daring fern
viscid talon
#

no i want it to gain xmult for scored cards, not just unscored cards

tulip pecan
#

I've been learning how to make buttons attached to cards, but how would I attach a button to the area above the deck here?

viscid talon
#

what do i dooooo

daring fern
viscid talon
#

ok now it just doesnt work

tulip pecan
daring fern
queen crescent
#

yall where does cryptid hide its thematic set code

frosty dock
slim ferry
#

-# you should probably look at spectrallib code for the same thing though to avoid dealing with cryptid codebase

tidal hemlock
#

trying to make paperback recognize vortexes as a light suit but its not working

daring fern
queen crescent
cinder elk
#

oh no.

tidal hemlock
#

oh it works now, i think it was the priority because i changed it recently

tulip pecan
#

How come the 2 text elements are next to each other horizontally despite being inside a column node?

near coral
#

How can this be fixed to always debuff 2 random cards for each discard
The cards must be currently held in hand or in the deck

daring fern
# near coral How can this be fixed to always debuff 2 random cards for each discard The cards...
calculate = function(self, blind, context)
    if context.pre_discard then
        blind.effect.discarding = true
    end
    if context.hand_drawn and blind.effect.discarding then
        blind.effect.discarding = nil
        local cards = SMODS.shallow_copy(G.hand.cards)
        for k, v in pairs(G.deck.cards) do
            table.insert(cards, v)
        end
        for i=1, 2 do
            local card, index = pseudorandom_element(cards, self.key)
            if card then
                SMODS.debuff_card(card, true, self.key)
                table.remove(cards, index)
            end
        end
    end
end,
disable = function(self)
    for k, v in pairs(G.playing_cards) do
        SMODS.debuff_card(v, false, self.key)
    end
end,
defeat = function(self)
    for k, v in pairs(G.playing_cards) do
        SMODS.debuff_card(v, false, self.key)
    end
end,
near coral
red flower
tidal hemlock
#
SMODS.Joker {
    key = "celestine",
    atlas = "CelestJokers",
    pos = { x = 1, y = 0 },
    unlocked = false,
    rarity = 2,
    blueprint_compat = true,
    cost = 7,
    config = { extra = { blind_percent = 5, suit = 'celestin_Vortexes' }, },
    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.blind_percent, localize(card.ability.extra.suit, 'suits_singular') } }
    end,
    calculate = function(self, card, context)
        if context.individual and context.cardarea == G.play and
            context.other_card:is_suit(card.ability.extra.suit) then
            return {
                xblindsize = 1 - (card.ability.extra.blind_percent / 100)
            }
        end
    end,
   locked_loc_vars = function(self, info_queue, card)
        return { vars = { 20, localize('celestin_Vortexes', 'suits_singular') } }
    end,
    check_for_unlock = function(self, args) -- equivalent to `unlock_condition = { type = 'modify_deck', extra = { count = 20, suit = 'celestin_Vortexes' } }`
        if args.type == 'modify_deck' then
            local count = 0
            for _, playing_card in ipairs(G.playing_cards or {}) do
                if playing_card.base.suit == "celestin_Vortexes" then count = count + 1 end
                if count >= 20 then
                    return true
                end
            end
        end
        return false
    end```
the unlock condition is failing to appear and idk why
silk latch
#

Anyways, how would I get this to work properly?

red flower
near coral
daring fern
near coral
#

Alr

versed swan
#

that scares me

red flower
versed swan
#

ah, i see

wintry crater
#

how does the copy_card function work

red flower
#

it copies a card

#

next smods version has SMODS.copy_card

wintry crater
#

im trying to make it so you cant remove a card and if u try to it just comes back but it does not work so im pretty sure im using it wrong

red flower
#

you need to do a couple more things, check DNA's code

#

or wait for the smods one that handles all of it for you

wintry crater
red flower
#

it puts the card in that area

median rose
#

I'm trying to check when jokers are added to the area above, whether that be through spectral, tarots, or buying them from the shop. However, the code I have now seems to being getting planets, spectrals, and tarots as jokers as well. I thought I got over this by checking the joker area, but ig not. What do i need to fix in my conditional?

SMODS.current_mod.calculate = function(self, context)
    -- get when a joker is added to the slot
    if context.card_added then
        local card = context.card
        if not card then return end
        G.E_MANAGER:add_event(Event({
            func = function()
                print(card)
                if card.area and card.area.config.type == 'joker' then
                    game_state:add_joker(card)
                    game_state:print_jokers()
                end
                return true
            end
        }))
    end
red flower
median rose
red flower
#

yeah

#

unless you dont care about a mod adding jokers to other areas

median rose
#

nah, this is going to be just for vanilla

red flower
#

then that should be enough

wintry crater
#

without the emplace it just puts a card on screen that can be moved around but not selected but with emplace it just force closes the game but i need to put the card in the deck somehow so its not just floating on screen but i dont know how emplace works

red flower
#

G.deck:emplace(card)

slate turtle
#

question

#

how do i make a joker destroy an adjacent joker

#

(either a joker to the left or a joker to the right)

fading rivet
radiant bronze
#

does anyone know how to fix this from saying ERROR when trying to make it apply all previous stakes

#

nvm dont answer that i figured it out

median rose
#

Is there an event/hook/function for when the player presses the main menu button?

median rose
# daring fern `G.FUNCS.go_to_menu`

what file is that in? Follow up question, is there a way to open all the game code into vs code so I don't have to open one file at a time?

#

im using winrar

versed swan
#

Alternatively just extract the game exe like it's an archive file

daring fern
median rose
#

what's the difference between dump and game-dump

daring fern
median rose
#

Am I missing something here in order for this to work properly? I tried this without the self, but that didn't seem to make a difference

local go_to_menu_ref = Game.go_to_menu
function Game:go_to_menu()
    print("go_to_menu before")
    local ret = go_to_menu_ref(self)
    print("go_to_menu after")
    return ret
end
#

this is in my main file

red flower
#

somethingcom said G.FUNCS.go_to_menu

lament agate
#

is it possible to spawn a desired consumable inside of a pack for testing purposes

red flower
median rose
red flower
lament agate
red flower
red flower
median rose
median rose
#

i feel dumb

lament agate
#

Aren't we all

silk latch
lusty marten
#

are there any playing card template?

brazen rock
#

how would i make a spritesheet with all my custom jokers in it?

#

using aseprite to make them and im not sure how to do so

faint yacht
#

A grid of 71x95.

brazen rock
#

yeah but what i mean is putting all the jokers i've made into one spritesheet

naive coral
#

is there an event/hook/function for when the player clicks a card and it is selected?

naive coral
#

ty

#

how can i prevent a joker from being highlighted with a hook like that?

faint yacht
daring fern
keen totem
#

how do i check if the selected blind is small blind specifically

faint yacht
#

context.setting_blind and context.blind.config.blind.key == 'bl_small' iirc?

red flower
#

config.blind

lusty marten
#

are there any playing card template?

tranquil cypress
primal robin
fading rivet
primal robin
#

Shows it as-is

fading rivet
#

like attached to the card still or in an extra card area

primal robin
#

Scrolling technology in clutch once again

gilded blaze
#

I haven't tried the scrolling tho

#

can it do both ways (vertically and horizontally)

primal robin
#

yes

gilded blaze
primal robin
gilded blaze
#

that is such a nice way to satisfy both topics in a conversation

fading rivet
#

is there a list of tag contexts?

fading rivet
#

gotta make my own then ig

gilded blaze
#

huh, why does discord keep stray forwarding message from a previously cancelled forward

#

welp, at least it's a separate message I can delete

red flower
#

i added it reently

red flower
primal robin
#

You'll not believe it, manual checks

red flower
#

makes sense

#

i might do the same when im not feeling lazy

brazen rock
#

how would i check if a playing card has any enhancement on it?

red flower
brazen rock
#

much appreciated

primal robin
#

My peak checks for enhancement

frosty dock
primal robin
#

Because it's not calculate context

#

It's custom info context

#

It holds info_queue source, ability table, info_queue in various forms, to process it and display in separate UI in various forms

#

Like, serious shit is happening right here xd

frosty dock
primal robin
#

playing cards with centers as not enhancements exist

#

I want cover all of them

frosty dock
#

Wouldn't their set still be not "Default"?

primal robin
#

Yes but it's equal to check is key is not "c_base" isnt it

frosty dock
#

it is

primal robin
#

Also this is like chud

#

It's a check for card which created to display edition sticker etc in collection

#

Because, when card with seal in collection generates ui, it first adds a seal to info queue, and then somewhere inside this enigma it converts it into main description

#

If I'm not doing this result looks like this

final jewel
#

pixel_size = { w = 59 } how do I make this thing work

#

like for a Joker

final jewel
#

ok but it doesnt seems to work, idk

frosty dock
final jewel
#

1606b

frosty dock
final jewel
#

No

#

Like its just sticker are showed wrong on the card

frosty dock
#

hm

#

could be that pixel_size doesn't properly affect stickers

fading rivet
#

align

torn thunder
final jewel
final jewel
torn thunder
#

trrue oops

final jewel
fading rivet
#

is there a function called when a tag is created within the tag

#

or should I use my mod calclate with the tag added context

brazen rock
#

im struggling to understand the smods api docs quite a fair bit,
been looking around trying to figure out how to make things like custom blinds & tags but to no avail
are there any good tutorials on this or is there anything im able to use as a template to learn from?

slim ferry
brazen rock
#

thanks a lot

fading rivet
#

@radiant spire G.UIDEF.run_info()

radiant spire
#

Thank you so much! You're the best

naive coral
#
function CardArea:add_to_highlighted(card, silent, ...)
    if true then return nil end
    return StayTheStill(card, silent)
end```
#

how can i make this only work under a specific joker?

#

or just making one joker, i know true needs to be replaced but im not sure what with

#

i want one joker to not be highlighted when clicked, it doesnt matter that it cant be sold, because it destroys itself on click anyway

long sun
#

despite this card's atlas stating itself as px 71, py 67, and the card itself stating that it's px 71, py 67, the card displays stretched. why?

#

the hitbox is smaller, so at least that's working

slim ferry
#

do you have both pixel_size and display_size set on the card?

brazen rock
#

for whatever reason i cannot get this seal to work
no matter what i do it refuses to show up anywhere
the game and the file itself load fine, no crashes
i dont know what im doing wrong

red flower
#

do you know it's loading fine? is this your main file?

brazen rock
#

file has been saved

#

main.lua is loading this file (seals.lua)

fading rivet
#

can you put a print statement in the file to ensure its loaded

red flower
torn thunder
#

why r u sanity checking SMODS.Atlas

#

also

#

you have to put () after the assert()

#

its assert(SMODS.load_file(path))()

brazen rock
#

oh

#

yeah the seal shows up now

#

thanks

torn thunder
#

np

brazen rock
#

sorta just getting used to the smods api a little
still learning

primal robin
#

How crazy would be to ask add mod badge in collection for seals, edition, stickers, etc?

red flower
#

i made a note about that the other day lol

primal robin
#

I managed to extract them for my needs but have them in collection would be nice too

#

Editions actually have them, but stickers and seals is not

#

And blinds

#

But mainly seals and stickers

primal robin
#

Question. What naming for info_queue process will be better: before -> individual -> after or pre -> individual -> post?

fading rivet
#

before and after probably
consistent with hand scoring

versed swan
#

I was gonna say, whichever is used more often in other areas

primal robin
#

Another question: better have separate classes for before/individual/after processed, or use smth similar to SMODS.DrawStep, where there's list of cases to trigger on and then you manially filter them

#

nvm I will follow SMODS.DrawStep example

#

Technically I can name it all calculate_ui and this will be funny but I more like it call processing

#

Glossary.InfoQueueProcessor let's go

naive coral
#

how do i make a hook only work for a specific joker

daring fern
glossy dagger
#

I this pure bullshit or is actual code? (My first time coding a joker)

daring fern
naive coral
# daring fern What is the goal?

i am trying to hook CardArea:add_to_highlight in order to prevent one joker from being highlighted, so the goal is preventing a joker from becoming highlighted in the joker cardarea

glossy dagger
#

how i change it then?

glossy dagger
naive coral
#

and whats the joker trying to do

glossy dagger
#

i already messed up the code i think TwT

daring fern
naive coral
daring fern
glossy dagger
#

sorry if i make too many questions

naive coral
daring fern
glossy dagger
median rose
#

What is the event called for when the r key is held to reset a run

glossy dagger
#

Idk what i am even making

naive coral
# glossy dagger Idk what i am even making

SMODS.Joker {
    key = 'YourJoker',
    loc_txt = {
        name = 'YourJoker',
        text = {
            "{X:mult,C:white} X#1# {} Mult, Gains",
            "{X:mult,C:white}X#2#{} Mult every {C:mult}#4#[#3#]{} Hearts Scored",
        }
    },
    config = { extra = { Xmult = 1, XmultScalar = 0.2, Count = 6, CountOriginal = 6 } },
    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.Xmult, card.ability.extra.XmultScalar, card.ability.extra.Count, card.ability.extra.CountOriginal } }
    end,
    rarity = 1,
    atlas = 'YourAtlas',
    pos = { x = 0, y = 0 },
    cost = 1,
    calculate = function(self, card, context)
        if context.individual and context.cardarea == G.play and context.other_card:is_suit("Hearts") then
            card.ability.extra.Count = card.ability.extra.Count - 1
        end
        if card.ability.extra.Count <= 0 then
            card.ability.extra.Xmult = card.ability.extra.Xmult + card.ability.extra.XmultScalar
            card.ability.extra.Count = card.ability.extra.CountOriginal
        end
        if context.joker_main then
            return {
                Xmult_mod = card.ability.extra.Xmult,
                message = localize { type = 'variable', key = 'a_xmult', vars = { card.ability.extra.Xmult } }        
            }
        end
    end
}
#

there

glossy dagger
#

you just made the code?-

naive coral
#

indenting got lost in transit, but i tested and it works correctly

#

yeah

#

simple stuff

glossy dagger
#

thank you!

naive coral
#

youll learn after, good things take time

naive coral
glossy dagger
#

at least now i know how it works... i think

daring fern
naive coral
#

why so?

#

if it works it works right

daring fern
naive coral
#

is there a difference?

daring fern
naive coral
#

i see. i just copied some old code from my mod, didnt know there was a real difference

naive coral
glossy dagger
#

ngl, i was messing around with a friend's jokerforge mod (she let me do it) and i was trying to fix and optimize a joker with like 300 lines that didnt even work

#

jokerforge in their prime

naive coral
#

jokerforge is kind of bad tbh, i couldnt figure out the gui too well and i only got things working when i stopped using it

glossy dagger
#

because my mod were just jokers

#

when you touch anything more complex that "X happens, + 5 mult", it breaks

median rose
glossy dagger
#

It worked

#

After like easy 30 corrections to stupid thingys

#

thanks @naive coral

median rose
#

Can someone explain to me what .toml files are, and how to use them in this context? In my main file, I want to call a function when the wheel applies an edition to a joker. I'm looking at this code which is printing out the line in the screenshot. Kinda hard to see but it says "The wheel has applied Foil to Oops! All 6s" (https://github.com/nh6574/PlayLog/blob/6ae5f80776057377c2291dbb59d78d112dd9c27f/lovely/logging/consumables.toml#L78-L105)

My confusion is I don't see consumables being called anywhere in the repo, nor am I sure if I will be able to call the function I want since it comes from a metatable. Here is the pseudocode if that explains this better

-- in main.lua:
-- create custom object when mod is initialized 
-- when wheel is used, call function from custom object
daring fern
median rose
# daring fern All `toml` files in a `lovely` folder are automatically loaded.

so if I do something like the first for my main file, and the second for my toml, I shouldn't get any errors, and the toml will know what game_state is?

local game_state = GameState.new() --custom object
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "eligible_card:set_edition(edition, true)"
position = 'before'
match_indent = true
payload = '''
game_state.print()
'''
daring fern
primal robin
#

Damn I finally did it

glass scaffold
#

I've tried a few combinations of different randomization methods and lines to define variables, and yet, it won't debuff one single set, rather debuffs whatever the hell it feels like.

#

How do I force it to only randomize the number ONCE and use that to determine what set gets debuffed?

red flower
#

and don't use math.random, use pseudorandom

#

if you want one for the whole round do it in context.setting_blind instead

median rose
# daring fern No, because `game_state` is a local variable that only exists in that file.

so even this won't work if I refactor the game state to be a global singleton bc it's is also local in main?

-- game_state.lua
local GameState = {
    playing_cards = {},
    jokers = {}
}
function print()
   print("a")
end
return GameState
-- main.lua
local GameState = assert(SMODS.load_file('game_state.lua'))()
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "eligible_card:set_edition(edition, true)"
position = 'before'
match_indent = true
payload = '''
GameState.print()
'''
glass scaffold
#

[SMODS WildcardCollection "components/blinds.lua"]:444: attempt to index a nil value

frosty rampart
frosty rampart
frosty rampart
median rose
#

Right, it needs to be GameState.print

glass scaffold
median rose
#

Tables are difficult to wrap my head around when majority of languages you have worked with are oop

frosty rampart
#

understandable

#

lua is a very different language if you're used to oop

glass scaffold
daring fern
red flower
glass scaffold
red flower
#

well but. if you don't know how to do one effect i would try to learn before doing another one you also don't know how to do 😭

glass scaffold
#

You are also correct there. But no one ever said I was a good developer.

red flower
#

anyway, what's the new effect

glass scaffold
#

Either flips or debuffs the card.

red flower
#

i can see that but when

glass scaffold
#

on draw

red flower
#

then yeah I would use SMODS.debuff_card there but you need to remember to rebuff them after

#

also this will debuff and flip cards that were already debuffed or flipped before

fading rivet
#

is there a function called within the tag object when its added to your current tagd

glass scaffold
daring fern
versed swan
#

are variables in multiboxes a thing now?

#

(localization)

glass scaffold
#

Wait, which do I have to apply that to?

#

Both or the one in defeat

daring fern
silk latch
lusty marten
red flower
#

the only new multibox thing is main_start and main_end support

versed swan
#

Oh wait shit I got confused

versed swan
versed swan
#

Finally I dont have to die making ui for my stupid legendary idea

summer furnace
#

So I've been looking an looking, but can't find an answer anywhere

How do I make a Joker retrigger itself, until a random generated number is 2?

        if context.retrigger_joker_check and context.other_card == card then 
            return { repetitions = 1 }
        end
        if context.joker_main then
            baller = pseudorandom('baller', 1, 2)
            print(baller)
            if baller == 1 then 
                return {
                    message = 'Balling!',
                    Xmult_mod = 2,
                    repetitions = 1
                }
            end
        end
    end ```
I have this code but I cannot find out how to do this
daring fern
summer furnace
long sun
#

here it is with both

daring fern
faint yacht
#
pixel_size = { w = 71, h = 77 }

whilst the actual atlas itself is still 71x95 aligned.

long sun
#

yay thanks ^^

summer furnace
keen totem
#

what does the base game use as a context for an end of round effect?

#

egg and rocket, when i played with them in comparison to my modded jokers, always triggered before my end of round effects

#

also, is it possible to fix the shader of Foil having the center of the shader offset from the middle of the joker if the joker isnt 71x95

keen totem
#

it triggers before any of my jokers

#

even though they also use end_of_round

daring fern
keen totem
#

is there any reason to ever use context.blind_defeated over context.end_of_round

summer furnace
# summer furnace nvm fixed it, I misunderstood the optional feature thingi 👍

to be honest I do not know what I did, but it broke and I do not have a clue why 😭

        if context.retrigger_joker_check and context.other_card == card then
            local repetitions = 0
            local number = pseudorandom('seed', 1, 2)
            while number ~= 2 do
                repetitions = repetitions + 1
                number = pseudorandom('seed', 1, 2)
            end
            return {repetitions = repetitions}
        end
        if context.joker_main then
              return {
                  message = 'Balling!',
                  Xmult_mod = 2,
              }
        end
    end ```Here is the code
(I have this at the top:```SMODS.current_mod.optional_features = function()
    return {
        post_trigger = true,
        retrigger_joker = true,
        quantum_enhancements = true,
        object_weights = true,
        cardareas = {
            discard = true,
            deck = true
        }
    }
end```)
daring fern
summer furnace
keen totem
#

how would you level up a target poker hand once

#

every example ive tried to find is either hardcoded or uses a mod's custom API

daring fern
viscid talon
#

@sour rivet i think you need to make a loop

#

everything is a key (cards, jokers, etc) and you would need to loop through #G.hand.highlighted (i think) and check if the card's id is 2 or lower

#

i have a joker thats very similar that ill show you

red flower
#

you loop through context.scoring_hand or context.full_hand

#

G.hand.highlighted doesn't have anything during scoring

sour rivet
#

Right! Admittedly even these terms are a little foreign to me still, as this is my third(?) time touching lua scripts, but I think I can understand some logic..

viscid talon
#
-- Seven Sisters
SMODS.Joker {
    key = "sevensisters",
    pos = { x = 7, y = 0 },
    config = { extra = { xmult = 3.5 } },
    cost = 9,
    rarity = 3,
    blueprint_compat = true,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.xmult } }
    end,

    -- Code by Somethingcom515
    calculate = function(self, card, context)
        if context.joker_main then
            local passed = true
            for k, v in pairs(context.full_hand) do
                if v:get_id() ~= 7 then -- if even one card is NOT 7, its false. ~= is the lua equivalent of !=
                    passed = false      -- the local "passed" variable is set to false
                end
            end
            if passed then
                return { xmult = card.ability.extra.xmult }
            end
        end
    end
}```
red flower
#

but yeah that code is basically it

viscid talon
#

i got super sevens mixed up with wheelbarrow 😭😭

#

but yeah

#

check through context.full.hand or context.scoring.hand

#

a local variable (you can name it whatever you want) will check if every card is ONLY 2 (or less)

#

and if it isnt, it will return a false value, and the joker will not trigger the xmult

#

here are some notes i made

#

k = key
v = value


the code above runs a loop for each corresponding key within the table.
everything within a table (whether its cards, blinds, etc) is assigned a key.


everytime the loop runs in the code, [k] is the index within the context (your full hand) while [v] is the card object itself. think of [k] as a search string and [v] as the card object. your loop is checking each card's ID. if even one of them ISNT a 7, the code will not run, hence why its set to false


credit to Somethingcom515, Meta and notmario for teaching me!

#

lua is a strange language where roughlyneverything has a table

sour rivet
sour rivet
#

(again, my coding experience is not a lot so pretty much everything is new. Feels like I need to learn to breathe here)

red flower
#

i would also recommend not naming them k and v and picking more appropriate names for each table you loop through

red flower
sour rivet
#

Probably something distincitve enough in that'a'case, yes-

#

Would 'k' and 'v' cause problems with other cards trying to use them?

red flower
#

no because the variables only exist in the loop

sour rivet
#

So it's moreso a matter of legibility?

red flower
#

yes

sour rivet
#

Aha!

viscid talon
#

conflicting info 😔

red flower
#

?

sour rivet
#

Another question! Can I possibly vary the pitch of a potential sound file used?

#

'Stead of going play_sound("modpack_soundbyte", 1, 0.7),
, have the program, say, pick a random value between 1.1-0.8 for pitch, then 0,7 for the volume?

sour rivet
red flower
sour rivet
#

The card makes a sound once it realizes the hand only contains 2's, but it repeating the same sound effect over and over can get grating-

red flower
#

yeah you can just use math.random() for it

sour rivet
#

I am also struggling with timing a little. The sound plays a little earlier than I'd like. I'm skimmign through the documentation to see if i've missed anything

red flower
#

instead of using play_sound you might want to return sound = "key" so it plays at the appropriate time

#

you would need a message too tho

red flower
#

you shouldn't call functions in the return

sour rivet
#

In my defense I took it from another mod that is doing things a little differently it seems-

#

I'll keep that in mind!

red flower
#

card = card doesn't do anything btw

sour rivet
#

B-But it's funny.

primal robin
#

sanity check

sour rivet
#

Exactly!

#

Despite everything, you're still spaghetti.

red flower
#

smh

sour rivet
red flower
#

it's a remnant from old code that is used in vanilla but not smods, and it leads to people believing they should change card = something when they want to change where the message is displayed instead of using message_card

sour rivet
#

This is good to know! Thank you!

viscid talon
#

it doesnt matter either way

#

if its only for one loop, who cares right?

sour rivet
#

I feel like it's a matter of taste!

red flower
#

i don't think it's taste necessarily, naming variables appropriately is very important

red flower
versed swan
# viscid talon i know its just, k and v is what i was told to use in the past and its what the ...

I think it's common to teach programmers to use arbitrary variable names in for-loops, like in Python they might show for i in range(...): or for x in list: - or in JavaScript: for (i = 0; i < arr.length; i++) {...

But in practice it ends up leading to difficult-to-follow code. In particular, the Lua extension for most code development environments is often not smart enough to mark the data type/class that objects in an iterated table are. Hence, naming variables, especially in for-loops is important

#

This is one of those things you, uh, kinda have to unlearn

red flower
#

I personally think it's fine for numbers, i still use i a lot but even in python when I'm iterating through a list I also try to use proper names

versed swan
#

(A more proper variable name, in a sense, would be index, but bleh)

primal robin
red flower
#

nice

primal robin
#

Probably multiple pages is not happening because it creates difficulties in terms of reloading ui

#

So big scrolling only way to save us

wintry solar
#

This is not what I envisioned the glossary to be but I guess it’s sort of useful

tulip pecan
#

How does the vanilla standard pack choose some cards to be enhanced? I'm looking at the VanillaRemade code but it doesn't return enhancement like I assume it would. I'm wanting to modify the chance that a card is enhanced.

red flower
#

enhanced_poll is what you need

tulip pecan
red flower
tulip pecan
#

any card anywhere yes

red flower
#

have you checked the code for the Illusion voucher?

#

you could do the same but with enhancements and also checking for modify_booster_card

cinder elk
#
SMODS.Joker {
    key = 'galacticnova',
    atlas = 'StarterPackJokers',
    pos = { x = 2, y = 1 },
    rarity = 1,
    blueprint_compat = true,
    cost = 2,
    discovered = true,
    loc_vars = function(self, info_queue, card)
        local numerator, denominator = SMODS.get_probability_vars(card, 1, card.ability.extra.odds, 'j_stpk_galacticnova')
        return { vars = { card.ability.extra.mult, numerator, denominator } }
    end,
    calculate = function(self, card, context)
        if context.using_consumeable and not context.blueprint and context.consumeable.ability.set == 'Planet' then
            card.ability.extra.mult = card.ability.extra.mult + card.ability.extra.mult_mod
            return {
                message = localize { type = 'variable', key = 'a_mult', vars = { card.ability.extra.mult } }
            }
        end
        if context.joker_main then
            return {
                mult = card.ability.extra.mult
                
            }
        end
    end
}```

trying to make it so that it has a 1/10 chance to be destroyed at the end of the round like gros michel, BUT gain mult like constellation, except it's mult and not x mult
red flower
#

what's the problem

cinder elk
#

i dont know where exactly to put the destroy stuff

#

thing

#

it's weird

red flower
#

it's a separate context so just have it as a separate if condition

long sun
#

haiiiii so i'm trying to figure out CanvasSprites on UI

#

i have this code, but:

  1. the canvassprite doesn't appear
  2. changing its w and h does nothing to the size of the box
#

can anyone help me learn how to use these? it's my first time, sorry

tulip pecan
#

is it possible to change language color formatting ({X:attention,C:white}#7#) through local vars? I would like text to change color based on a number defined in local vars

fading rivet
#

How can I get and modify the calculated score?

#

before its added the current score, but after chips and mult are multiplied

glass crown
#

okay, i know this is a complicated question, im mostly just looking for a little direction:
does anyone know how cryptid does the thing where you select the specific type of deck by clicking on it? specifically with a vanilla deck? or, alternatively, could someone point me to how i could do a "tainted characters" kinda thing for decks? pressing a button and switching to a variation of the deck, basically

fading rivet
slim ferry
#

it does in fact do that

red flower
fading rivet
#

thx

red flower
#

there isn't like a final final scoring step because then it would have the same problem as final scoring step where it wouldn't really be the final thing lol

fading rivet
#

lol

#

looking into this it seems I need to change SMODS.calculate_round_score

silent sail
#

do decks use info queues differently?

#

cause i copied and pasted this from my spectral and it crashes

#
loc_vars = function(self, info_queue, card)
        info_queue[#info_queue + 1] = G.P_SEALS["baggutro_blackseal"]
    end,
slim ferry
#

decks do not use info_queue at all currently

silent sail
#

oh

#

ah

#

ok then

slim ferry
#

i dont think there is a way to add a seal tooltip for a deck without galdur

#

or until galdur in smods

tulip pecan
#

How would I add Text Motion Modifier 1 (the one that makes the word "probabilities" bounce around on oops) to a text UI element? I think it's possible, since every joker's name when hovering has Modifier 2 applied to the text

slim ferry
#

pretty sure you would have to use G.UIT.O with a DynaText object, not sure how the effect would be applied from there but i cant imagine its that complicated

#

you could probably look at how vanilla localization handles creating the dynatext

red flower
fading rivet
#

What function would I need to hook to get when a tag is clicked, since Tag.click seems to be nil

frosty dock
#

you'd want to patch into Tag:generate_UI and set tag_sprite.click

fading rivet
frosty dock
#

for slightly more compatibility, you can do a double hook

#

hook Tag:generate_UI and inside of that hook, hook self.tag_sprite.click if it exists and create it otherwise

fading rivet
#

ill do that then, thx

#

thx

frosty dock
#

i'm looking at a source dump that has cryptid for some reason, so I have no clue if the function actually exists by default. i don't think it does though

red flower
#

i think click should be there because it extends Node but idk

frosty dock
#

right, it's actually a real Sprite

#

i forgor

tidal hemlock
#

got an "unexpected symbol near }" error here (line 102) and i have no clue why

frosty dock
#

get a lua extension that checks your syntax

#

it looks like you're missing an end

naive coral
#
function CardArea:add_to_highlighted(card, silent, ...)
      if self.config.center.key == "j_Krypton_LiamCat" then 
        return nil 
    end         
    return StayTheStill
end

what am i doing wrong to make this hook not work properly? i am trying to make a joker not become highlighted, and it just crashes with this error

fading rivet
frosty dock
#

yeah that makes sense

#

you can just hook it without caring about if it exists or not

#

-# the rare double hook

red flower
wintry solar
#

you also need to pass the arguments to the StayTheStill call

frosty dock
#

also you have to return StayTheStill(self, card, silent, ...)

#

whoops, the double

wintry solar
#

so in sync

naive coral
#
function CardArea:add_to_highlighted(card, silent, ...)
      if card.config.center.key == "j_Krypton_LiamCat" then 
        return nil 
    end         
    return StayTheStill(self, card, silent, ...)
end```
this?
frosty dock
#

that looks correct

fading rivet
tidal hemlock
fading rivet
frosty dock
#

or rely on the fact that set_ability isn't called for collection tags, not sure how that would look like though

tidal hemlock
fading rivet
wintry solar
#

and likely move it to the bottom

fading rivet
#

if raised_card == context.other_card is out of scope

#

so raised_card will always be nil

ashen adder
#

Im trying to fix the flickering sticker in cryptid(currently does nothing lol)

    calculate = function(self, card, context)
        if not card.ability.flick_tally then
            card.ability.flick_tally = 5
        end
        if card.ability.set == "Joker" then
            if context.post_trigger and context.other_joker == card then
               ...other code
    end,

The main problem seems to be that you need to fix other_joker to other_card but then the issue becomes that it triggers everytime the joker retriggers
and also doesnt trigger for jokers that activate on blind select(and maybe others i didnt test much lol)
Is there an easy way to fix this?

tidal hemlock
daring fern
ashen adder
ashen adder
fading rivet
wintry solar
tidal hemlock
wintry solar
#

you don't need to move anything else

tidal hemlock
#

so its functional, apart from the part where it does something

#

currently it does nothing, but it doesnt crash

wintry solar
#

what's it supposed to do?

fading rivet
tidal hemlock
wintry solar
#

change local temp_ID = 15 to local temp_ID = 0

tidal hemlock
#

oh yeah that makes sense

wintry solar
#

you're starting your highest value as something higher than any card

tidal hemlock
wintry solar
#

can you post your updated code?

tidal hemlock
#
SMODS.Joker {
    key = "spotlight",
    atlas = "CelestJokers",
    pos = { x = 2, y = 0 },
    rarity = 2,
    blueprint_compat = false,
    cost = 6,
    config = { extra = {suit = 'celestin_Vortexes' }, },
    loc_vars = function(self, info_queue, card)
        return { vars = {localize(card.ability.extra.suit, 'suits_plural') } }
    end,
    calculate = function(self, card, context)
    local raised_card = nil
        if context.individual and context.cardarea == G.hand and not context.end_of_round then
            local temp_ID = 0
            for i = 1, #G.hand.cards do
                if temp_ID <= G.hand.cards[i].base.id and not SMODS.has_no_rank(G.hand.cards[i]) then
                    temp_ID = G.hand.cards[i].base.id
                    raised_card = G.hand.cards[i]
                end
            end
     if raised_card == context.other_card then
                if context.other_card.debuff then
                    return {
                        message = localize('k_debuffed'),
                        colour = G.C.RED
                    }
                else
                    return {
                        SMODS.change_base(v, card.ability.extra.suit)
                    }
                end
    end
end
end
}```
#

woah code wall moment

#

kinda ripped all this from raised fist

wintry solar
#

oh

#

you're trying to use SMODS.change_base on v instead of context.other_card

tidal hemlock
#

oh woops, i ripped it from something that used v

fading rivet
#

how can I differentiate between creating a tag when loading a save and creating a tag normally

#

i'm seeing self.from_load in tag:load but its not appearing in the object i see on the screen

ashen adder
#

so do i add something like not context.retrigger to stop it from triggering?

fading rivet
#

context.check_retrigger iirc

ashen adder
#

oh okay but then what about like jokers that activate on blind select is there also some context for that?

frosty dock
frosty dock
brazen rock
#

what would be the best way to load everything in a folder at once instead of having to do this for every line

fading rivet
#

i vaguely remember seeing it like 3 months ago

fading rivet
fading rivet
#

but you can use SMODS.NFS iirc to get directories and the folders within then

#

PPU probably has somethign

fading rivet
brazen rock
#

how would i do this

fading rivet
brazen rock
#

Oh

#

đŸ„€

ashen adder
#

hmmm yea adding not context.retrigger_joker didnt do anything

brazen rock
#

i have a function that does this if thats what you mean

fading rivet
brazen rock
#

ah

#

also do things like seals have to be in separate scripts or can i merge them into one

fading rivet
#

you can use any amount of files as long as it fits lua syntax

#

I have all of these for example

brazen rock
#

neat

#

thanks for the help

daring fern
fading rivet
#

is there a way to differentiate or should I use ability

daring fern
fading rivet
#

assuming sprite is what is given by dp.hovered

#

this is where it needs to be checked

daring fern
fading rivet
#

it doesn't though

#

bruh it froze

#

when it reloaded the run I had another banana

#

cuase the on_obtain function was called again

daring fern
fading rivet
#

ah

naive coral
#
SMODS.Consumable {
    key = "Krypton_GrindStone",
    set = "Tarot",
    object_type = "Consumable",
    loc_txt = {
        name = "Grindstone",
        text={
        "{X:attention,C:white}#2#X{} the {C:chips}Chip Value{} Of",
        "{C:attention}#1#{} Selected {C:inactive}Stone{{} Card(s)",
        },
    },
    config = { max_highlighted = 1, Multiplier = 2, enhancement = "m_stone" },
    loc_vars = function(self, info_queue, card)
        info_queue[#info_queue + 1] = G.P_CENTERS.m_stone    
        return { vars = { card.ability.max_highlighted, card.ability.Multiplier } }
    end,
    pos = { x = 1, y = 0 },
    atlas = "TarotAtlas",
    unlocked = true,
    cost = 3,
    use = function(self, card, area, copier)
        local increasechips = math.ceil(G.hand.highlighted[1]:get_chip_bonus() * (card.ability.Multiplier - 1))
        if increasechips > 0 and SMODS.has_enhancement(G.hand.highlighted[1], card.ability.enhancement) then
            G.hand.highlighted[1].ability.perma_bonus = (G.hand.highlighted[1].ability.perma_bonus or 0) + increasechips
        end        
    end,
    can_use = function(self, card)
        if #G.hand.highlighted <= card.ability.max_highlighted and SMODS.has_enhancement(G.hand.highlighted[1], card.ability.enhancement) then
            return true
        end
    end,
    in_pool = function(self, args) 
        for _, playing_card in ipairs(G.playing_cards or {}) do
            if SMODS.has_enhancement(playing_card, 'm_stone') then
                return true
            end
        end
        return false
    end
}```
how can i make my tarot card not crash the game when highlighted without a card highlighted?
daring fern
ashen adder
#

Wait so if it checks context.post_trigger then does retrigger dont matter or something? Do i change it on trigger maybe idk

fading rivet
#

infinite banana glitch has been patched

naive coral
#

does pinned pin a joker to a slot? if so, can i make it always pin a joker to the 3rd slot over

keen totem
#

how does the base game hide the poker hand, level, and base chips/mult when one of the cards is face down

#

and can you replicate that

fading rivet
#

any idea why the tags set_ability isn't being called

keen totem
#

how do i check if a planet card actually has a hand_type

#

im trying to level up the hand_type that a certain planet card has, but planet cards that dont have a hand_type just level up literally every hand_type

fading rivet
keen totem
#

what hand_type do modded jokers that dont directly upgrade a specific poker hand have

fading rivet
#

you'd have to look at them individually

keen totem
glass crown
#

i have no clue where to start with this so im asking here, how would one go about making a like "tainted characters" kinda thing for decks? like, press / click a button and the deck select screen changes and theres new decks there?

fading rivet
#

then modify some global that is used when starting a run with your deck

daring fern
glass crown
keen totem
#

i see that cryptid has "hand_types" as a config for some planet cards
is that a base smods thing or something they added

red flower
#

it will have ways to add screens to customize decks

keen totem
#

alr

#

i didnt want to add a check for it if it was cryptid specific

red flower
#

mine also has that but i use joy_hand_types :3

keen totem
#

something that ive noticed with the Foil shader, and likely other shaders, is that on jokers with a pixel size other than 71x95, the "center" of the shader gets offset from the center of the sprite

#

is there any way to fix this on the side of the joker or is this a shader issue

#

the base game has the issue so i assume its probably not possible to fix

frosty rampart
#

yea i'd imagine it's a shader issue, probably hardcodes the center's position rather than determining it on the fly based on the card's dimensions

glossy dagger
#

someone knows what variable or something use so a joker show the initial deck size (Like erosion)

frosty rampart
#

G.GAME.starting_deck_size

glossy dagger
#

i put that in the text?

fading rivet
frosty rampart
glossy dagger
weak grove
fading rivet
red flower
#

i hate jokerforge code

fading rivet
#

that should be crashing, no?

#

your only returning 1 variable

#

your loc_txt requests 2

weak grove
#

What about that?

fading rivet
fading rivet
fading rivet
weak grove
fading rivet
weak grove
#

1 sec

keen blaze
#

the #1# and #2# (image 1) point to positions within the vars table that you return in loc_vars (image 2), however because you only have one value in the vars table of loc_vars, #2# is returning as nil

weak grove
#

ohhhh

primal robin
#

Peak balala modding