#💻・modding-dev

1 messages · Page 672 of 1

dapper sun
#

sad

slim ferry
#

Well no you can just use the generate_ui function

#

But that requires pretty intricate knowledge of how card ui is structured iirc

dapper sun
#

so i'd need to hook generate_ui?

slim ferry
#

No just a generate_ui function in the definition

dapper sun
#

ah ok

slim ferry
#

I forget what arguments it has but its in some smods wiki page

#

Probably

dapper sun
#

bc i'm trying to add the animated tenna text to a joker

mystic river
#

yep
when something like this happens the error is the second return value, so you might want your loader to catch that so you know what went wrong

analog spoke
dapper sun
#

for context

slim ferry
#

Oh yeah you should wrap your file loading in assert

#

so it actually shows the error

analog spoke
slim ferry
#

Yeah

#

Make sure you put the function call outside the assert though

#

So you have assert(SMODS.load_file(...))()

analog spoke
#

mmm I see, thank you! I did make that mistake just now lol

just curious, but what is "assert"? like, what is it doing? Just curious! Want to know more so I can hopefully be a better coder in the future <3

sleek valley
#

what's the code to check if a specific voucher has been purchased during that run?
trying to make a consumeable with an in_pool function that only returns true with that voucher

#

-# dont question why im doing it this way, i've scuffed my code in ways i dont want to fix right now

dapper sun
#

#SMODS.find_card('voucher_key')>0

slim ferry
slim ferry
dapper sun
#

oh ok

#

i should use that also

slim ferry
#

Idk if find card works with vouchers

#

It should but im not Certain

analog spoke
dapper sun
analog spoke
#

speaking of, another code question rq, when and when not should I put a , after an end? I'm only asking because one one side, if I do include one on a specific line, it causes an error telling me to remove it, and if I don't, an error is also caused but instead for the reason of my jokers that belong to the custom rarity "attempting to get inserted into an empty pool", whatever that means?

slim ferry
#

Commas are used to seperate values in tables and function calls, so it should only be after the end of a function defined inside of a table/function call

#

Inserting into an empty pool just means the rarity/consumable type set on the object doesnt exist

#

Make sure you put the mod prefix behind your rarity key in the joker definitions

analog spoke
#

Thanks for all the help Eris! 😊

long sun
#

when creating a card with Card(), how can i change the size of the card?

sleek valley
slim ferry
#

you forgot the v prefix for vouchers

dapper sun
#

what's wrong with this AnimatedSprite(0,0,0.5,0.5,G.ANIMATION_ATLAS.elle_tenna_its_tv_time,0)

sleek valley
dapper sun
#

wait does it need to be a table maybe

#

am i have stupid

slim ferry
#

You should probably use SMODS.create_sprite

#

I think

dapper sun
#

ty

long sun
#

also, in in_pool, how can i get the key of the card?

slim ferry
#

wdym

long sun
#

ah no wait it's alright ^^;;;;

#

nevermind on that one

dapper sun
slim ferry
#

I dont...

dapper sun
#

oh i think it's to do with my object node

#

i'll just uhhh

#
local cardpopup_ref = G.UIDEF.card_h_popup
function G.UIDEF.card_h_popup(card)
    local ret_val = cardpopup_ref(card)
    local obj = card.config.center
    if obj and obj.key == "j_elle_tenna" and obj.discovered then
    local tvtime_sprite = SMODS.create_sprite(0,0,.5,.5, "elle_tenna_its_tv_time", {x=0,y=0})
    
    local title = {
        n = G.UIT.O,
        config = { object = obj }
    }

    ret_val.nodes[1] = title
    end
    return ret_val
end```
sleek valley
#

if there's one thing i've learnt from my own fuck ups, it's that if the error code references files outside your mod, the entire block you added is likely screwed lol

dapper sun
#

doing it with a hook bc generate_ui means rewriting all the ui stuff

#

i think

analog spoke
#

okay, what obvious mistake did I make this time lmao nsdkfj heh sndfk

long sun
#

or more generally, how do you change the size of a card?

dapper sun
#

the 3rd and 4th arguments are width and height

long sun
#

o ^^

#

thanks

dapper sun
#

if you set them to G.CARD_W*.75, G.CARD_H*.75 then they'll be 0.75x the normal size

long sun
#

thankuthanku

dapper sun
#

yw

red flower
long sun
#

what does this crash tend to mean ;u;

Oops! The game crashed:
game.lua:2831: bad argument #1 to 'push' (boolean, number, string, love type, or table expected)

dapper sun
long sun
#

something to do with saving it seems

red flower
long sun
#

o ^^

long sun
#

i have this, is this the problem? i have another joker doing something similar, and also not crashing

local main_menu_ref = Game.main_menu
Game.main_menu = function(change_context)
  local ret = main_menu_ref(change_context)

  for k, v in pairs(G.P_CENTERS) do
    v.in_pool = v.in_pool or function()
      return true
    end

    local in_pool_ref = v.in_pool
    v.in_pool = function()
      if not G.jokers then return in_pool_ref() end
      for _, vv in ipairs(G.jokers.cards) do
        if vv.config.center.key == "j_phanta_cataclysm" then
          if vv.ability.extra and (vv.ability.extra.card1 == v.key or vv.ability.extra.card2 == v.key) then
            return false
          end
        end
      end
      return in_pool_ref()
    end
  end

  return ret
end
slim ferry
#

fyi this hooks the function once every time you go to the main menu

#

You should also probably just hook SMODS.add_to_pool for this

long sun
#

oh 🥀

analog spoke
dapper sun
#

how do i fix the positioning

long sun
#

so like so?

local smodsatpref = SMODS.add_to_pool
function SMODS.add_to_pool(prototype_obj, args)
  if not G.jokers then return smodsatpref(prototype_obj, args) end
  for _, v in ipairs(G.jokers.cards) do
    if v.config.center.key == "j_phanta_cataclysm" then
      if v.ability.extra and (v.ability.extra.card1 == prototype_obj.key or v.ability.extra.card2 == prototype_obj.key) then
        return false
      end
    end
  end
  return smodsatpref(prototype_obj, args)
end
slim ferry
#

i Think so

long sun
#

alrighty

#

thanks ^u^ will test

dapper sun
# dapper sun how do i fix the positioning
local tvtime_sprite = SMODS.create_sprite(0,0,1,1, "elle_tenna_its_tv_time", {x=0,y=0})

local title = {
    n = G.UIT.R,
    config = { align = 'cm', padding = -0.1, no_fill = true },
    nodes = {
        {
            n = G.UIT.O,
            config = { object = tvtime_sprite }
        }
    }
}```
long sun
#

in that case, try setting minw

dapper sun
#

ty

long sun
#

npnp

dapper sun
#

nope :p

long sun
#

aw :<

#

ah wait, try setting the minw of the UIT.O

#

that might work

dapper sun
#

i've tried it on both

long sun
#

damn 😔

dapper sun
long sun
#

made for each other!

dapper sun
#

true!

long sun
#

except mine was because i misplaced a UIT.B

dapper sun
long sun
wanton jolt
#

whats the dragging state for a joker called

#

implying joker is "card"

sleek valley
# long sun 🙏

pics like these are why i love programming
you will never see anything quite as broken as this in any other profession lmao

sleek valley
wanton jolt
#

so if card.states.drag.can = true?

#

as in if this card is being dragged

#

around?

sleek valley
#

ohhh no, it's to toggle if the card is draggable

wanton jolt
#

ohh thats also useful i guess

sleek valley
#

what are you trying to use this for exactly? maybe there's something else that'd fit

wanton jolt
#

a joker

#

i want it to calculate something when its being dragged around

sleek valley
#

aahhhh
well ima be honest, im not sure if that's even possible .w.

wanton jolt
#

i mean theres one for being highlighted

#

and the card sways one way

slim ferry
wanton jolt
#

when you drag it, so theres something to detect that

#

yeah

red flower
#

check G.CONTROLLER.dragging.target

slim ferry
#

Or when it starts/stops being dragged

wanton jolt
#

just dragged around in general

#

oh i found something

#

i can make a new context

slim ferry
#

That probably isnt a good idea for something thats constantly happening

wanton jolt
#

you just calculate context and return drag target and a bool

slim ferry
#

okay but when are you going to calculate that context

wanton jolt
#

if the drag_target = card

slim ferry
#

Yeah but

wanton jolt
#

and on card:drag

slim ferry
#

when

#

in what function

sleek valley
#

context is used more for like blocks of the game

think of it like DnD initiative kinda

#

not a good idea to make a context for dragging a card

slim ferry
#

If you just want to check if the card is being dragged all the time you should just check that in update

#

Probably

wanton jolt
#

doesnt update just send something every tick

red flower
#

yeah

#

it would be more helpful if you tell us what you are trying to accomplish lol

sleek valley
wanton jolt
#

i just want it to gain something when the card is being dragged around

red flower
#

i mean it could be a context on drag/stop drag

slim ferry
wanton jolt
#

what do you mean

slim ferry
#

idk what else im meant to say

#

also what do you mean by "gain something"

#

Like scaling or?

wanton jolt
#

chips

#

or mult

#

like anything

sleek valley
slim ferry
#

scaling or not

red flower
#

how would you word the effect

slim ferry
#

Yeah just

#

Say what it does

wanton jolt
#

fuck i dont even know yet i just know it has something to do with dragging because i'm turning the drag tool from roblox into a joker lol

slim ferry
#

Oh

dapper sun
#

how do i change the framerate of animated sprites

red flower
#

well the options are probably do a context on drag/stop_drag or check G.CONTROLLER.dragging.target in update imo

wanton jolt
#

ok

slim ferry
#

Well if you want it to gain something constantly over time while its being dragged just check if its being dragged in update and then increment whatever value by the value/second multiplied by dt

#

I think

dapper sun
past spade
#

this has no effect, am I using the wrong key?
SMODS.Rarity:take_ownership('Legendary', { badge_colour = HEX('ffffff'), }, true )

slim ferry
#

im assuming the badge colour wont be set properly since vanilla rarity colours are set differently from smods ones

#

You should change G.C.RARITY[4] instead

past spade
#

not actually trying to set badge color, just using it to see if I got the right key. But should take ownership not be used for rarities?

slim ferry
#

Not sure, depends on the goal i think

past spade
#

making a joker that makes legendaries appear in shop/anywhere. Was trying to implement it by modifying legendary's get_weight function

red flower
#

does G.GAME.legendary_rate work

#

_mod not rate

slim ferry
#

It wouldnt

#

Because thats a multiplier

#

I would look into how all in jest does it

red flower
#

true

past spade
slim ferry
#

it does?

#

well

#

You could just use the same implementation but without it scaling

past spade
#

yeah alright, guess theres no simpler way

dapper sun
#

how do i make a card's calculate acknowledge values that changed during the scoring animation

daring fern
sour garden
#

how do you get a joker's rarity from a custom pool, like the Food pool when doing SMODS.Create_Card?
i tried doing

SMODS.add_card {
    set = 'Food',
    rarity = 'Uncommon',
    key_append = 'food_uncommon_joker_spawn'
}

but this lets any rarity of food joker spawn, not just uncommon

red flower
#

you would need to set up rarities in the ObjectType

daring fern
sour garden
#

looks like it's working! thank you

rapid stag
#

i had an idea for an effect that would guarantee the appearance of a soul in the next opened spectral or arcana pack, but i'm not sure how that could be implemented

mystic river
#

if condition and (set equals tarot or set equals spectral) and soulable equals true then forced key equals soul, return create card ref

#

with possibly some other necessary tweaks

rapid stag
#

i did have an existing create_card hook. so like this?
(i return RV later)

mystic river
#

you would want to check that soulable is true, otherwise this could apply to e.g. shop cards or purple seal cards

daring fern
long sun
#

i'd like to localise a table of formatted text, and put it in my UI. how do i do that?

rapid stag
#

oh, i have that func on hand, one sec

#

SMODS.localize_box

long sun
#

yay thanks ^u^

#

how do i use it?

rapid stag
#

i can't recall exactly what i knew about this when i originally implemented it, but i use it in a dummy center i set up to be attached to info_queue to create dynamic tooltip text

basically what i do here is i put set myText here to some kind of formatted text like

{
  'This {C:joker}Joker{} gains',
  '{X:mult}X#1#{} Mult for every',
  'repetition of the past two weeks',
  '{C:inactive}(Currently {X:mult}X#2#{C:inactive})'
}

and the loop in that will iterate through that table and parse each individual string into UI text to look how you'd expect it to

primal robin
#

good enough

rapid stag
#

so localize_box takes individual string values, but you can make a helper function that operates like that to parse a formatted table, something like

localize_table = function(formattedTable)
  local nodesRet = {}

  for _, str in ipairs(formattedTable) do
    nodesRet[#nodesRet + 1] = {{
      n = G.UIT.R,
      config = { align = 'cm', padding = 0.03 },
      nodes = SMODS.localize_box(loc_parse_string(str), { scale = 1.0 })
    }}
  end
  
  return {{ n = G.UIT.C, config = { align = 'cm', padding = 0.03 }, nodes = nodesRet }}
end

but i'm not that good at UI code so cirDerp

primal robin
#

this one is not correct tho

#

too much {{}}

rapid stag
#

you do need to double nest UI nodes like that, but i forget the exact structuring

primal robin
#
parse_lines = function(lines, args, config)
    local result_nodes = {}
    if lines then
        for _, line in ipairs(lines) do
            local localized = SMODS.localize_box(type(line) == "string" and loc_parse_string(line) or line, args)
            table.insert(result_nodes, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localized,
            })
        end
    end
    return {
        n = G.UIT.C,
        config = config,
        nodes = result_nodes,
    }
end
rapid stag
#

i see cirDerp

long sun
#

awesomes ^u^ thanks!

primal robin
long sun
#

so i'm getting this crash

slim ferry
#

what the fuck is cultural bean

long sun
#

(don't ask :3)

wanton jolt
#

what the fuck is cultural bean

slim ferry
#

i swear to god

#

is cold beans changing the balatro version number

long sun
#

i don't know 😭

slim ferry
#

holy bad practice speedrun

long sun
#

anyway

wanton jolt
#

oh my god

slim ferry
#

also wtf is bizarrtro and why is it under lovely mods

wanton jolt
long sun
#

@near coral

slim ferry
#

well yeah

long sun
#

anyway

slim ferry
#

but

#

why is it under lovely mods

wanton jolt
#

because it does the opposite of all other mods

#

:)

long sun
#

team_things is

{
  [1] = {
            "this is test text",
            "absolute {C:attention}lol{}"
        },
        [2] = {
            "{S:2}and more{}"
        }
}```
primal robin
#

Nope, you need handle multiboxes manually too

long sun
#

oh this isn't a multibox

#

(is it? ^^;;;)

primal robin
long sun
#

i'll just do it manually ;u;

#

okay i haven't done this right, i'm getting the same crash

local localize_table = function(table_thing, args, config)
    local t = {}
    if table_thing then
        for _, line in ipairs(table_thing) do
            local localised = SMODS.localize_box(type(table_thing) == "string" and loc_parse_string(line) or table_thing, args)
            table.insert(t, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localised,
            })
        end
    end
    return { n = G.UIT.R, config = config, nodes = t }
end

ColdBeans.make_me_a_credits_page_please = function(team)
    local team_things = G.localization.cbean_credits[team or 1]
    
    local t = localize_table(team_things)
    return {
        n = G.UIT.C,
        config = { minw = 11, colour = G.C.CLEAR, align = "cm", id = "cbean_credits_page" },
        nodes = t
    }
end
#

also i'm gonna expunge the previous things to avoid leaks

primal robin
long sun
#

i don't know what you mean by that 😭

primal robin
#

you really dont know what is multibox?

long sun
#

like i know a multibox is when a joker has mutliple ability texts in one

#

but like. i don't have multiple of those

#

it's being indexed into

primal robin
long sun
#

yeah but that's being indexed into

granite jay
#
SMODS.Joker{
    calculate = function(self,card,context)
        if not context.blueprint then
            if context.setting_blind and card.ability.extra.stored_joker == nil then
                local other_joker = nil
                for i = 1, #G.jokers.cards do
                    if G.jokers.cards[i] == card then other_joker = G.jokers.cards[i + 1] end
                end

                if other_joker then
                    card.ability.extra.stored_joker = other_joker
                    SMODS.destroy_cards(other_joker)
                    return {
                        message = localize('k_eaten_ex')
                    }
                end
            end

            -- BUG: When reloading a run, the stored joker becomes MANUAL REPLACE instead.
            if context.end_of_round and context.main_eval and context.game_over == false and card.ability.extra.stored_joker then
                local edition = SMODS.poll_edition{ key = "gl_litabelle", guaranteed = true}
                if edition == 'e_negative' or #G.jokers.cards + G.GAME.joker_buffer <= G.jokers.config.card_limit then
                    local copied_joker = copy_card(card.ability.extra.stored_joker)
                    copied_joker:set_edition(edition, true)
                    G.jokers:emplace(copied_joker)
                    copied_joker:start_materialize()
                    copied_joker:add_to_deck()

                    card.ability.extra.stored_joker = nil

                    return {
                        message = localize('gl_litabelle')
                    }
                else
                    return {
                        message = localize('k_no_room_ex')
                    }
                end
            end
        end
    end,
}```
If I reload a run while a joker is stored, it becomes MANUAL_REPLACE instead, anyone know how to fix it?
primal robin
red flower
#

else you would need to hook card:save and load

#

and do stuff

primal robin
#

In other words,

local localize_table = function(table_thing, args, config)
    local t = {}
    if table_thing then
        for _, line in ipairs(table_thing) do
            local localised = SMODS.localize_box(type(table_thing) == "string" and loc_parse_string(line) or table_thing, args)
            table.insert(t, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localised,
            })
        end
    end
    return { n = G.UIT.C, config = config, nodes = t }
end

ColdBeans.make_me_a_credits_page_please = function(team)
    local team_things = G.localization.cbean_credits[team or 1]
    
    local t = localize_table(team_things, { default_col = G.C.UI.TEXT_LIGHT, align = "cm" })
    return {
        n = G.UIT.C,
        config = { minw = 11, colour = G.C.CLEAR, align = "cm", id = "cbean_credits_page" },
        nodes = { t }
    }
end
long sun
#

gotcha, though it's still crashing ;u;"""

#

i really don't get why

long sun
#

i assume this line in SMODS.localize_box is to blame

#

for _, subpart in ipairs(part.strings) do

#

the crash log says part is a string

primal robin
#

wait wtf you did

red flower
# granite jay Oooo how do u do that?

this and then i remove the joker from G.jokers and move it to here and the same the other way around, this is a common effect in my mod so i use mod calculate to bring the joker back

primal robin
#
local localize_table = function(table_thing, args, config)
    local t = {}
    if table_thing then
        for _, line in ipairs(table_thing) do
            local localised = SMODS.localize_box(type(line) == "string" and loc_parse_string(line) or line, args)
            table.insert(t, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localised,
            })
        end
    end
    return { n = G.UIT.C, config = config, nodes = t }
end
long sun
#

yeah i have that

primal robin
#

your one have issues, replace with this one

long sun
#

i have that one

#

i'm saying the crash is occuring in the SMODS function

primal robin
#

is table_thing array of strings?

long sun
#

no

#

table_thing is { "this is test text", "absolute {C:attention}lol{}" }

primal robin
long sun
#

oh you edited it

#

yeah it's an array of strings

primal robin
#

it expects { "a", "b" }, not { [1] = { "a", "b" } }

long sun
#

(yeah sorry i had to edit my message too)

primal robin
#

give me one second to calm down myself

long sun
#

alrighty

primal robin
#

sorry, not in the best mood today, i'm back

long sun
#

allg!

latent portal
#

hey broskis

#

i need a quick bit of help

primal robin
#

I'll do the thing, give me a minute

latent portal
#

if i wanted to make a joker have double sell value how would i do that?

#

like

#

the multiplier stacks on modifiers too like polychrome and gift and such

red flower
#

you (probably) can do card.ability.extra_value = card.sell_cost

#

else you would have to hook card:set_cost and change card.sell_cost after it runs

latent portal
#

i mean

#

does it update

primal robin
red flower
#

so the second option

long sun
#
local localize_table = function(table_thing, args, config)
    local t = {}
    if table_thing then
        for _, line in ipairs(table_thing) do
            local localised = SMODS.localize_box(type(table_thing) == "string" and loc_parse_string(line) or table_thing, args)
            table.insert(t, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localised,
            })
        end
    end
    return { n = G.UIT.C, config = config, nodes = t }
end

ColdBeans.make_me_a_credits_page_please = function(team)
    local team_things = G.localization.cbean_credits[team or 1]
    
    local t = localize_table({
            "this is test text",
            "absolute {C:attention}lol{}"
        }, { default_col = G.C.UI.TEXT_LIGHT, align = "cm" })
    return {
        n = G.UIT.C,
        config = { minw = 11, colour = G.C.CLEAR, align = "cm", id = "cbean_credits_page" },
        nodes = { t }
    }
end```
primal robin
#

uhhhh

#

salty ghost

#

please

#

moreattention

#

your localize_table is not correct

primal robin
#

I know reading is hard

long sun
#

mean ;u;"

#

/silly

primal robin
#

Sorry, just a bit sad because all of this

long sun
#

that looks like it makes more sense though

#

ya

#

lemme test

long sun
primal robin
#

You're smart ghost and I have some expectation on you

long sun
#

i'm smart in some areas, but i also lack common sense 😭

#

mm, it's still crashing for some reason

primal robin
#

Maybe that's my issue, have expectations in a first place

long sun
#
local localize_table = function(table_thing, args, config)
    local t = {}
    if table_thing then
        for _, line in ipairs(table_thing) do
            local localised = SMODS.localize_box(type(table_thing) == "string" and loc_parse_string(line) or table_thing, args)
            table.insert(t, {
                n = G.UIT.R,
                config = { align = args.align, minh = args.minh },
                nodes = localised,
            })
        end
    end
    return { n = G.UIT.C, config = config, nodes = t }
end

ColdBeans.make_me_a_credits_page_please = function(team)
    local team_things = G.localization.cbean_credits[team or 1]
    
    local t = localize_table(team_things, { default_col = G.C.UI.TEXT_LIGHT, align = "cm" })
    return {
        n = G.UIT.C,
        config = { minw = 11, colour = G.C.CLEAR, align = "cm", id = "cbean_credits_page" },
        nodes = { t }
    }
end```
primal robin
#

no, try again

long sun
#

wait hold on

#

did i not

#

hmm

primal robin
#

copying in discord sometimes sucks

long sun
#

i told windows to paste 😭

primal robin
#

I can just paste code which will work but I want do that in hard way in hope that you'll learn some stuff

long sun
#

okay new crash :3

#

thankfully i know what it means

#

thanks :D

#

sorry for the fuss

primal robin
#

that's okay

long sun
#

it's working! :D

#

tysm omg

primal robin
#

no problem salty ghosh

#

Be more careful while you're doing things and your life will be much easier

#

I'm rechecking my code multiple times even if it's working just to make sure I'm sane

#

It's annoying but helps improve a code and make less mistakes

granite jay
#

Anyone know how to add restrictions to a challenge rather than using take ownership?

red flower
#

or what do you mean

#

ah for a vanilla one?

frosty dock
#

wdym rather than using take ownership? that's just generally how you modify vanilla objects

#

of course you could instead patch the code where the original challenge is created, but I doubt that's what you want and there's hardly ever a point in that

granite jay
granite jay
frosty dock
granite jay
#

Oh ok

frosty dock
#

it's a pretty bad name for what it does actually, and that's completely my fault

granite jay
#

Do I need to include vanilla stuff or nah?

slim ferry
#

-# tbh there should probably be some sort of parameter for smods objects to ban them from existing challenges

granite jay
#

Bruh xD

granite jay
#

Oh wait

#

nvm I just realised one of the jokers was outdated

#

Like a key was wrong

frosty dock
granite jay
#

Ah oki

sour garden
#

what do i need to do to force a showdown blind on a certain ante?

rapid stag
vital wren
#

is there a game state for just normal play during a blind? i have a sticker i want to apply to consumeables only if they're spawned during the blind

rapid stag
#

but if you mean during scoring, you could also try G.STATE.HAND_PLAYED

slim ferry
#

If you just want during the blind in general you should check SMODS.is_active_blind("blind_key")

vital wren
#

will G.STATE.SELECTING_HAND be true while an emperor or high priestess is resolving or when a purple seal is being resolved?

rapid stag
#

i'm not sure - eris's solution might cover that

slim ferry
#

Those all happen in different states afaik

vital wren
slim ferry
#

No

vital wren
#

maybe if G.GAME.blind would work?

slim ferry
#

You should check G.GAME.blind.in_blind then

vital wren
#

okay, ill start there and see if i can get it working

#

sweet, if G.GAME.blind and G.GAME.blind.in_blind works

viscid talon
#

got a few errors and idk how to fix em

#

you know how it is

#

idk why reroll surplus isnt working

#
back.lua:207: attempt to index local 'self' (a nil value)

Additional Context:
Balatro Version: 1.0.1o-FULL
Modded Version: 1.0.0~BETA-1501a-STEAMODDED
LÖVE Version: 11.5.0
Lovely Version: 0.9.0
Platform: Windows
Steamodded Mods:
    1: Hatchet by Plasma [ID: hatchet, Version: 1.6.1]
    2: DebugPlus by WilsontheWolf [ID: DebugPlus, Version: 1.5.1, Uses Lovely]
    3: Deltarune Deck by nolo33lp [ID: DeltaruneDeck]
Lovely Mods:
    1: BMM-Compat

Stack Traceback
===============
(3) LÖVE metamethod at file 'boot.lua:352'
Local variables:
 errhand = Lua function '(LÖVE Function)' (defined at line 605 of chunk [lovely debugplus.console "debugplus/console.lua"])
 handler = Lua function '(LÖVE Function)' (defined at line 605 of chunk [lovely debugplus.console "debugplus/console.lua"])
(4) Lua field 'apply_to_run' at file 'back.lua:207'
Local variables:
 self = nil
 (*temporary) = table: 0x2ba1d498  {order:7, _d:false, set:Voucher, key:v_reroll_surplus, _saved_d_u:true, available:true, discovered:true, alerted:true, pos:table: 0x2ba1d648, unlocked:true (more...)}
 (*temporary) = string: "v_reroll_surplus"
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = nil
 (*temporary) = string: "attempt to index local 'self' (a nil value)"
(5) Lua field 'func' at file 'src/backs.lua:105' (from mod with id hatchet)
(6) Lua method 'handle' at file 'engine/event.lua:96'
Local variables:
 self = table: 0x2b331278  {start_timer:true, timer:TOTAL, blockable:true, trigger:immediate, func:function: 0x2b3acb80, delay:0, complete:false, time:15.581820763419, blocking:true (more...)}
 _results = table: 0x2bd71b88  {blocking:true, pause_skip:false, time_done:false, completed:false}
(7) Lua method 'update' at file 'engine/event.lua:184'
Local variables:
 self = table: 0x2ba81778  {queues:table: 0x2ba817a0, queue_last_processed:11.633333333333, append_count:0, append_queue:base, queue_dt:0.016666666666667, queue_timer:11.75124900084 (more...)}
 dt = number: 0.0165
 forced = nil
 (for generator) = C function: next
 (for state) = table: 0x2ba817a0  {unlock:table: 0x2ba81890, other:table: 0x2ba81930, tutorial:table: 0x2ba818e0, base:table: 0x2ba818b8, achievement:table: 0x2ba81908}
 (for control) = number: nan
 k = string: "base"
 v = table: 0x2ba818b8  {1:table: 0x2b331278, 2:table: 0x2b5c80d8, 3:table: 0x2bd28c00, 4:table: 0x2bd11f18, 5:table: 0x2bc81160, 6:table: 0x2bd7b638, 7:table: 0x2b5ef3d8 (more...)}
 blocked = boolean: false
 i = number: 1
 results = table: 0x2bd71b88  {blocking:true, pause_skip:false, time_done:false, completed:false}
(8) Lua upvalue 'gameUpdateRef' at file 'game.lua:2617'
Local variables:
 self = table: 0x2b37fc88  {F_GUIDE:false, F_CRASH_REPORTS:false, F_QUIT_BUTTON:true, HUD_tags:table: 0x2bfdcb58, F_ENGLISH_ONLY:false, viewed_stake:1, HUD:table: 0x2bf64d28 (more...)}
 dt = number: 0.0165
 http_resp = nil
(9) Lua method 'update' at Steamodded file 'src/ui.lua:190' 
Local variables:
 self = table: 0x2b37fc88  {F_GUIDE:false, F_CRASH_REPORTS:false, F_QUIT_BUTTON:true, HUD_tags:table: 0x2bfdcb58, F_ENGLISH_ONLY:false, viewed_stake:1, HUD:table: 0x2bf64d28 (more...)}
 dt = number: 0.0165
(10) Lua field 'update' at file 'main.lua:1074'
Local variables:
 dt = number: 0.0165
(11) Lua function '?' at file 'main.lua:1013' (best guess)
(12) global C function 'xpcall'
(13) LÖVE function at file 'boot.lua:377' (best guess)
Local variables:
 func = Lua function '?' (defined at line 984 of chunk main.lua)
 inerror = boolean: true
 deferErrhand = Lua function '(LÖVE Function)' (defined at line 348 of chunk [love "boot.lua"])
 earlyinit = Lua function '(LÖVE Function)' (defined at line 355 of chunk [love "boot.lua"])
#

got this error

#
-- Pilot Deck
SMODS.Back {
    key = 'pilot',
    pos = { x = 3, y = 0 },
    config = { vouchers = { 'v_reroll_surplus', 'v_clearance_sale' } },
    loc_txt = {
        name = 'Pilot Deck',
        text = {
            'Start run with',
            '{C:green}#1#{},',
            'and {C:attention}#2#{},',
        },
    },
    unlocked = false,
    no_collection = false,
    atlas = 'CustomDecks',

    loc_vars = function(self, info_queue, back)
        return {
            vars = { localize { type = 'name_text', key = self.config.vouchers[1], set = 'Voucher' },
                localize { type = 'name_text', key = self.config.vouchers[2], set = 'Voucher' },
            }
        }
    end,

    apply = function(self, back)
        for k, v in pairs(self.config.vouchers) do
            G.GAME.used_vouchers[v] = true
            G.GAME.starting_voucher_count = (G.GAME.starting_voucher_count or 0) + 1
            G.E_MANAGER:add_event(Event({
                func = function()
                    back.apply_to_run(nil, G.P_CENTERS[v])
                    return true
                end
            }))
        end
    end,

    check_for_unlock = function(self, args)
        return args.type == 'win_stake' and get_deck_win_stake() >= 10
    end
}``` here's my deck's code
#

idk what im doing

#

nvm i figured out the text issue

#

idk about the apply function thing

normal crest
viscid talon
#

thats odd

#

its a deck, not a card

#

🤔

normal crest
#

Vouchers are instances of the Card class

#

and that's what you're applying

viscid talon
#

its fine i fixed it anyways

#

turns out the apply function stuff wasnt needed

wild escarp
#

What's the best way to upgrade just the chips/mult of a hand?

red flower
wild escarp
#

How would I use that to upgrade chips or mult alone by a set amount?

red flower
#

that will do mult + 1

near coral
#

What would be a good template for my coder to use to help him use drawstep to have multiple stake stickers on stuff

#

I have 2 stake sets, one vanilla and one for my mod, I'm intending for the stickers for both to show up measuring your progress on them individually

#

And yes I have the stakes for my mod not overlapping with vanilla ones

bright crane
#

Does anyone know how to get a custom sound to play when a joker is triggered (standard joker_main)? Any one of the main contexts I tried had the sound play at the beginning of the scoring phase, rather than the individual joker getting triggered.

umbral zodiac
bright crane
#

This is what I got so far:

SMODS.Joker {
    key = "rotated_hamsa",
    loc_txt = {
        name = 'Rotated Hamsa',
        text = {
            "{C:mult}+#1#{} Mult on {C:attention}final hand{} of the round"
        }
    },
    blueprint_compat = true,
    rarity = 1,
    cost = 4,
    pos = { x = 4, y = 0 },
    config = { extra = { mult = 30 } },
    atlas = 'ModdedVanilla',
    loc_vars = function(self, info_queue, card)
        return {vars = { card.ability.extra.mult }}
    end,

    calculate = function(self, card, context)
        if context.joker_main and G.GAME.current_round.hands_left == 0 then
            -- play_sound('cloverpit_hamsa')
            return {
                mult = card.ability.extra.mult,
                sound = 'cloverpit_hamsa'
            }
        end
    end
}

The sound doesn't play at all via this method?

median veldt
#

Can I do an optional dependency in the code or

umbral zodiac
median veldt
#

hey Um. its saying the dependency is missing even though its literally not.

daring fern
median veldt
#

Really??

#

I've been using the name for like half of my dependencies

#

unless the id is literally capitalized like that in steamodded and lovely

daring fern
wild escarp
pastel kernel
#

is this how you do the boolean display on a joker?

umbral zodiac
#

you don't need to put it in update

#

loc_vars is ran every time the description is shown to the player

#

just put the code there

#

better yet, you could just do card.ability.extra.deathdefiance and "Active" or "Inactive"

pastel kernel
#

wha

#

how would that work

umbral zodiac
#

its a property of how lua logic works, if you put something like true and 1 or 2 it will always return 1
it's basically equivalent to a ternary statement in any other language

red flower
pastel kernel
#

ah

#

wait...

umbral zodiac
pastel kernel
umbral zodiac
#

looks right, assuming youre using #1# as your var for activity

pastel kernel
#

yes

#

0/3 will be #2#/#3#

#

now to add the counter.

#

can you set scalar_value to a number instead of a variable

rapid stag
#

i had this convo the other day with eremel and reminded me about the existence of the operation arg - it's a little roundabout but here's that discussion if it helps your issue #1209564621644505158 message

but basically for scale_card you need to always pass in a way to get your multiplier variable in case something else wants to manipulate it permanently. if you don't want that, you're supposed to pass in a block_overrides table as part of your args table for every scale_card call where you don't want those changes made, where value = true prevents the value from being substituted just for that operation and scalar = true will prevent your scalar value from being permanently manipulated

and in cases where you absolutely need to use a number that can't be reasonably kept and accessed from the config value, you specify an operation function that does the operation you need to do

it could use more documentation tbh

bright crane
daring fern
left sonnet
#

Hey folks, I'm testing out UIs (and the infinite parentheses my editor is not set up to indent correctly) and I'm making a tooltip. I used a newline character here because I'm not familiar with what's correct, and I was wondering if there's a way to resize this toolbox? I know in joker descriptions you can use [1] = and such but it didn't seem to take this time

rapid stag
#

well how are you currently defining its size

pastel kernel
#
    calculate = function(self, card, context)
        if not card.ability.extra.deathdefiance == true and card.ability.immutable.counter <= 3 then
            if context.before and next(context.poker_hands["Flush"]) and not context.blueprint then
                SMODS.scale_card(card, {
                ref_table = card.ability.immutable,
                ref_value = "counter",
                scalar_value = "addition",
                scaling_message = {
                message = card.ability.immutable.counter .. "/" .. card.ability.immutable.goal,
                colour = G.C.DARK_EDITION
            }})
            else
                card.ability.immutable.counter = 0
                SMODS.calculate_effect({message = "Reset!", colour = G.C.DARK_EDITION}, card)
            end
        end
        if context.end_of_round and context.main_eval and (context.game_over and card.ability.extra.deathdefiance == true) or context.forcetrigger then
                            G.E_MANAGER:add_event(Event({
                    func = function()
                        G.hand_text_area.blind_chips:juice_up()
                        G.hand_text_area.game_chips:juice_up()
                        play_sound('tarot1')
                        return true
                    end
                }))
                SMODS.calculate_effect ({
                    message = ZagreusTalk[math.random(#ZagreusTalk)],
                    saved = "Death Defied!",
                    colour = G.C.DARK_EDITION,
                    card = card
                })
                card.ability.extra.deathdefiance = false
                SMODS.calculate_effect({message = "Reset!", colour = G.C.DARK_EDITION}, card)
        end
    end```
#

am i doing this right

left sonnet
#

I imagine the tooltip UI uses the same node logic, but I don't know how I would access that

rapid stag
#

how deep is this node

#

can i see the full structure?

left sonnet
#

Right below the root, sure

#
        -- Root node, needed in all UI
        n = G.UIT.ROOT,
        -- The config which details how the node will look
        config = { r = 0.25, align = "cm", padding = 0.8, colour = G.C.BLACK, minw = 8, minh = 6, juice = true},
        -- and repeat with more nodes in nodes={}
        nodes = {
            -- {
            -- n = G.UIT.R, config = { r = 0.25, padding = 0.2, colour = G.C.PURPLE, w = 3, h = 1, 
            -- tooltip = { text = {"The {E:1,C:legendary}Hellscape~{}...\nHow far will YOU fall~?" } },
            -- },
            {
                n = G.UIT.C, config = {minw=4, minh=4, colour = G.C.MONEY, padding = 0.15},
                        nodes = {
                        {n = G.UIT.R, config = {minw=2, minh=2, colour = G.C.RED, padding = 0.15},
                        nodes = {
                            {n = G.UIT.C, config = {minw=1, minh=1, colour = G.C.BLUE, padding = 0.15}},
                            {n = G.UIT.C, config = {minw=1, minh=1, colour = G.C.BLUE, padding = 0.15}}
                        }},
                        
                        {n = G.UIT.R, config = {minw=2, minh=1, colour = G.C.RED, padding = 0.15}, nodes = {
                            {n = G.UIT.C, config = {minw=1, minh=1, colour = G.C.BLUE, padding = 0.15}},
                            {n = G.UIT.C, config = {minw=1, minh=1, colour = G.C.BLUE, padding = 0.15}}
                        }
                    }
                }
            },
            {
                n = G.UIT.C, config = {minw=3, minh=2, colour = G.C.MONEY, padding = 0.15,
                tooltip = {
                    text = {"The {E:1,C:legendary}Hellscape{}...\nHow far will YOU fall~?" },
                 }}
            }
        },
    }```
#

Most of it is just the tutorial UI code

#

I hate how it comes out on Discord if you don't remove the starting spaces

rapid stag
#

i see.

if you can get the variable that goes into, you could try changing

var[1].config.minh
left sonnet
#

The variable being the "tooltip box" or whatever you wanna call it

#

I'll certainly look about but I'm not hopeful

old epoch
#

How would I check if a playing card is retriggered?

granite jay
#
loc_vars = function(self, info_queue, card)
        
        local m_end = {}
        if G.gl_litabelleArea.cards[1] then
            local stored_card = G.gl_litabelleArea.cards[1]
            local joker_name = localize{
                type = 'name_text', 
                set = stored_card.config.center.set,
                key = stored_card.config.center.key,
            }
            localize{ 
                type = 'other', 
                key = 'gl_litabelle_contains', 
                nodes = m_end, 
                vars = {joker_name} 
            }
            info_queue[#info_queue + 1] = stored_card.config.center
        end
        return { vars = {card.ability.extra.dollars}, main_end = m_end[1]}
    end```
The info queue displays the joker's base values, even tho they scale. (Second image is after litabelle spits Mossibug back out)
Anyone know how to fix this?
daring fern
granite jay
#

thx

queen meadow
orchid thunder
#

anyone know how to get dynatext working or how it works

orchid thunder
orchid thunder
#

edit: i misspelled arena as areana

granite jay
#

How do you make jokers display a message through G.E_MANAGER:add_event?

#

Or without return functions?

daring fern
granite jay
#

thx

sleek valley
#

i'm trying to make an edition that has a chance to give a permanent extra hand when a blind is defeated, but it also counts all held cards and gives one hand for each of them

#

how can i prevent it from checking any cards outside the one with the edition?

dapper sun
#

i think you can do context.individual

#

but i'm not 100% sure since i've not done edition stuff before

daring fern
dapper sun
#

or do that

sleek valley
#

i'll try both options for the sake of it

dapper sun
#

no

#

do somethingcom's one

#

he knows more than me

sleek valley
#

very well :)

kind palm
#

What kind of mod are you making?

sleek valley
#

both games are probably my favourite roguelikes i've ever played so wanna see how well they'd mix :3

kind palm
sleek valley
#

technically, it's already public!
but it's in hella early stages so i want to flesh it out just a little more before i send a link here

kind palm
#

I see! I could do some bugtesting sometime, I'm always looking for new experiences

#

(I should emphasize, I am NOT soliciting you here. I'd do it for free because I like seeing modders do their stuff)

sleek valley
#

lol i didnt take it that way dw X3
but i'd really appreciate it! the more hands i have to spot problems the better

#

i'm also tryna find someone to help with edition shaders because that is a language i do not understand .w.

kind palm
#

If I knew coding I'd gladly help. I'm actually aiming to learn coding myself so I can make my own mods one day

sleek valley
#

well you're in the right place, that's for sure
whenever you feel ready to try, your best resource is the Steammodded wiki and VanillaRemade for how base game stuff works
but the best advice i could give is to just jump in and learn

GitHub

A Balatro Modding Framework. Contribute to Steamodded/smods development by creating an account on GitHub.

#

unironically, the best way to learn to code is trial by fire. it's gonna be funny, it's gonna be messy, and you're gonna learn that this game can break in ways you never thought possible lmao

kind palm
#

Good to know! I'd be happy if I could even get one card working lol

sleek valley
#

the easiest cards to make have to be Jokers, so that's a good place to start :3

dapper sun
sleek valley
hardy vessel
#

Trying to make a card similar to Hallucination, but it creates a copy of a random consumable in a pack instead of a random Tarot card in general, but I can't seem to target any cards in a pack to check if they are consumables/a card to copy. I think G.pack_cards is not being added to when I do check for that area, but I'm not sure how to go about making it work.

    calculate = function(self, card, context)
        if context.open_booster and #G.consumeables.cards + G.GAME.consumeable_buffer < G.consumeables.config.card_limit then
            local pack_cards = {}
            for i = 1, #G.pack_cards do
                if G.pack_cards[i].ability.consumeable then
                    pack_cards[#pack_cards+1] = G.pack_cards[i]
                end
            end
            if SMODS.pseudorandom_probability(card, 'test' .. G.GAME.round_resets.ante, 1, card.ability.extra.odds) and #pack_cards >= 1 then
                G.GAME.consumeable_buffer = G.GAME.consumeable_buffer + 1
                local chosen_card = psuedorandom_element(pack_cards, 'test')
                G.E_MANAGER:add_event(Event({
                    trigger = 'before',
                    delay = 0.0,
                    func = (function()
                        SMODS.add_card {
                            key = chosen_card.key
                        }
                        G.GAME.consumeable_buffer = 0
                        return true
                    end)
                }))
                return {
                    message = localize('k_plus_tarot'),
                    colour = G.C.PURPLE,
                }
            end
        end
    end
kind palm
#

You also have a typo in pseudorandom

slim ferry
kind palm
#

There's a command to specify a specific card pack under g.pack_cards

kind palm
slim ferry
#

and the cards are stored in G.pack_cards.cards

hardy vessel
#

With some other issues ironed out, seems to be working as intended (at least for now)

tyty

#

I guess a quick follow-up is if I want to prevent copying of hidden consumables like Soul and Black Hole, would I just check something like if not card.hidden?

tidal hemlock
#

looking for programmers for a complete overhaul mod, if anyone has enough freetime and experience

lyric wadi
#

what context do you use to check if a joker has been spawned in a shop, like when you enter a shop or just rerolled

dapper sun
#

does balatro/smods have a way to handle keybinds?

#

or do i have to hook love.keypressed?

gilded blaze
#

SMODS.Keybind

dapper sun
#

ty

pastel kernel
#

how to check for if sold joker is a food joker? (i have spectrallib, food pool should be fine)

gilded blaze
# lyric wadi

if context.create_shop_card and context.set == "Joker" then

lyric wadi
#

mm

#

what if about if checking when itself is spawned in the shop

slim ferry
#

what

#

are you actually trying to do

lyric wadi
#

have a joker do something when it appears in shop

#

but before you buy it

slim ferry
#

set_ability ig?

#

and then check the area

pastel kernel
#

how to check for first drawn cards

slim ferry
#

because cards dont calculate in the shop

slim ferry
pastel kernel
#

first drawn cards become electric

slim ferry
#

and context.hand_drawn is the cards that were drawn

pastel kernel
#

so if context first hand drawn and context hand drawn then set_abilityblablabla

#

or do i have to check for individual and g.hand or something

#

also checks if current hand doesn't contain an enhancement already

gilded blaze
#
local smods_cc = SMODS.create_card
function SMODS.create_card(args)
    local card = smods_cc(args)
    if card.config.center_key == "j_modprefix_key" and args.key_append == "sho" then
        -- do stuff
    end
    return card
end
lyric wadi
#

is sho an internal balatro key or is that custom define

gilded blaze
#

internal for shop items

lyric wadi
#

oh shit didnt know that

#

pog

#

where do i put that in terms of layout

#

like is that in set_ability or as a block after calculate

gilded blaze
#

when developing mods (chances are if you ask for something you're definitely not using JokerForge), it's recommended to take a look at Balatro's source code

gilded blaze
lyric wadi
#

ok im asking a lot of nitpick clarificatyions questions here

#

would card.ability.extra exist for this hook

#

like im not fully sure what order things happen in

red flower
gilded blaze
#

oh wait

#

uh, were they asking for a vanilla approach

red flower
#

no i mean that wont work with 'sho'

#

iirc i dont have the code with me

gilded blaze
#

I based my words using this dump right here

lyric wadi
#

im just asking for any approach that works tbh

red flower
#

i dont have that on the one in my phone but it's a couple of months outdated so idk

lyric wadi
#

i dont really care for cleaness or efficiency

#

i would rather be undertale than heartbound if that make sense

red flower
pastel kernel
#

I'm a walking turdbrainlua if context.first_hand_drawn and context.hand_drawn and not context.blueprint then if context.other_card and context.cardarea == G.hand and context.other_card.config.center.key == 'c_base' then context.other_card:set_ability('m_busterb_electric', nil, true) end end

sleek valley
#

idea: inject_card should work on undiscovered sprites so you can have custom sizes the same way you can have custom sizes for actual cards

slim ferry
#

can you not just set a display size on the undiscovered sprite

#

Inject card also wouldnt really make sense because unlike an object type you arent injecting objects into it

sleek valley
sleek valley
slim ferry
#

Ah

#

I see

sleek valley
#

yeah lol

long sun
#

i made an attempt at displaying a sprite in my UI, but it's not working:

local team_atlas = "cbean_"..G.localization.cbean_credits[team or 1].atlas
    G.CBEAN_TEAM_LOGO = Sprite(0, 0, 5, 5 * (G.ASSET_ATLAS[team_atlas].py / G.ASSET_ATLAS[team_atlas].px), G.ASSET_ATLAS[team_atlas], { x = 0, y = 0 })

    G.CBEAN_TEAM_LOGO:set_alignment({
        major = G.OVERLAY_MENU:get_UIE_by_ID("cbean_credits_page"),
        type = 'cm',
        bond = 'Strong',
        offset = { x = 0, y = 0 }
    })```
#

what's the proper way of doing this :3?

#

i'm putting each row into an table called t

lyric wadi
#

is there a pool of just like, all vanilla jokers

#

or do i have to define it myself

long sun
#

iirc you have to construct it yourself

lyric wadi
#

rip

long sun
#

you can do that either with a hardcoded list, or by looping through the Joker pool and checking if a Joker has no mod associated with it

sleek valley
#

what's the check for when a discard is used again?

wind steppe
sleek valley
#

tyyy

versed swan
#

whats a good way to make a ui element change width/height relative to another ui element, maybe one that isnt contained within the other

sleek valley
#

the easiest way is just trial and error through tweaking the UI node's config

#

no better way than that sadly

wind reef
#

I'm developing a mod right now, is there a way to check the number of unscored cards in a hand with steammodded or something? I tried checking example mods and other mods but can't find anywhere that has done something similar.

slim ferry
#

#context.full_hand - #context.scoring_hand?

wind reef
median veldt
#

I seem to have done my consumable wrong

I set it to discovered = true but it's not discovered

And yet it's not

and when i hover over it I get this

#

heres some relevant code i think? the localization probably isnt needed if i want it to be always discovered but I should probably at least try to fix the error

sleek valley
#

discovered doesnt go in config

median veldt
#

Oh i totalyl misread the text lmao

#

The error is still present even after unlocking it for some reason

sleek valley
#

same error?

median veldt
#

mhm

sleek valley
#

hmmmm

median veldt
#

is it because this is empty

#

i have it like that cuz it wont be in a bit

sleek valley
#

_ _
yeah, that'd probably do it lol

median veldt
#

ok i'll just add it rq

sleek valley
#

yeah, just commenting it out or adding one throwaway variable is good to make sure it doesnt crash at least

median veldt
#

what's like. the variable for the odds i forget

Like i remember you're ideally supposed to do like the game's base odds and then your own number for like a "1 in 4"

#

or should I just hardcode 1 in 4

sleek valley
#

so for the loc_vars you need to first initialise your config odds as local variables, like this:
local numerator, denominator = SMODS.get_probability_vars(card, 1, card.ability.extra.odds, 'prefix_cardname')

#

then when calling it for the card's actual calculate function do:
SMODS.pseudorandom_probability(card, 'prefix_cardname', 1, card.ability.extra.odds)

#

the string can be whatever you like, since it's just to initialise a random seed, but it's generally prefered to set it to your mod prefix and the name of the card

median veldt
#

ya

median veldt
sleek valley
#

how have you been doing it, now im curious .w.

median veldt
#

like this?

sleek valley
#

yes, that's perfect

median veldt
sleek valley
#

_ _

median veldt
#

listen this was forever ago

sleek valley
#

im not saying it’s bad

But im impressed at how you got here

median veldt
#

I'm pretty sure I stole most of this from vremade

sleek valley
#

Last i checked, Vremade does not use GAME.probabilities but hey, what matters is you know the proper way to do it now

median veldt
#

It might've at the time?

#

Idk

sleek valley
#

¯_(ツ)_/¯

median veldt
#

...nope same error

#

omfg it was cuz of 3xcredits

#

i had removed the "concept" line

#

cuz i didnt want it

sleek valley
#

Well
At least that one problem helped you fix a couple others at the same time

hoary spear
#

also, @red flower, i do have the feature enabled, ive done a few jokers with it now, but it doesnt work on the edition.

red flower
#

can i see the code with it?

hoary spear
#

yea sure one sec

#

lemme grab

#
-- Edition: Echo (guaranteed retrigger)

return function(REW1RED)
    SMODS.Edition({
        key = "echo",
        loc_txt = {
            name = "Echo",
            label = "Echo",
            text = {
                "Retrigger this card"
            }
        },
        shader = "coinflip",
        config = {},
        discovered = true,
        in_shop = true,
        weight = 3,
        extra_cost = 6,
        badge_colour = HEX("FFD700"),
        calculate = function(self, card, context)
            -- repetition_only = seal pass; repetition = joker/retrigger pass (both can grant edition retrigger)
            if context.repetition_only or context.repetition then
                return {
                    message = localize('k_again_ex'),
                    repetitions = 1,
                    card = card
                }
            end
        end,
    })
end
#

thats it rn

#

i reverted to when it did playing cards only

red flower
#

yeah what i wanted to know is how the code looked with retrigger joker check

median veldt
#

is there a way to have the display name be different than the text in the badge

#

i want to make the badge text an abbreviation

red flower
#

it's a consumable type right? i think the name and the label on the badge are in two different places

#

it should be in the docs now

median veldt
#

i meant for the mod itself

red flower
#

ah yes

#

im pretty sure let me check

median veldt
#

the name is like three characters too long for the badge and it's making me unreasonably annoyed

red flower
median veldt
#

oh woops

#

i totally knew that lmfao i forgot

sleek valley
#

Happens to the best of us sushi

hoary spear
median veldt
#

because of what it is, cryptid's codebase is. difficult to parse

hoary spear
#

can anyone like, give a better show of joker retrigger on an edition?

red flower
#

even that code is kinda bad

#

but look at the if condition

#

that's the important part

hoary spear
#

what was breaking then when i tried that---

red flower
#

did it crash?

hoary spear
red flower
#

then something else was wrong, not the if condition

hoary spear
#

okay, so like

#

what do i have to change tho...

#

cause i want it to actually work, and i have other retrigger stuff that works perfectly

red flower
#

like i said, the condition you have right now is only for playing cards, you need to add the retrigger_joker_check part for jokers

hoary spear
#

please elaborate twt

red flower
#

what part of what I said is confusing you?

hoary spear
hoary spear
#

i am a tad slow

slim ferry
#

this is just the same thing as i said in clams

#

but thats not the problem here

#

this is just a problem with whatever you have for file loading

red flower
# hoary spear like, this works perfectly

that has the retrigger_joker_check at the bottom, you need that in your edition
but instead of checking context.other_card ~= card you do == because you want it to retrigger itself

hoary spear
#

it works

#

it retriggers jokers on a 1/2 for each

#

but im getting confused on how to transfer that over

#

i think im just being dumb tho twt

red flower
#

I am telling you how to 😭

#

do you know what an if condition is

hoary spear
#

yes

hoary spear
red flower
#

do you see how that code you just posted has one with retrigger_joker_check at the bottom?

hoary spear
#

almost all of my code is shit i toss together at like midnight

#

idk how ANY of this manages to work how it should

red flower
#

you just need to copy that block to the edition and change ~= for ==

hoary spear
#
                if pseudorandom('amo_retrigger_joker') < G.GAME.probabilities.normal / card.ability.extra.odds then
                    return {
                        message = localize('k_again_ex'),
                        repetitions = 1,
                        card = card
                    }
                end ``` this part right you mean?
red flower
#

yes

hoary spear
#

okay but

#

i want it to like

#

work on jokers or cards

#

it can appear on both

slim ferry
#

thats what i was saying here...

red flower
#

yes, don't remove the code you already have

hoary spear
slim ferry
#

well no

#

thats not

#

how that works

#

a random if condition doesnt make it just stop loading

red flower
#

it is impossible that that code would make it not load

hoary spear
#

twt

#

let me try it again\

slim ferry
#

there definitely is just some issue in your file loading

#

probably

hoary spear
#

maybe it was a one off?

red flower
#

what I imagine is that your file loading system skips files that would crash

hoary spear
#

Just*

shy cobalt
#

how do i make a joker with x mult and scaling

shell timber
#

look at vanillaremade

#

say something like canio

hoary spear
#

okay uh, turns out, im actually just stupid as all hell

hoary spear
#

thank you for putting up with my stupidity @red flower and @slim ferry

#

it works now

#

wait huh

#

okay thats

#

it gave 2xmult when in hand-????

#

sometimes???

shy cobalt
# red flower https://github.com/nh6574/VanillaRemade/blob/1abd606dc26c46f0c7b281995f40fb25b1d...

so this? calculate = function(self, card, context)
if context.remove_playing_cards and not context.blueprint then
local face_cards = 0
for _, removed_card in ipairs(context.removed) do
if removed_card:is_face() then face_cards = face_cards + 1 end
end
if face_cards > 0 then
-- See note about SMODS Scaling Manipulation on the wiki
card.ability.extra.xmult = card.ability.extra.xmult + face_cards * card.ability.extra.xmult_gain
return { message = localize { type = 'variable', key = 'a_xmult', vars = { card.ability.extra.xmult } } }
end
end
if context.joker_main then
return {
xmult = card.ability.extra.xmult
}
end
end,

slim ferry
#

well

#

the part where the xmult is increased

#

not literally everything

shy cobalt
#

ik just is that the section

slim ferry
#

yeah

shy cobalt
#

and uhh how i make xmult

hoary spear
slim ferry
shy cobalt
#

would it be this

#

return { vars = { card.ability.extra.xmult_gain, card.ability.extra.xmult } }

slim ferry
#

no

#

thats for the description

shy cobalt
#

i think im just stupid

sleek valley
#

we all are just a little

shy cobalt
#

nah im alll

sleek valley
#

well what matters is that you learn

hoary spear
sleek valley
#

what matters. is that. you learn.

shy cobalt
#

im trying to learn

#

but idk how

sleek valley
#

the only way you're proper stupid is if you keep making the same mistake over and over

sleek valley
red flower
shy cobalt
#

ive made other jokers

#

mostly just reskinned jimbos

red flower
#

what did they do

shy cobalt
#

+4 mult

red flower
#

xmult is just that but change mult for xmult in the code

calm marten
#

i have been trying to learn but cannot figure out how to create a failsafe for a joker that gives x10 mult for each discards remaining,
If it reaches 0 discard, it gives X0 mult and it causes mult to basically go 0 and get killed

shy cobalt
#

i actually am just stupid

calm marten
sleek valley
#

if it makes you feel any better, i used to make the same mistakes like 3 months ago

red flower
shy cobalt
#

why didnt i think of that

sleek valley
#

the easiest answers are the ones we overlook the most

#

i still trip up over a forgotten comma in my tables every day

shy cobalt
#

ok so now how i scale it

#

cause im tryna make it scale 0.5x for every 5 played

calm marten
sleek valley
shy cobalt
#

uhh

#

where would i put that

sleek valley
shy cobalt
#

and make it do cards with the 5 rank

sleek valley
#

that's not a condition i have set in memory

red flower
#

the rank can be checked in context.individual

#

but I would recommend looking at Walkie Talkie's code or something

#

personally i would really recommend just copying over jokers from vanilla that do something similar into your mod and tweaking them until they do what you want

sleek valley
#

frankly the best way to learn

#

as i've said: the best way to learn programming is trial by fire

calm marten
#

Despite it being completely useless, yet im still thinking of adding single use jokers
like whats the point anymore

#

they are just glorified consumables at this point.

shy cobalt
sleek valley
#

you forgot to write then on line 182

shy cobalt
sleek valley
#

ah

#

hmmmmm

#

can i see the full function?

shy cobalt
#

what u mean

#

\

slim ferry
#

how can i allow for multiple jokers/consumables to be selected

shy cobalt
#

the whoole calculate

slim ferry
#

increasing the area highlight limit with debugplus doesnt seem to work which i thought was the solution

slim ferry
sleek valley
#

ah

slim ferry
#

but also

shy cobalt
slim ferry
#

what is face_cards here exactly

shy cobalt
#

but idk how to change t 5

red flower
#

face_cards is not a value that does anything, it's a non-existent variable that was initialized before the code in the example given earlier

#

you would not replace that with '5' or anything, you need specific code for that (which is why i said to check walkie talkie)

slim ferry
# red flower it should be

okay nvm it just didnt work on already existing cards for some reason? though now how do i get this change to always apply when these areas are created

shy cobalt
#

btuh now it says this

calm marten
#

i think the time when i did joker that is called year 2012 which gives op amount of mult if rank 2, 10 or ace gets scored i did it like this.
not sure if its relevant but checking it like this is simpler for me.

red flower
daring fern
calm marten
mystic river
calm marten
sleek valley
# shy cobalt

gonna be honest, im not sure what it could be
either eris was wrong ans its = instead of == (unlikely)
or it's just the fact that face_cards is a nonexistent variable

#

outside that, idk what it could be

calm marten
shy cobalt
calm marten
shy cobalt
#

says this

red flower
#

that's another syntax error

#

you wrote it wrong

#

we can't tell without the code

sleek valley
#

i will also say, if you wanna just condense your code a little to make it look cleaner, you can do
if context.joker_main and context.other_card:get_id() == 5 then
instead of

if context.joker_main then
  if context.other_card:get_id() == 5 then
red flower
#

there's no other_card in joker_main

sleek valley
#

that is a good point .w.

red flower
#

and cardarea == G.play

calm marten
#

Honestly i need to make a code look cleaner because as of now it looks bad.
there is a single use joker i made that gives X2 mult for each scored card but i had no idea what i was doing

#

i think its also inefficient

red flower
#

i mean the code in the screenshot looks good to me

calm marten
sleek valley
red flower
#

this will also not work with stone cards or modded ranks

calm marten
calm marten
red flower
#
if context.individual and context.cardarea == G.play then
    return { xmult = value }
end
shy cobalt
red flower
#

that should be enough

red flower
sleek valley
red flower
#

i would recommend brushing up on basic lua honestly

sleek valley
#

i've seen that exact error too many times in my own code

wanton jolt
#

or added an = or whatever

versed swan
#

or switch text editor to something like vscode

wanton jolt
#

this usually happens when you copy paste your own code

#

lol

sleek valley
calm marten
wanton jolt
sleek valley
#

actually yknow what
@red flower question for ya
you're (dare i say) an expert with modding, do you ever still find yourself just forgetting a comma somewhere sometimes?

red flower
#

depends on what your definition of forgetting is because if i miss a comma i realize quite quickly because the editor tells me

#

that's why Oinite recommended switching to a good one

sleek valley
#

i'd say that still counts in my book lol
i'm just trying to make a point that it's not a stupid mistake to ocassionally make

versed swan
#

idk i sometimes still miss my commas on vscode

#

granted everything in it updates slowly for me for some reason but eh

red flower
#

i realize quickly because the autoformatter doesn't work if there's any weird syntax error

#

even if it doesn't mark it immediately

sleek valley
red flower
#

im assuming you have the lua extension

sleek valley
#

i do not, actually .w.

#

i thought i had lol

red flower
calm marten
#

sometimes i do wonder to myself
why i created certain jokers as they are. some doesnt look like it makes sense really.

calm marten
red flower
#

i was about to tag Ali

faint yacht
sleek valley
calm marten
sleek valley
#

doesnt change the fact that it looks cool

calm marten
#

There are some jokers that are windows but isnt necessary real
like windows cougar which is just cavendish but weaker

calm marten
sleek valley
#

ah, yeah that is a shame :/

calm marten
#

not to mention this mod is accidentally built on top of another one. which is why i said if i ever get to release it,
I think if i can sepreate my own files from the other mod. i think there is a chance but i still need to get permission from my friend

sleek valley
#

guess we'll wait and see then

calm marten
#

windows jokers arent the only thing
like there is also flash game jokers in there as well

shy cobalt
#

played a 5

#

🥀

granite jay
#

How do you make a function that lets you go to specific pages like the jokers added by your mod?

idle plaza
shy cobalt
sleek valley
granite jay
# red flower what do you want to make?

When you click on "Grasslander Jokers", I want to trigger a function that brings up the jokers added by the mod.
Ik how to make functions trigger when clicking on text btw

red flower
calm marten
#

You dont need to ping reply everytime

red flower
sleek valley
shy cobalt
#

how i make it score now

red flower
granite jay
#

Thx

sleek valley
granite jay
red flower
#

sorry 😭

#

but yeah the problem is that the normal collection and mod collection use the same function

granite jay
red flower
#

but it checks if the mod has been selected in the smods menu

granite jay
#

Got it

shy cobalt
tranquil echo
#

whats the best mod to play around with?
to skip blinds, add jokers, spawn specific blinds, etc

sleek valley
# shy cobalt

does your joker's config not have an extra table inside it?

shy cobalt
tranquil echo
#

thats what im looking at but some of the buttons like dont work
like [3] to spawn card

how does that work

wanton jolt
#

ctrl + 3

calm marten
#

No idea whats going on really.
without seeing how the code works. i cant tell if something is wrong

wanton jolt
#

u hover the card

sleek valley
wanton jolt
#

in collections

shy cobalt
wanton jolt
#

press ctrl

slim ferry
slim ferry
#

by default you also need to hold down ctrl

#

iirc

tranquil echo
#

ohhhhhhhhhh

#

tytyty

wanton jolt
#

ur an outsider!!!

tranquil echo
#

and how do i spawn blinds?

sleek valley
wanton jolt
#

reroll manually or use debug++ to select a specific one

slim ferry
#

you can spawn in any game object from the collection

#

even though it just says cards

sleek valley
shy cobalt
#

here?

sleek valley
#

yeah

#

just screenshot it

shy cobalt
#

brb

sleek valley
#

okay, so i see a couple problems here

#

let me just

calm marten
#

what scares me is that there is no config = extra

sleek valley
calm marten
#

there is so many things wrong with it
it was easier for me to just create a new one entirely

sleek valley
# shy cobalt
calculate = function(self, card, context)
  if context.individual and context.cardarea == G.play then
    card.ability.extra.xmult = card.ability.extra.xmult + card.ability.extra.xmult_gain
  end
  if context.joker_main then
    return{ xmult = card.ability.extra.xmult }
  end
end

replace your calculate with this and correct the indents as necessary
and then under soul_pos, add this:

config = {
  extra = {
    xmult = --insert number here
    xmult_gain = 0.5
  }
}
#

you also dont need the in_pool function or pools variable

#

like at all

#

especially is it's just to instantly return true on what was already true

calm marten
#

only time i needed to use pools variable is so make sure that booster packs works.

kind palm
#

Working on a balatro card. Does this fit Balatro's artstyle or at least fit appearance wise

sleek valley
#

not quiteee

#

balatro cards are 71 pixels wide and 95 pixels tall

#

that seems a bit taller than that

kind palm
#

Exact numbers ugh, thank you. I never could find out what specifically they were

sleek valley
#

outside that though, it looks decent

#

np :3

viscid talon
shy cobalt
viscid talon
#

u r 00:00, just like me

sleek valley
#

oh right, the clock in my bio .w.

viscid talon
#

YEAH 😭

#

Schrödinger's Brit
ah i see

calm marten
sleek valley
# shy cobalt

you missed a comma, i assume in the config which is my own fault a bit lol

calm marten
#

while yall are trying to figure out
i mean, im sorry i apologize i created this.

#

not going to be in final product

shy cobalt
calm marten
shy cobalt
#

wait ts peak

sleek valley
#

i meaaaannn
say what you will, it's funny as fuck

calm marten
shy cobalt
#

uhhh

#

aalso would i put 1

#

there

#

as the start

calm marten
# shy cobalt

you need to insert xmult in there.
just put a 1 in there

sleek valley
#

and fix the indents please

shy cobalt
sleek valley
#

you'd need a loc_vars funciton

calm marten
sleek valley
#

oh, i didnt know you could return colours in a loc_vars o.o

shy cobalt
slim ferry
#

comma

#

after the 1

#

-# you should also probably brush up on lua basics as was said before

calm marten
shy cobalt
#

it still says

sleek valley
#

wtf

calm marten
#

brb i gotta ask my friend

sturdy compass
# shy cobalt

Are you properly closing the config table? It looks like you might be missing a }

daring fern
sleek valley
#

oh yeah, that is often a big problem too

sturdy compass
#

Forwarding this here since it’s a dev event so if any devs wanna participate in something cool 👀

sleek valley
#

dont think i'll participate, i do terrible work under a time limit .w.

calm marten
#

im still too new for these things, i odnt think i'll participate

sturdy compass
#

No it’s larger in scale than that

#

Team based over the course of 2 weeks

tranquil echo
#

how would i go about adding another slot for jokers, that specific jokers go into?
like mutiplater mod

red flower
sturdy compass
tranquil echo
#

omg thats justa googleable question

#

thank you

red flower
#

idk if vanillaremade is googleable but

#

also it needs a lot more logic depending of what you need it for

tranquil echo
#

oh no im literally just putting custom jokers in it

#

for this do i just make a new file and put this code in it?

red flower