#💻・modding-dev

1 messages · Page 473 of 1

vague crest
#

sick

real night
#

help

granite nymph
#

does anyone know why the colors arent workibng

#

it crashes when i hover over the joker

#

i can just do it for you if you want

#

or i can explain it

manic rune
#

oh wait nvm, hm

real night
#

whats like the function for it

granite nymph
flat siren
#

when someone gets a chance to look at this id be grateful

granite nymph
#

like taket he conditions for jolly joker and add the mult and chips from walkie tyalkie

real night
#

add base chips and mult to a poker hand

#

like leveling it up kina

granite nymph
#

custom tarot card perhaps

#

i mean planet

manic rune
#

you are putting it outside

manic rune
flat siren
#

i did try card = context.other_card so maybe that will do it

edit: no change, unfortunately

ivory coral
#

hello lads
im trying to figure out some ui stuff just so i can understand how it all works incase its useful
and im on the smods wiki UI Guide page following it, but i feel like im missing something big
like ive figured out how ui nodes work got a function that returns the root node a ui thingy
but i am not understanding what a UIBox is at all
i copied over from the guide anyway and like, i dont know what comes after that? like where actually is the ui i just coded how do i see it in-game

pearl jacinth
#

this is the config

config = {extra = {type = "..."}},```
why does
```lua
loc_vars = function(self, info_queue, card)
  return {vars = {card.ability.extra.type, colours = {G.C.SECONDARY_SET[card.ability.extra.type]}}}
end,``` crash
pearl jacinth
#

let me test something

vague crest
#

just reached 45 functional jokers thanks so much everyone 🥳

scarlet imp
#

How does the game know to change the colour of a consumable's "Use" button to red when its use condition is met? I can only see one colour defined in the use_and_sell_buttons function for consumables

wanton adder
pearl jacinth
#

oh i think i figured it out

#

i was making a seal

#

and i used card.ability instead

red flower
final jewel
#

why do I get the cash with the right message but I get a second message saying error after

granite nymph
thorn furnace
#

I've noticed something else strange actually
It grows in size a little on the initial click
You have to cycle back to "locked"/"unlocked" a second time before it's the proper size, no matter if it's the first click or not (it's just more noticeable on the first click)

#

i think anyway
I could be hallucinating ive been looking at this for an hour

granite nymph
#

how do i make this destroy erntire hand

red flower
final jewel
real night
#

im gonna ask again

flat siren
red flower
flat siren
#

oh

#

let me try that

#

this is my first time making a mod for anything so im blind here

granite nymph
flat siren
#

yea that. that did it. drop in on the old code i shared LMAO

daring fern
# granite nymph bu
if context.destroy_card and (context.cardarea == G.play or context.cardarea == "unscored") then
    return {remove = true}
end
lament agate
#

how do you detect if the player is in certain Ante while also in certain rounds

#

say, he's in Ante 8 in just 6 rounds

flat siren
#

Similar problem, my "Again!" text for doing repetition triggered by Joker appears on the played card in hand rather than on the Joker during scoring. i'd like it to be more like the Dusk card

        if context.cardarea == G.play and context.repetition and not context.repetition_only then
            return {
                message     = 'Car!',
                repetitions = card.ability.extra.repetitions,
                card        = context.other_card
            }
        end
manic rune
#

i mean, you are putting the message under the scored card there

flat siren
#

yea i think im misunderstanding how things are working

#

yea i just needed to not be using card = context.other_card

red flower
errant fulcrum
#

Can anyone tell me why this activates for all cards discarded and not just the ones with the seal?

        if context.discard and context.cardarea == G.hand and card.seal == 'leshys_beeswithin' then
            SMODS.add_card({set = 'Base', area = G.hand, no_edition = true, enhancement = 'm_gold'})
        end
    end,```
lament agate
vague crest
#

trying to fix a weird hook bug, is this the right way to call it?

red flower
lament agate
red flower
granite nymph
#

could i maybe make other card every card in the hand

#

or at leasrt a specific slot

vague crest
#

oh wait is a prefix needed as well in the first image? ei see

daring fern
flat siren
#

Does anyone have a mod or resource I can look at to try and implement adding mult as many times as there are a certain rank in your deck? like +3 mult for every 9

granite nymph
#

you would have to tweak the code a lot

flat siren
#

as long as it can tell me how to check the deck then it shoulddd be okay

flat siren
#

oh very nice

sullen brook
#

Any idea why my varSeal variable isn't working here? I grabbed this code straight from the examples page in SealsMod.lua only modifying the entry in config. This works to apply the seal if I type the key of the seal manually into set_seal, but when I use the variable, nothing happens. Weirdest thing is this was working until just now when I was tinkering with another event, and now it's borked.

daring fern
sullen brook
#

Wow... It's entirely too late at night.

#

Disregard all that.

#

Thanks -_-

scarlet imp
#

shouldn't G.STATE be G.STATES.packname when you're inside the menu for a Booster Pack? Like G.STATES.BUFFOON_PACK for example

thorn furnace
wet chasm
#

how are we able to get the base code for balatro, surely its encrypted

scarlet imp
wet chasm
scarlet imp
#

I'm not a game dev, but I'm sure they usually are for security purposes

wet chasm
#

true mb

scarlet imp
sonic cedar
#

does context.post_trigger only apply to other jokers, or can i make it apply to itself?

#

-# also good evening

glass scaffold
daring fern
limber marlin
#

simple question, how do you apply a sticker onto a joker?

daring fern
limber marlin
#

thanks

daring fern
sonic cedar
daring fern
sonic cedar
#

ohhhh

#

thanks

scarlet imp
gusty sequoia
#

How would I make a deck that gives an extra joker slot?

limber marlin
#

Another simple question, how do you get only the jokers in shop? The way I'm trying isn't working, as it's getting the jokers held by the player too

opaque relic
#

can someone tell me why i get squigglies here (at the bottom). mod runs fine and im assuming everything is proper but idk if im missing something

limber marlin
opaque relic
#

😭

limber marlin
#

Thats how I fixed it..

daring fern
opaque relic
#

ahh

scarlet imp
daring fern
spark remnant
#

how do I get the rarity of the card being sold during context.selling_card? according to wiki card = card -- the card being sold so card.config.center.rarity should work but it returns the rarity of the joker

daring fern
spark remnant
scarlet imp
#

when I click the "Use" button on my Joker, how can I get the game to execute the code I need it to? rn it's just doing nothing lol

scarlet imp
#

I figured it out I think

sullen brook
#

How does one call all objects of a certain type at the same time? Lets say seals for example, but the results include both modded and vanilla?

I'm trying to see if I can utilize a math.random to scroll through the number of available seals in the game, pick one, and set the name to a variable for later use.

sonic cedar
#

how would i add a button to a joker? like how they have SELL

chrome widget
#

....how much time do you have

sonic cedar
#

p- lenty

#

i knew i was in for it off rip lmfao

timid parrot
#

how do I add a random seal to a card?

#

(allowing modded seals)

chrome widget
#

Basically, you're primarily looking at hooking G.UIDEF.use_and_sell_buttons() (which is for mouse ui) and G.UIDEF.card_focus_ui() (for controller ui)

static dagger
#

How do I only run code in a calculate if the joker is not being retriggered?

sonic cedar
scarlet imp
#

well, "done" might be a bit of an overstep

sonic cedar
#

sighhhh hello somecom /j

glass scaffold
thorn furnace
chrome widget
thorn furnace
#

It is very weird how we're all coincidentally doing this at the same time

scarlet imp
sonic cedar
#

...unless something like this wouldnt be done in the calculate ofc

chrome widget
#

No

scarlet imp
#

so like the other person said, you'll want to hook G.UIDEF.use_and_sell_buttons and use nodes to add new buttons to the card

chrome widget
#

Basically, when you create buttons in the ui, you can pass a function key into it, which it looks for in the G.FUNCS table that automatically passes the UI node in as a parameter

sonic cedar
#

okay okay im getting ya

chrome widget
#

So you'll have to define your handler function as G.FUNCS.whatever(e)

scarlet imp
#

one thing I did to make my life a bit easier is have G.FUNCS.function_name and also a Card:function_name, and have the G.FUNCS one reference the Card: one, that way you can define the behavior of the button within the card itself rather than inside of the G.FUNCS function

sonic cedar
#

uh
Huhh

#

guess ill start workshopping ✊

sullen brook
scarlet imp
# scarlet imp one thing I did to make my life a bit easier is have `G.FUNCS.function_name` and...
function Card:tboi_can_use(any_state, skip_check)
    if not skip_check and ((G.play and #G.play.cards > 0) or
        (G.CONTROLLER.locked) or
        (G.GAME.STOP_USE and G.GAME.STOP_USE > 0))
        then return false end
    if G.STATE ~= G.STATES.HAND_PLAYED and G.STATE ~= G.STATES.DRAW_TO_HAND and G.STATE ~= G.STATES.PLAY_TAROT or any_state then
        return self.config.center.tboi_can_use(self, self)
    end
    return false
end

-- Color change for TBoI Jokers
G.FUNCS.tboi_can_use = function(e)
    if e.config.ref_table:tboi_can_use(false, false) then
        e.config.colour = G.C.RED
        e.config.button = "use_card"
    else
        e.config.colour = G.C.UI.BACKGROUND_INACTIVE
        e.config.button = nil
    end
end

this is what I'm talking about, but I don't think its strictly necessary

sullen brook
#

In that case, what is type_key referencing?

daring fern
sullen brook
#

Hmmm

pure salmon
#

why is config.lua like this

#

stop that

sonic cedar
pure salmon
#

can it please save my changes

unborn bay
#

delete your config then

#

like. the config jkr file

#

in your config folder

thorn furnace
#

this is the stupidest fix I have ever had to do to fix a UI issue

unborn bay
#

what is this shit my dude

#

why is it repeated 4 times 😭

thorn furnace
#

it does not work if it is repeated any less than four times

scarlet imp
#

actually 5 lol

thorn furnace
#

recalculated five times
the G.FUNCS thing is done four times for parity

scarlet imp
#

computers are magical lol

thorn furnace
#

well
not completely fixed
but now it's one issue instead of like three

scarlet imp
#

probably just gotta mess with the padding and offsets in your nodes now, right?

thorn furnace
#

i mean if you click the button then it returns to normal

#

so you'd think it would just need to reupdate

scarlet imp
#

huh, weird

thorn furnace
scarlet imp
#

you know what that means, Ctrl+c -> Ctrl+v a sixth time

thorn furnace
#

this feels like an insult to programming as a whole

#

unfortunately eight times did not work

scarlet imp
#

sometimes I look back at my coding assignments from my first semester in college and feel the same way

scarlet imp
thorn furnace
#

I programmed a game where like 3/4 of the code without exaggeration was regexes

scarlet imp
#

I programmed connect 4 for one of my assignments as we had to make a computer player and mine was... inefficient, to say the least

hollow crest
#

has anyone found a way to do this?

scarlet imp
#

when its the computer's turn to move it takes like a second to continue the program

scarlet imp
#

I was new to programming, I didn't even know what minimax was lmao

thorn furnace
#

unfortunate

scarlet imp
#

I used brute force, looking 2 moves into the future

thorn furnace
#

...only two moves?

scarlet imp
#

thankfully since connect 4 only has 6 moves max it was only 6^3 possible moves

thorn furnace
#

like two moves for each person or two moves in total

scarlet imp
#

well the current move, the opponent's response, then the move after that

#

it was bad, I could definitely do it better now with minimax and alpha-beta pruning if I actually cared

thorn furnace
#

The thing is that tic tac toe should be a brute forceable game

#

like three moves is just (10 - initial turn count)P3 moves in total, right?

scarlet imp
#

yeah, computationaly its not very complex

scarlet imp
#

ahhh back to the Discrete Comp days

#

that class was fun

thorn furnace
#

well
I guess that number would be a strict max because games would end before that

scarlet imp
#

pretty sure this counts possible board states

thorn furnace
#

it's how many paths of three moves you could have chosen

#

assuming game overs don't exist and ruin everything

scarlet imp
thorn furnace
#

yeah

#

9P9

scarlet imp
#

but its way overcounted because of all the possible boards with 3 in a row

thorn furnace
#

I mean even still it's not too much of a problem

#

9! is what like uhh

#

is it 362880 or is that 10!

scarlet imp
#

yeah you got it

thorn furnace
#

yea

#

wait I'm dumb it couldn't have been 10! because 36288 isn't divisible by 5

#

anyway

scarlet imp
#

shh

thorn furnace
#

less than a million is usually pretty trivial to calculate nowadays

#

I would even say the same for a billion if your code is decent enough

scarlet imp
#

yeah

if num < 1000000000:
  num+=1
  print(num)

type shit lol

thorn furnace
#

did u mean "while"

scarlet imp
#

whoops

#

I gotta sleep

thorn furnace
#

go eep

scarlet imp
#

but this damn use button won't work

thorn furnace
scarlet imp
#

I KNOW

#

or ++

thorn furnace
#

yea

scarlet imp
#

like even Python at least has +=

chrome widget
#

WHY DOES LUA NOT HAVE INCREMENT OPERATORS ANFHFHDHDHDH

limber marlin
#

on god

scarlet imp
thorn furnace
#

every language should follow in the steps of C# where if any binary operator a # b is followed by = (like a #= b), it is automatically parsed as a = a # b

limber marlin
#

lua++

thorn furnace
#

TypeScript was made because JS was so bad they had to make TypeScript

scarlet imp
#

does anyone know why G.STATE is G.STATES.PLAY_TAROT in the shop hahahascbnaoienfoianwfcmac

#

i'm going crazy with this dumb button

thorn furnace
sonic cedar
#

does anyone remember the thing that lets you test ui stuff without me having to open the game
see failure
change thing
reboot
repeat

thorn furnace
#

is that a thing

sonic cedar
#

i could also be going insane so keep that in mind

thorn furnace
#

Could be?

#

We're programming in a custom engine that's the default here

sonic cedar
#
function Card:hpfx_transform_button(card)
    local transform = nil
    if card.area and card.area.config.type == 'joker' then
    transform = {n=G.UIT.C, config={align = "cr"}, nodes={
      {n=G.UIT.C, config={ref_table = card, align = "cr",padding = 0.1, r=0.08, minw = 1.25, hover = true,
      shadow = true, colour = G.C.UI.BACKGROUND_INACTIVE, one_press = true, button = 'hpfx_Transform', func = 'hpfx_can_transform'},
      nodes={
        {n=G.UIT.B, config = {w=0.1,h=0.6}},
        {n=G.UIT.C, config={align = "tm"}, nodes={
          {n=G.UIT.R, config={align = "cm", maxw = 1.25}, nodes={
            {n=G.UIT.T, config={text = localize('hpfx_shed'),colour = G.C.UI.TEXT_LIGHT, scale = 0.4, shadow = true}}
          }}
        }}
      }},
    }}
    end
end

G.FUNCS.hpfx_can_transform = function (e)
    if e.config.ref_table:hpfx_can_transform(false, false) then
        e.config.colour = G.C.RED
        e.config.button = 'hpfx_Transform'
    else
      e.config.colour = G.C.hpfx_IjiGray
      e.config.button = nil
    end
end

so here's my overrides setup so far where do i go from here

scarlet imp
#

has anyone ever hooked use_card before

#

I'm boutta lose it

daring fern
sonic cedar
#

well make up your mind will you 😭

scarlet imp
#

im sayin

sonic cedar
#

/j

chrome widget
sonic cedar
#

both sections?

#

or just that top one

scarlet imp
#

both

chrome widget
#

You'd return transform, if it's valid

scarlet imp
#

the function that will actually do stuff in game is going to be referenced by the node

chrome widget
#

Then you're gonna need to hook G.UIDEF.use_and_sell_buttons() and insert it somewhere into the larger node tree of those buttons

sonic cedar
#

okay right

thorn furnace
daring fern
chrome widget
#

Need to do G.UIDEF. in the redeclararion, and remove the parenthesis from your local reference

timid parrot
#

Is there a wiki page with all these helpers and stuff?

thorn furnace
#

well
I guess that doesn't have all of them

sonic cedar
#

-# somecom im gonna get you lmfao

chrome widget
#

Technically you already do that in the inner function, so really you'd just have to use the return from that function. Otherwise it'll be nil, and it just won't do anything on the tree

sonic cedar
#

ohhh ok

so

#

no nvm i dont get it 🥀

scarlet imp
#

dw you're not alone

#

I'm dying over here

sonic cedar
#

hi 1 up

scarlet imp
#

its actually d6 but I haven't made the sprite yet lol

sonic cedar
#

hi d6

thorn furnace
#

hi d6 but I haven't made the sprite yet lol

feral tree
#

is there any limit to the atlas size?

scarlet imp
#

you mean the size of the image?

feral tree
#

yeah

scarlet imp
#

well mine is 1500x3600 and it works fine so probably not lol

feral tree
#

aw sonnuva bitch i've been restricting myself to 138x186 for nothing

thorn furnace
scarlet imp
#

I thnink it would be the other function you made, hpfx_transform_button

sonic cedar
#

ohhh yeah the actual button lmfao

chrome widget
sonic cedar
#

nvm pensiveclown_cc

chrome widget
#

You're gonna need to get the original return from the local ref of the function and slot it in somewhere here

The tree provided by G.UIDEF.use_and_sell_buttons() is this:

  n=G.UIT.ROOT, config = {padding = 0, colour = G.C.CLEAR}, nodes={
    {n=G.UIT.C, config={padding = 0.15, align = 'cl'}, nodes={
      {n=G.UIT.R, config={align = 'cl'}, nodes={
        sell
      }},
      {n=G.UIT.R, config={align = 'cl'}, nodes={
        use
      }},
    }},
}}```
scarlet imp
#

if I have button = "tboi_use_card" inside of my button node it should be referencing this function when clicked, right?

chrome widget
#

every time I see "tboi" I think it's abt smth else

scarlet imp
#

I think I'm gonna call it a night, this button is making me sadge

#

and by "call it a night" I mean "play Isaac for about 2 hours then sleep after if possible"

chrome widget
#
function G.UIDEF.use_and_sell_buttons(card)
  local ret = thunk(card)
  local inner_nodes = ret.nodes[1].nodes
  inner_nodes[#inner_nodes+1] = {n=G.UIT.R, config={align = 'cl'}, nodes={
    G.UIDEF.hpfx_transform_button()
  }}
  return ret
end```
sonic cedar
chrome widget
#

probably this. Additionally under the assumption that jokers cannot be consumables, you could also do this I suppose

function G.UIDEF.use_and_sell_buttons(card)
  local ret = thunk(card)
  local inner_nodes = ret.nodes[1].nodes[2].nodes
  inner_nodes[#inner_nodes+1] = G.UIDEF.hpfx_transform_button()
  return ret
end```
#

Which just puts it in the same node level as the use button, and depending on the card it'll just show one or the other

sonic cedar
#

well i mean it is for jokers so i should use this one then right

chrome widget
#

Both work, really, though the latter option might have less spacing by default?

#

Since there's not an extra row node added?

sonic cedar
#

like less than the sell button?

chrome widget
#

No I mean, this is ordering a descending row of buttons (you can see this in game, the sell button is above the use button for consumables)

sonic cedar
#

ohhh you meant on the card

chrome widget
#

The second option essentially contextually swaps the use button for the transform button on jokers, since on jokers the use button will be nil, and on consumables the transform button will be nil. The first option adds a unique row for the transform button below where the use button would be

#

And idk if there's some default spacing/padding that would have an increased gap or w/e. Haven't tried it lol

sonic cedar
#

ok i should use the latter in this instance then
especially since i dont have any jokers that would need a use button lmao

chrome widget
#

Yep yep

#

Cant guarantee it'll work 100%, UI is fickle and if there are other issues with the code I didn't immediately catch em

sonic cedar
#

only one way to find out i--wait how do i add it to the card Fear

chrome widget
#

it should just add it automatically

frigid cargo
#
calculate = function (self, card, context)
        if context.cardarea == G.play and context.repetition then
            if context.other_card:get_id() == 11 then
                return {
                    G.E_MANAGER:add_event(Event({
                            trigger = 'after',
                            delay = 0.3,
                            card:juice_up(),
                    })),
                    dollars = card.ability.extra.jack_dollars,
                    repetitions = card.ability.extra.repetitions
                }
            end
        end
    end

i want to make the dollars activate per repetition too but idk how

chrome widget
#

G.UIDEF.use_and_sell_buttons() is called from Card:highlight() as the definition for a new UIBox

scarlet imp
chrome widget
#

So by hooking the function, it'll just get added to the UI when the card is clicked like normal

sonic cedar
chrome widget
#

change the conditions that cause G.UIDEF.hpfx_transform_button() to return

#

In the one you sent me, you're only checking that it's in your joker slots

sonic cedar
#

ohh ok

scarlet imp
sonic cedar
#

uh huhhh

#

oh god why is this folder load crashing now

small tartan
#

Not all, Just a bit

sonic cedar
scarlet imp
#

look down, did it have an error parsing a file?

small tartan
#

There is a value that isnt initialized

#

And it's nil, maybe wrong call

sonic cedar
scarlet imp
#

usually it says the line near that if you look around a bit

#

like forgetting to close a function or something like that

sonic cedar
#

ahhhh i guess they didnt like me hitting enter here

#

it being "ambiguous syntax" and all

#

oh
new crash
oh it's all gonna be ambiguous syntax huh

#

yeah there we go

scarlet imp
#

W

runic pecan
sonic cedar
daring fern
daring fern
sonic cedar
sonic cedar
small tartan
#

GUYS

sonic cedar
#

the crash only happens when i click on the card

small tartan
#

I DID IT!!! Converting ranks works!!

daring fern
sonic cedar
daring fern
small tartan
scarlet imp
small tartan
sonic cedar
small tartan
#

It was Crazy stupid, maybe Yesterday i had too much burnout going on

flat siren
#

he is here..

small tartan
daring fern
flat siren
#

it would, it's based off of the cloud nine example code someone posted here earlier

scarlet imp
#

classic

sonic cedar
#

IT'S BEEN A LONG DAY

scarlet imp
#

happens to the best of us

sonic cedar
#

what do you WANT from me waaaaa_death

#

if self.config and self.config.func and (((self.config.button_UIE or self.config.button) and self.config.func ~= 'set_button_pip') or self.config.insta_func) then G.FUNCS[self.config.func](self) end

flat siren
#

should this be uncommon

sonic cedar
#

so a value isnt being set right

scarlet imp
flat siren
#

Good to know

#

I am new to Balatro, so I am not sure what exactly works reasonably

scarlet imp
#

I wouldn't worry too much about the balancing of your cards rarity wise until you've played a decent amount with them. Jokers need their run to shine yknow

#

Unless its Obelisk, that thing is terrible

hidden sable
flat siren
#

real

thorn furnace
sonic cedar
thorn furnace
#

I don't think it would matter in that sense
Make sure the file is loaded and that everything is spelled correctly i guess

sonic cedar
#

make sure the... the main file is loaded?

thorn furnace
#

we're both tired here

scarlet imp
#

lmao

sonic cedar
#

wont put spelling past me though lmfao

#

ok so here it is in the main file (1) and the uses in the overrides file (2, 3)

thorn furnace
#

G.FUNCS.hpfx_Transform

sonic cedar
#

it looks like i spelled them right which means ONE of them is missing some k-that

#

it's missing that

hidden sable
#

how would i go about making a ui box (or realistically any element that i can make red and slightly transparent) slowly scale over the screen starting at the top

sonic cedar
chrome widget
#

You also don't need to send the context variable, and card is a misnomer. The first and afaik only supported parameter sent is the node that calls it (usually just called e in vanilla code)

thorn furnace
#

from chain rebooting

sonic cedar
#

am i gonna have to have a separate one for the button

hidden sable
#

i'm too stupid for shaders tho so i might have to start stealing things

chrome widget
sonic cedar
#

version without context param it is

chrome widget
#

Also in general if the parameter is grayed out and you're not using it, you can just get rid of it

sonic cedar
#

yeah i know
they irk me so i tend to kill them

#

there are three versions of this now

chrome widget
#

Transbutt is mine thanks

sonic cedar
#

mine first i tagged it

chrome widget
#

And what code is it pointing to?

sonic cedar
#

thats RIGHT i can LOOK

#

wait i sent this already

chrome widget
#

Means the function you attached to the button isn't in the G.FUNCS table

sonic cedar
chrome widget
sonic cedar
#

heck yeah

carmine burrow
flat siren
#

it aint

carmine burrow
#

if you have enough 9s to get this above half joker levels, you have enough 9s to play a hand with any base mult

sonic cedar
#

the uncommon badge:

carmine burrow
#

+12 off the bat is too free for a common joker though

#

it's in a bit of an uncomfortable spot w/r/t rarity

flat siren
#

fine by me

wet chasm
#

+2 instead of +3 would be around uncommon

flat siren
#

i was thinking similar. every 9 is picked because cats have 9 lives

#

+2 could be picked because car is 2

wet chasm
#

car is 2?

flat siren
#

apparently

sonic cedar
#

not anymore

flat siren
#

car was two

lament agate
#

how do you make a joker that appears in a shop automatically buys itself

#

is it possible

carmine burrow
#

i mean erosion is +4 per, the deckfixing requirement is way less demanding (hang any cards rather than specifically strengthing 8s / using death to convert into 9s), and it's really bad

#

well, it's really situational

sonic cedar
daring fern
lament agate
lament agate
chrome widget
daring fern
# lament agate how to

You could perhaps always check if the card appears in G.shop_jokers.cards then call the buy function?

daring fern
chrome widget
lament agate
chrome widget
#

Remove G.FUNCS from this. It needs the function key to check the G.FUNCS table

sonic cedar
#

i cant stop losing

#

this time for sure

lament agate
#

so just

#

buyfromshop?

chrome widget
#

The function itself is declared as G.FUNCS.hpfx_Transbutt(). Then you refer to the function by its key, 'hpfx_Transbutt'

hidden sable
sonic cedar
scarlet imp
lament agate
#

oh youre talking to toml

#

my bad

chrome widget
#

What the UI code is doing is taking that string and attempting to do this:
G.FUNCS[key]

So in your specific example it was trying to do G.FUNCS['G.FUNCS.hpfx_Transbutt']

sonic cedar
#

oh well no wonder lmao

sonic cedar
chrome widget
#

Show me what you changed

scarlet imp
#

Guess I'll have to catch up on the saga in the morning lol

sonic cedar
#

no more gfuncs *in the strings

chrome widget
#

And show me the function it's trying to call?

hidden sable
sonic cedar
# chrome widget And show me the function it's trying to call?

almost sent a ss of it oops

function G.FUNCS.hpfx_Transbutt(card)
    G.E_MANAGER:add_event(Event({
        trigger = "immediate",
        delay = 0,
        func = function ()
            if card.config.center.blueprint_compat and card.config.center.key ~= 'j_hpfx_ijiraq' then
                local key = card.config.center.key
                table.insert(G.GAME.raqeffects, key or G.GAME.current_round.fodder_card.jkey)
            end
            return true
        end,
    }))
    G.E_MANAGER:add_event(Event({
        trigger = "after",
        delay = 0.15,
        func = function()
            card:flip()
            return true
        end,
    }))
    G.E_MANAGER:add_event(Event({
        trigger = "after",
        delay = 0.15,
        func = function()
            card:set_ability(G.P_CENTERS["j_hpfx_ijiraq"])
            play_sound("card1")
            card:juice_up(0.3, 0.3)
            return true
        end,
    }))
    G.E_MANAGER:add_event(Event({
    trigger = "after",
    delay = 0.15,
    func = function()
        card:flip()
        return true
    end,
    }))
    return true
end
chrome widget
#

That is not the correct function??

sonic cedar
#

what do you MEAN 😭

hidden sable
chrome widget
#

Didn't you have a function that sets the state of the button based on trying to call this function???

#

That's the one you're supposed to call

sonic cedar
#

scared tf out of me i thought it was over over

merry frost
lament agate
flat siren
#

trying +2

daring fern
sonic cedar
chrome widget
#

Okay okay okay hold on let me reset for a monute

lament agate
daring fern
urban wasp
#

any way to get this to show up correctly without the player going into the blind?

chrome widget
#

Your button needs two things basically:

  • a function to set the state of the button based on whether or not you can press it currently (I assume this is hpfx_can_transform)
  • a function to actually be called on press (I assume this is hpfx_Transbutt)
urban wasp
daring fern
urban wasp
#

oh yeah that probably would help

chrome widget
#

In most examples I've seen, the state function is usually on a higher level node than the button function. I don't know if that's absolutely necessary or not

sonic cedar
#

moving it rn

chrome widget
#

Do me a favor and also not collapse the code for the functions

#

Since I can't see what might be breaking

hidden sable
sonic cedar
sonic cedar
#

(why didnt i just send three images? tired_smile)

#

moved the state thing up alr so dw about that part

chrome widget
#

Oh well you're calling hpfx_can_transform as if it's a function on the card object?

small tartan
#

Any clues why this doesnt erase Kings? Ace is 14

chrome widget
#

Or is that a different function named the same thing?

sonic cedar
small tartan
chrome widget
#

What is this function then?

sonic cedar
#

cooked me being a dumbass winter
is that what you wanted to hear
im a FOOL

chrome widget
#

This is being called as if it's a function declared like this:
Card:hpfx_can_transform(param1, param2)

#

I assumed it was just like checking if the card is valid to transform currently but if you never declared that function then yeah that's nil

sonic cedar
#

do i declare it in the joker

chrome widget
#

Idk depends on what you need it for

sonic cedar
#

do i even need 2 params actually

chrome widget
#

In what situations is a card that can transform (I.E. it has a button to do so) not valid to transform (meaning the button should be greyed out)?

sonic cedar
#

ahhhh

chrome widget
#

If you don't need to check that, then you don't need that function at all

sonic cedar
#

i guess really just between transitions (like when youre getting paid out after a blind)

#

but the game already handles that doesnt it

chrome widget
#

I think the game automatically grays out buttons during certain things? Like how you can't press use on Planets until after end of round results finish?

#

So probably

#

Yeah

sonic cedar
#

ok so then yeah i didnt need this at

#

all actually

chrome widget
#

Nope. Get rid of it and only use the button property

sonic cedar
#

holding my "this time for sure" down in case im missing something else

chrome widget
#

To give an example, the Use button on consumables runs a function like the one you just got rid of every frame to determine if the button should be grayed out or not. So internally it calls the card's Card:can_use_consumable() function to selectively determine whether you can press the button, such as how consumables that require you to highlight something can't be used until you have a playing card highlighted

#

And then it sets the color of the button and the on press function accordingly

sonic cedar
#

ok yeah then i literally dont need it

chrome widget
#

Ye

sonic cedar
#

THIS TIME FOR SURE

#

WAIT I KNOW THIS ONE

#

IT'S STILL CALLING THE CAN TRANSFORM FUNC WHICH DOESNT EXIST

chrome widget
#

Did you not remove the func = "hpfx_can_transform" from the UI node?

sonic cedar
#

THIS time for sure (no i did not but I CAUGHT IT)

#

(despite you telling me exactly that)

bitter portal
#

what does... rule 3 of modding rules even mean

chrome widget
#

It basically means don't @ localthunk telling them how to fix the vanilla code

sonic cedar
#

AAAAAAAAAAAAAAAAAAAA FINALLY

chrome widget
#

You'll want to change the color of the button in the node

sonic cedar
#

that i know how to do

#

im scared to click it

chrome widget
#

I assume it didn't work?

sonic cedar
#

i dont think they like center

chrome widget
#

And what is card in this instance? Show me more of the function

sonic cedar
#

here's the whole event

chrome widget
#

You're passing in the wrong thing for this function

sonic cedar
#

oh god

chrome widget
#

Like I mentioned before, the only valid parameter for functions used as button callbacks is the node for the button itself

sonic cedar
#

oh g-oh thats not bad actually

chrome widget
#

IMO change the parameter in this function to e and before this event do
local card = e.config.ref_table

sonic cedar
#

ok ok got it

chrome widget
#

It doesn't automatically pass in the card object itself, so you have to grab it from where you stored it in the node

sonic cedar
#

yeah in the- Fear

#

wasnt the e the state function

chrome widget
#

It's needed for both

sonic cedar
#

but not the uidef

chrome widget
#

No, because when that's being called, you're passing in the actual card object

sonic cedar
#

ye

#

THIS TIME. FOR SURE

flat siren
#

thoughts?

chrome widget
#

Highly underpowered

sonic cedar
chrome widget
#

Also I'd recommend changing the text for the Xmult to white for vanilla consistency

flat siren
#

it was 0.25 initially but someone said it was too much

chrome widget
#

0.25 is too much, sure, but try 0.15 or 0.2

#

Or even 0.10, but that puts it closer in the realm of being a common

tawdry oriole
#

maybe keep 0.25 but make it start at 0? so with a vanilla deck it'd be at 1x and scale it up from there

flat siren
#

that was how it was originally

#

under 4 9s you'd get 1x, 5 9s was 1.25x

chrome widget
#

Honestly that doesn't sound too powerful at all tbh

tawdry oriole
#

yeah no it sounds right

chrome widget
#

That's like fine??

#

Maybe cut it down to 0.2 if you absolutely need to but 0.25 seems good

flat siren
#

0.2 to keep it uncommon perhaps

#

although. thats a funny tag when im using the two sprite card thing. it looks menacing and intense

chrome widget
#

Even 0.25 isn't enough to get into rare territory, given that Lucky Cat is an uncommon

#

And that scales tremendously

sonic cedar
#

button update

#

pleaseworkimbeggingyou

flat siren
#

really appreciate the input folks!

tawdry oriole
#

no worries mate!

sonic cedar
chrome widget
#

Nice

#

It's 3 AM and I'm going to bed now

#

❤️

hidden sable
hidden sable
#

we need an accessibility feature for making the cards less scary 😭

sonic cedar
#

<3

#

...after i update creds

small tartan
#

I May be stupid, i solved It like this

#

Almost done :3

median veldt
#

i wish balatro would just auto word wrap sometimes 💔

molten musk
#

morning

small tartan
#

Ok sometimes my cards make the game crash and i don't know why

#

It crashes on src/override.lua

primal robin
#

Guy literarry hides mods list

#

In crash log

small tartan
#

Oh it's this part

primal robin
#

Crazy

small tartan
#

But it's my mod's fault i know for sure

primal robin
#

Then log is useless

crisp coral
#

i like how you only screenshotted up to line 583 not 589

small tartan
#

Oops

#
local ret = {}
    for _,k in ipairs(SMODS.Rank.obj_buffer) do
        if next(ranks[k]) then
            tuples[#tuples+1] = {k}
        end
#

Better than screenshots tbh

small tartan
runic pecan
#

Can I change the display order of items of a set in collection without changing the order of how the codes and files are loaded?

small tartan
#
    key = 'Knave',
    card_key = 'F',
    pos = { x = 9 },
    nominal = 8,
    face_nominal = 0.05,
    face = true,
    shorthand = bbb_lang.english_names and 'Knv' or 'F',
    next = { 'Knight' },
    loc_txt = { name = bbb_lang.english_names and 'Knave' or 'Fante' },
    in_pool = allow_suits
}
#

Did i miss something on ranks?

bitter portal
median veldt
#

is it possible to like count how many unique suits are in the scored hand

flat siren
#

i knew something felt wrong looking at the mult numbers, that was it

leaden bay
#

Does anyone know how to use in_pool for a back? I'm trying to remove a few jokers from appearing in a deck and I can't find any documentation that isn't just for individual cards saying whether or not they're in the pool

red flower
leaden bay
#

Ah, fair. Then how might I go about preventing some cards from appearing? The functionality exists, though I only know it's used in the challenge decks

red flower
small tartan
red flower
#

what's the code and the crash

leaden bay
red flower
#

apply

small tartan
median veldt
#

random question: is it possible to manipulate the drawing of cards, like making certain suits more likely to be drawn or something

bitter portal
small tartan
#

Seal**

red flower
small tartan
#

Oh

#

If that's i'm gonna give you a virtual hug

#

A giant one indeed

median veldt
#

Also what's the seal

small tartan
small tartan
bitter portal
#

bump... again again...

small tartan
#

@red flower First of all thank you so much 🫂

Second, can you help or redirect dogeiscut

red flower
#

no sorry

median veldt
small tartan
#

:)

median veldt
#

i suppose

small tartan
#

Sorry if i'm not of Much help

#

I don't know any other things that do this

median veldt
#

i feel like theres a better way to manipulate the weight of an entire suit or something

#

i dont know if its possible at all

#

which is fine lmao

median veldt
#

maybe?

small tartan
#

Thats actually a cool card, i should try aiko's mod

red flower
#

if you want higher probabilities then you need this + your own custom logic for weighting

#

i dont know of any mod that does that

median veldt
#

then i'll be the FIRST tiktokproud just kidding i'm. not too great with lua
I'll write it down tho

tawdry oriole
#

how do you check if there's currently a highlighted playing card?

red flower
#

G.hand.highlighted[1]

tawdry oriole
#

thanks

flat siren
bitter portal
#

wow i guess my shader is so bad it makes the game close after it loads 😭

nocturne garnet
flat siren
#

🙊

maiden phoenix
#

elial jumpscare hi

unborn bay
#

hi sdm 0

nocturne garnet
#

sdm_0

maiden phoenix
#

hi haya

small tartan
#

@red flower can i override rank 7 so that using strenght 7 becomes Knave with my custom suits, and 8 with vanilla suits?

red flower
#

no idea

maiden phoenix
red flower
#

take ownership of 7 is so funny

wintry solar
#

I suppose it's time to go through all these smods PRs I've been too busy to look at 🥳

formal parrot
#

Yeyyyyy

hidden notch
#

How do I draw a Line like this in a Description?

tawdry oriole
#

i'm gonna take ownership of 3 and make it another 4

maiden phoenix
primal robin
#

seven.

bitter portal
red flower
hidden notch
#

Ah .. I see lewxen_Teary_Laugh
Well, then: Do you have an Example for the Multibox-Description?

red flower
#

there's one in the localization docs

#

or check my hit mod JoyousSpring, all jokers have it :3

hidden notch
#

Nice Plug, I'll check that too then lewxen_Noblewoman_Laugh

small tartan
#

Oops Sorry didnt meant to notify ping

maiden phoenix
#

I think it's explained in the docs question mark?

small tartan
#

I'm gonna check, thanks :)

#

Found it

paper zealot
wintry solar
#

I can do that but there is no way that I am prepared to spend time reviewing wiki PRs

bitter portal
hidden notch
bitter portal
#

What is context.other_card?

maiden phoenix
#

The concerned card by context like individual

bitter portal
#

when would it not equal card inside of calculate?

maiden phoenix
#

Say you have Hack, card is the joker, context.other_card is a played card

bitter portal
#

Ooh, that makes sesne.

#

Okay, thank you!

#

Im just looking for ways to fix my issue with my brown seal here, and figured I should probably get a better understanding of this cobbled together code

#

What are all the triggers for an Event?

crisp coral
#

before, after, immediately, ease, [no trigger]

bitter portal
#

What... do they do exactly?

red flower
#

check the event manager docs

bitter portal
#

Oh! I was looking for that on the docs

#

Thank you!

#

there has been a mistake

#

its making an awful noise too

#

ughhhh i cant figure out why its drawing cards before the cards finish discarding

#

seriously... i cant figure this out

#

im gonna flip

long sun
#

hi! some of my consumables that i'm placing in the shop are showing as undiscovered

#

as in, they use the undiscovered sprite and undiscovered text, even though they're in the shop and i should be able to see their sprite and text

#

i know i've forgotten to do something here, but what?

bitter portal
# bitter portal ughhhh i cant figure out why its drawing cards before the cards finish discardin...

how do i fix this???? 😭

SMODS.Seal {
    key = 'Brown',
    atlas = 'cfawm_enhancers',
    pos = { x = 0, y = 0 },
    badge_colour = HEX('a0522d'),
    calculate = function(self, card, context)
        if context.discard and context.other_card == card then
            G.E_MANAGER:add_event(Event({
                trigger = 'before',
                delay = 0.0,
                func = function()
                    local any_selected = nil
                    local this_index = nil
                    for i, playing_card in ipairs(G.hand.cards) do
                        if playing_card == card then
                            this_index = i
                            break
                        end
                    end
                    if this_index and G.hand.cards[this_index + 1] then
                        G.hand:add_to_highlighted(G.hand.cards[this_index + 1], true)
                        play_sound('card1', 1)
                        any_selected = true
                    end
                    if any_selected then G.FUNCS.discard_cards_from_highlighted(nil, true) end
                    return true
                end
            }))
            return { message = "Discarded!", colour = HEX('a0522d') }
        end
    end,
}
long sun
#

it's because you're running this all in an event iirc

#

try adding a function to your return

#

wait no you don't need to do any of that, you can just remove the event around it

#

it'll work without the event

#

so try

SMODS.Seal {
    key = 'Brown',
    atlas = 'cfawm_enhancers',
    pos = { x = 0, y = 0 },
    badge_colour = HEX('a0522d'),
    calculate = function(self, card, context)
        if context.discard and context.other_card == card then
                    local any_selected = nil
                    local this_index = nil
                    for i, playing_card in ipairs(G.hand.cards) do
                        if playing_card == card then
                            this_index = i
                            break
                        end
                    end
                    if this_index and G.hand.cards[this_index + 1] then
                        G.hand:add_to_highlighted(G.hand.cards[this_index + 1], true)
                        play_sound('card1', 1)
                        any_selected = true
                    end
                    if any_selected then G.FUNCS.discard_cards_from_highlighted(nil, true) end
            return { message = "Discarded!", colour = HEX('a0522d') }
        end
    end,
}```
bitter portal
#

er... that crashed my game 😭

long sun
#

log?

bitter portal
#

like

#

hard crash

long sun
#

like it went into an infinite loop?

bitter portal
#

it made a pretty awful noise too

#

It just... instantly closed after making a terrible noise when i discarded

maiden phoenix
#

I think something you should do is first highlight each concerned card and THEN you discard them

long sun
#

what's your seal's ability?

bitter portal
#

ideally allowing for chains

long sun
#

oh i see

red flower
#

what if you remove discard cards from highlight

long sun
#

you're discarding in the function, which triggers your seal again

#

infinitely

#

so you can remove the line that discards the cards, as that'll happen anyway

bitter portal
#

Well it shouldn't do it on the same card twice though?

long sun
#

okay but your seal discarding triggers the context.discard context

red flower
#

in that context the card is still highlighted so it will

small tartan
#

Do SMODS.rank { next = {} support multiple ranks?

long sun
#

i think the seal's cool btw! :D

long sun
small tartan
long sun
bitter portal
long sun
small tartan
native zinc
#

did you global right

long sun
#

i've assigned that elsewhere

small tartan
red flower
small tartan
#

Oh right!!

bitter portal
# bitter portal now it just highlights?
SMODS.Seal {
    key = 'Brown',
    atlas = 'cfawm_enhancers',
    pos = { x = 0, y = 0 },
    badge_colour = HEX('a0522d'),
    calculate = function(self, card, context)
        if context.discard and context.other_card == card then
            local any_selected = nil
            local this_index = nil
            for i, playing_card in ipairs(G.hand.cards) do
                if playing_card == card then
                    this_index = i
                    break
                end
            end
            if this_index and G.hand.cards[this_index + 1] then
                G.hand:add_to_highlighted(G.hand.cards[this_index + 1], true)
                play_sound('card1', 1)
            end
            return { message = "Discarded!", colour = HEX('a0522d') }
        end
    end,
}
red flower
#

yeah now you're just adding to highlighted without discarding that card

red flower
#

i would probably look into how discard from highlighted works and do that for the card you want

long sun
#

i'm wrong ^u^ dw

unborn bay
#

you'll have to discard it manually

bitter portal
#

Hm okay... so now im back at square one... or i guess back at the hard crash.

long sun
#

i know how this works now — you do need to discard that card manually, but discarding the card you've already discarded will cause an infinite loop

#

i'd maybe add a bool that determines if it's already made the check

red flower
#

no, what I'm saying is that instead of using discard_from_highlighted you should do what that function does inside but just for your card

bitter portal
long sun
#

ya

unborn bay
#

really all it does much is a call to draw_card from hand to G.discard

red flower
#

else you would probably have to figure out the event order and that sounds like a pain

long sun
bitter portal
#

pain

#

well thats another idea for the scrap bin

unborn bay
#

its not that hard 😭

small tartan
#

So basically

I should take ownership of the 7
Then somehow filter the next rank with suits

primal robin
unborn bay
#

^

bitter portal
long sun
primal robin
#

Vanila game have no check for shop booster pack area, only for jokers and vouchers

#

So in your case you need manually set one of there for yor card

#
card.bypass_discovery_center = true
small tartan
#

Would this work?

G.E_MANAGER:add_event(Event({
    delay = 0.6,
    func = function()
        if G.GAME.starting_params.scopa_Deck then
            SMODS.Rank:take_ownership('7', {
                next = {'BBB_Knave'}
            }, true)
        else
            SMODS.Rank:take_ownership('7', {
                next = {'8'}
            }, true)
        end
        return true
    end
}))
unborn bay
#

NEVER call take_ownership anywhere during runtime

#

that includes events

spark remnant
#

I'm currently trying to make a joker count any cards after the base 5 as being scored, I have this which is mostly copied from splash, how do I make it only activate on cards after 5? I tried changing the i = 1 to i = 6 but it just makes the game crash.

        if context.before then
            for i = 1, #G.play.cards do
                  context.scoring_hand[i] = G.play.cards[i]
            end
            table.sort(context.scoring_hand, function(a, b)
                return a.T.x < b.T.x
            end)
            delay(0.2)
            for i = 1, #context.scoring_hand do
                --Highlight all the cards used in scoring and play a sound indicating highlight
                highlight_card(context.scoring_hand[i], (i - 0.999) / 5, "up")
            end
        end
red flower
#

unless you mean you want to expand play limit

spark remnant
small tartan
#

I throw in the towel

echo aurora
#

How do you add vfx?

lament agate
#

you can only use DynaText in loc_vars?

normal crest
#

you can use it anywhere, it's an ui element

lofty sand
#

whats the shortcut to quick restart balatro? I remember it being holding R but that doesn't seem to work

normal crest
#

Hold M

lofty sand
#

cool, thanks

lofty sand
#

it's R for restarting at a crash screen

#

is the correct context for rerolling the shop "context.shop_reroll"?

echo aurora
#
context.reroll_shop
vast bough
#

what are all the main valid contexts for checking blind requirements. i can see from mr. bones that end of round works but are there any others?

pure salmon
#

you can check and alter them whenever i think

#

i do at least, and it doesn’t cause problems

#

if you want to end the round early or something, never found a way to make that work seamlessly

lofty sand
pure salmon
#

i usually alter the blind requirement in context.setting_blind if i can help it

rare torrent
#

how do i change the main menu card suit? doing this crashes the game [[patches]] [patches.pattern] target = "game.lua" pattern = "replace_card.states.visible = false" position = "before" payload = "replace_card:change_suit('Hearts')" match_indent = true overwrite = false

bitter portal
#

i want to add a message for each brown seal but i dont know how to manually create those message things

maiden phoenix
#

(except the first parameter is the discarded card I suppose)

vast bough
#

but my code for checking may be wrong

bitter portal
#

sighhhhhh

#

it didnt actually seem to break anything but it paused for longer than i'd like to and made a bunch of noises for cards clearly off screen

#

i think some cards just got... discarded multiple times

vast bough
bitter portal
maiden phoenix
#

show your new code?

bitter portal
#
SMODS.Seal {
    key = 'Brown',
    atlas = 'cfawm_enhancers',
    pos = { x = 0, y = 0 },
    badge_colour = HEX('a0522d'),
    calculate = function(self, card, context)
        if context.discard and context.other_card == card and not card.disable_brown_seal then
            G.E_MANAGER:add_event(Event({
                trigger = 'before',
                delay = 0.0,
                func = function()
                    local to_discard = {}
                    local this_index = nil
                    for i, playing_card in ipairs(G.hand.cards) do
                        if playing_card == card then
                            this_index = i
                            break
                        end
                    end
                    if this_index then
                        for i = this_index + 1, #G.hand.cards do
                            local next_card = G.hand.cards[i]
                            table.insert(to_discard, next_card)
                            if next_card:get_seal() ~= 'cfawm_Brown' then
                                break
                            end
                        end
                    end
                    if #to_discard ~= 0 then
                        play_sound('card1', 1)
                        for _, card in ipairs(to_discard) do
                            G.hand:add_to_highlighted(card, true)
                            card.disable_brown_seal = true
                            G.FUNCS.discard_cards_from_highlighted(nil, true)
                            G.hand:remove_from_highlighted(card)
                        end
                    end
                    return true
                end
            }))
            return { message = "Discard!", colour = HEX('a0522d') }
        end
    end,
}
#

I was trying to make it find chains of brown seal cards and like, discard them all in advance

#

but i forgot to account for discarding multiple cards at once 😭

#

and i kinda also dont know how to acount for that

long sun
#

hi again ^^

#

i have this line now:
local card = Card(area.T.x + area.T.w/2, area.T.y, G.CARD_W, G.CARD_H, G.P_CARDS.empty, _center, {bypass_discovery_center = true, bypass_discovery_ui = true})

bitter portal
#

im trying to avoid reimplementing remove_from_highlighted because i dont understand it and i want cards to trigger their discard effects

long sun
#

this works mostly, but the "Not discovered" text isn't showing up

#

any ideas?

#

oh wait uhm

#

wrong line

#

wrong script, that's from the base game -u-

#

heeyah

#

local card = SMODS.create_card { key = key, area = G.shop_booster, bypass_discovery_center = true }

#

will try something in the meantime

#

mm, okay that didn't work either

#

(i tried bypass_discovery_ui)

bitter portal
#

it's now back to how it was before

maiden phoenix
#

Mmmh I should try recreating it one day

bitter portal
#
SMODS.Seal {
    key = 'Brown',
    atlas = 'cfawm_enhancers',
    pos = { x = 0, y = 0 },
    badge_colour = HEX('a0522d'),
    calculate = function(self, card, context)
        if context.discard and context.other_card == card then
            G.E_MANAGER:add_event(Event({
                trigger = 'before',
                delay = 0.0,
                func = function()
                    local any_selected = nil
                    local this_index = nil
                    for i, playing_card in ipairs(G.hand.cards) do
                        if playing_card == card then
                            this_index = i
                            break
                        end
                    end
                    if this_index and G.hand.cards[this_index + 1] then
                        G.hand:add_to_highlighted(G.hand.cards[this_index + 1], true)
                        play_sound('card1', 1)
                        any_selected = true
                    end
                    if any_selected then G.FUNCS.discard_cards_from_highlighted(nil, true) end
                    return true
                end
            }))
            return { message = "Discarded!", colour = HEX('a0522d') }
        end
    end,
}
rare torrent
#

why is this code always creating a seven of diamonds in the title screen? i want it to create an ace of hearts ```function Card:resize(mod, force_save)
self:hard_set_T(self.T.x, self.T.y, self.T.w * mod, self.T.h * mod)
remove_all(self.children)
self.children = {}
self.children.shadow = Moveable(0, 0, 0, 0)
self:set_sprites(self.config.center, self.base.id and self.config.card)
end

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

local newcard = SMODS.create_card({
    set = 'Base',
    suit = 'Hearts',
    rank = 'Ace',
    area = G.title_top,
    no_edition = true
})

G.title_top.T.w = G.title_top.T.w * 1.7675
G.title_top.T.x = G.title_top.T.x - 0.8
G.title_top:emplace(newcard)
newcard:start_materialize()
newcard:resize(1.1 * 1.2)
newcard.no_ui = true

return ret

end```

bitter portal
#

Okay uh, how do i patch functions?

#

is it just... a good ol' fasion monkeypatch?

hallow forge
#

It can be

sonic cedar
#

hey can i use self in my button ui function if i add it to the params, or does balatro's code not work that way?

#

(UIDEFbuttonfunction(card) -> UIDEFbuttonfunction(card, self))

#

also good morning pardon my manners

placid star
#

is hooking create_card_for_shop thr best way to test buying a joker?

placid star
lament agate
#

how do i hook into the shop

lofty sand
#

is there a context for cashing out/entering the shop?

sonic cedar
lament agate
sonic cedar
lofty sand
#

o fr

#

bet

lament agate
sonic cedar
chrome widget
#

If the parameter isn't being passed in by your code, you can't use it in the function

sonic cedar
chrome widget
sonic cedar
native zinc
#

wel

#

well

chrome widget
#

k is nil when that block checks it because the code is after the for loop closes

#

Cards can't have nil keys, so if a card doesn't have the visiblyIjiraq flag, that code will never run

sonic cedar
#

well the visiblyijiraq thing gets applied in the joker's set_ability (pretend i checked for false in the override)

#

wrong image

chrome widget
#

Point being you're still perpetually comparing key == nil in that condition

sonic cedar
#

well actually no since the button should only appear when you have it so disregard that

sonic cedar
#

so just put it in the for loop?

chrome widget
#

If that's how your code works, sure

#

Do you understand the concept of scope in programming?

sonic cedar
#

to an extent? im not good at this ui thing

primal robin
sonic cedar
#

so it's probably stuff i already know but the ui stance is uhh

chrome widget
#

Scope is unrelated to ui. It's a fundamental programming concept

sonic cedar
#

no no i know i mean like my brain

chrome widget
#

k and v, due to the way loops work, are declared as local variables to the scope of this loop. The moment this loop closes and the code goes past it, both k and v become nil

#

So they only exist within that loop code

sonic cedar
#

so then break wont help here right right

chrome widget
#

What this loop is functionally doing is running through the exceptions, and if the key is in the exceptions list, breaking early and doing nothing else

#

The loop code currently accomplishes nothing

#

Given exceptions is a map (I think?), you can probably just change the key == k comparison in that bottom if statement to exceptions(key)

sonic cedar
#

so then id have to put the whole ui setup withIN the for loop for it to actually matter

chrome widget
#

And remove the for loop entirely

sonic cedar
#

i should show you that table actually in case

#

(this continues)

#

basically part of an override setup for the disguise (instead of disguising as and mimicking 8 ball, it'll disguise as and mimic MY 8 ball)

chrome widget
#

Huh, weird. You're trying to explicitly type them

sonic cedar
#

it's not for every joker

chrome widget
#

Is this some code setup I'm not familiar with?

#

No I mean declaring they keys as string types, and the table as a global

sonic cedar
#

ohhh hold on ill show you

chrome widget
#

Both of those are implicit per how Lua works

sonic cedar
#

(this works btw there's no issue with it)

#

so, within the costume's set_ability function it has these lines:

chrome widget
#

No I'm glad I'm just confused why you're using it

#

Point being, exceptions is not an indexed list. It has string keys, so you can check if a key exists on the table as you do there and just do exceptions(key) unless you actually want to compare to the values in the table rather than the keys

sonic cedar
sonic cedar
chrome widget
#

Then yeah you do need the for loop

#

Here's what you should do:

sonic cedar
#

locked in go

#

-# (also rarity is card.config.center.rarity right)

native zinc
sonic cedar
native zinc
#

-# the loudest of all whispering

sonic cedar
#

-# it's a talent

chrome widget
# chrome widget
if card.area and card.area == G.jokers and key ~= 'j_hpfx_ijiraq` then
    local excepted = nil
    for k, v in pairs(exceptions) do
        if key == v then
            excepted = true
            break
        end
    end
    
    if excepted or card.visiblyIjiraq the 
         -- run your code in here
    end
end```
stark viper
shell timber
#

okay so it looks like you have mismatched brackets in your lua file

#

can you send the contents of that?

stark viper
#

this is what my code looks like.

chrome widget
#

Missing a comma after the key

shell timber
#

okay so for your SMODS.Thing calls you want curly brackets instead of regular ones

#

that as well

stark viper
#

facepalming at myself

chrome widget
#

Also yes, you use curly brackets for table declarations (which is what this is doing)

sonic cedar
chrome widget
#

Idk, you didn't show the return

sonic cedar
chrome widget
#

When is this declared?

#

And what assigns to it when the checks pass?

sonic cedar
#

better ss

shell timber
#

no problem

sonic cedar
#

i probably get what you mean but ive been wrong before

chrome widget
sonic cedar
#

oh ok phew

#

i did get it

chrome widget
#

so technically you can just return transform from within that inner block, because otherwise the function returns nil anyway

sonic cedar
#

that's what i was considering

#

but SHOULD i

chrome widget
#

Or you could explicitly declare local transform = nil before it goes into this code` and then return it after it leaves these blocks

#

Both are functionally identical, though the latter option is kinda more readable

sonic cedar
#

ok one last check to make sure

chrome widget
#

Yeah that works. I'd indent that inner block more though

#

It's a little hard to read

sonic cedar
#

should be good
only thing would have to be if for some reason card.visiblyIjiraq returns false

sonic cedar
chrome widget
#

this one

sonic cedar
chrome widget
#

Looks good

sonic cedar
#

god i love having ram ive had balatro open this entire time and my framerate is still smooth as hell

chrome widget
#

I'm naked and full of mucus on the floor of my bathroom after trying to shower to clear my sinuses b/c im sick and dying

#

So I'm just helping you on my phone lol

sonic cedar
#

oh you poor soul

#

well good news

#

phase 1 pass

#

dont panic im just stupid and forgot to change this back to card

sonic cedar
#

hell yeah

chrome widget
#

I'm gonna go visit a partner in like a week but I feel like DEATH

pale holly
#

Hey, i'm trying to make my joker rank up the first 3 cards of a played hand but right now it only rank up seemingly all the cards played, and does flip them, rank up, flip them and rank up again, how could i fix that ?

    
    if  context.cardarea == G.play and context.other_card == context.scoring_hand[1] then
        G.E_MANAGER:add_event(Event({
            trigger = 'after',
            delay = 0.4,
            func = function()
                play_sound('tarot1')
                card:juice_up(0.3, 0.5)
                return true
            end
        }))

        for i = 1, #context.scoring_hand do
            local percent = 1.15 - (i - 0.999) / (#context.scoring_hand - 0.998) * 0.3
            G.E_MANAGER:add_event(Event({
                trigger = 'after',
                delay = 0.15,
                func = function()
                    context.scoring_hand[i]:flip()
                    play_sound('card1', percent)
                    context.scoring_hand[i]:juice_up(0.3, 0.3)
                    return true
                end
            }))
        end

        delay(0.2)

        for i = 1, #context.scoring_hand do
            G.E_MANAGER:add_event(Event({
                trigger = 'after',
                delay = 0.1,
                func = function()
                    assert(SMODS.modify_rank(context.scoring_hand[i], 1))
                    return true
                end
            }))
        end

    
    for i = 1, #context.scoring_hand do
        local percent = 0.85 + (i - 0.999) / (#context.scoring_hand - 0.998) * 0.3
        G.E_MANAGER:add_event(Event({
            trigger = 'after',
            delay = 0.15,
            func = function()
                context.scoring_hand[i]:flip()
                play_sound('tarot2', percent, 0.6)
                context.scoring_hand[i]:juice_up(0.3, 0.3)
                return true
            end
        }))
    end
    end
end,
chrome widget
#

WEHHHHH

sonic cedar
sonic cedar
pale holly
sonic cedar
#

what in the world does "third first" mean

pale holly