#💻・modding-dev

1 messages · Page 410 of 1

vale plinth
#

oh

#

okay thanks

hybrid shadow
#

what do you currently have in loc_vars and config

snow vale
hybrid shadow
snow vale
#

it already saved before, the problem is that it wont show the current value

hybrid shadow
snow vale
daring fern
hybrid shadow
#

ah

thorn furnace
#

Are there some references I can look at for how hooks work

daring fern
# thorn furnace Are there some references I can look at for how hooks work
Klei Entertainment Forums

In LUA, it is a very important concept to understand that everything is a variable and all variables may be edited in runtime. This includes functions. With modding other peoples' LUA files, like Klei's basegame code, you may find yourself wanting to run your code before or after the original fun...

snow vale
#

can i make a rainbow text or smthing

daring fern
snow vale
#

oo how

#

are there docs

daring fern
snow vale
#

o

#

ok

burnt quartz
#

Can I read a .txt to use for declare vars inside my mod?

zenith sage
burnt quartz
daring fern
zenith sage
#

thgank you

snow vale
#

to the text

daring fern
snow vale
#

i hate ts

daring fern
snow vale
spare wren
#

How can I make a card polychrome in the shop by default? And force polychrome when it's added to G.jokers?

daring fern
snow vale
#

{C:rainbow}{}

spare wren
# snow vale

from what I know you don't have to put the gradient as a variable as it auto registers with it's constructor, using the rainbow key should work normally

daring fern
snow vale
#

:/

daring fern
snow vale
#

still not working

daring fern
snow vale
spare wren
#

that's how I fixed it

snow vale
#

oh

#

ok

#

works now ty

#

it feels a bit blocky, how do i make it look smooth?

daring fern
snow vale
#

o

outer basalt
#

what would be the way to go about making it so only a couple cards of a rarity can spawn in the shop?

#

the easiest idea i can think of is just making two rarities identical except one can spawn in the shop but that seems. jank at best

daring fern
outer basalt
#

darn. I was hoping it could be the other way around because there would be fewer jokers that will be in the shop (so it would be less work to do the ones that will spawn.) but alas

zenith sage
outer basalt
winter ridge
#

yo if you just have texture mods and stuff do u not get achivments

#

nothing to do with gamplay like

outer basalt
#

youll prolly have to go into the settings and change this

winter ridge
#

ah ok thanks

outer basalt
#

np

winter ridge
#

im kinda new to balatro and i finally got gold stake done just changed the thing and now i have to do gold stake again to get the achievement😭 🙏

outer basalt
#

😭 I havent even done gold stake non modded gl out there

#

(im just here for the chaos)

sonic cedar
#

so this works in terms of triggering the context, but now space joker doesnt level up the hand

daring fern
faint yacht
#

Detecting "level ups" of hands, assuming?

sonic cedar
winter ridge
sonic cedar
# sonic cedar

should I trigger the calc context after the return instead?

sonic cedar
#

ok phew I thought so

#

what do I do instead then

#

man 😭

#

oh Yk what

#

What if I put it in an event

#

Actually yeah thats probably it

#

space is the only one that hasn’t been in an event

#

no wait bloodstone

#

why isn’t this working then hhh

#

maybe it’s a bug and I just have to reboot

thorn furnace
#
if (context.other_card == G.jokers.cards[this_joker - 1]) or (context.otherCard == G.jokers.cards[this_joker + 1]) then
  return {
    message = localize('k_again_ex'),
    repetitions = 1,
    card = card
  }
else

Why does this code snippet only repeat the Joker to the left of the current Joker and not the Joker to the right

daring fern
thorn furnace
#

oh

sonic cedar
#

other_card does

thorn furnace
#

thank u
my eyes are silly

sonic cedar
#

Which you did for the left yeah

thorn furnace
#

I'm too used to camel case

sonic cedar
#

save it for variables

north lodge
#

After generating the shop list, it seems that despite my best efforts, real cards are made and still take up processing power, tanking my fps. I tried to use the Card.remove() function to delete the card after I take a note of it, but alas it still exists somewhere. Any thoughts?

north lodge
#

I made an alternate function that emulates Card.create_card and have been removing parts as needed, but otherwise it is exactly the same as Card.create_card

#

That method is called by a copied version of create_card_for_shop if that matters

daring fern
north lodge
#

I am making a mod that functions like The Soul and the only way I could accurately generate the shop list was by doing it the same way the game does 😅

#

Thinking about it, I probably can just get the center and skip the part about actually generating the cards.

midnight coyote
#
function SMODS.has_no_rank(card)
  if card.seal and card.seal == 'charcuterie_obscure' then
    return true
  end
  if card:get_id() > 10 and next(G.jokers.cards, 'j_charcuterie_aphantasia') then
    return true
  end
  return smods_has_no_rank_ref(card)
end
#

okay ive fucked something up terribly

#

it softlocks when i do card:is_face

#

and crashes so hard when i do this that it doesnt even show me a stacktrace

sonic cedar
#

do I have to put the calc context IN the return?? That doesn’t make sense

#

maybe I should try after just to see

sonic cedar
#

were you giggling while making this

midnight coyote
#

😭

#

i don’t understand

midnight coyote
sonic cedar
#

maybe the one without the yellow line

midnight coyote
#

well on the is face function

#

i think it’s referencing another method on the card?

#

idk

daring fern
midnight coyote
#

wait

#

then

#

if they don’t have ranks

#

how will the game know if they’re face cards

#

fuck

hushed grail
#

hey chat why is context.card.config.center.key not the key for the joker and what can i use instead? (cav is my prefix)

midnight coyote
#

i’m gonna rework this to apply a seal to played face cards that then makes them rankless

outer basalt
#

wait how do you put cards in a booster pack?

hushed grail
sonic cedar
daring fern
thorn furnace
#

Is the warning to say that you can tell whether or not it's a played or discarded hand by checking if scoring_hand is nil or not

sonic cedar
pure salmon
#

how do i draw a specific card from the deck? do i use draw_card or SMODS.draw_cards?

thorn furnace
#

baller

pure salmon
#

i have an enhancement (honey) that when drawn has a chance to draw another honey card. my code currently selects a random honey card in the deck, and i just need to find a way to have it drawn to hand.

daring fern
minor magnet
#

ok chat so i want to make a joker that gives X3 mult when a debuffed card is scored

#

one issue is

#

debuffed cards aren't scored on context.individual

#

how would i go about fixing this

daring fern
minor magnet
#

great observation

pure salmon
#

percent what?

daring fern
faint yacht
#

It is, yeah.

pure salmon
#

ah

#

if i'm just drawing one card i would just pass 100?

coarse karma
#

hi can i ask whats the modifier i add to the joker to remove it from the shop pool?

outer basalt
north lodge
pure salmon
#

is there a safe way to use draw_card? it's creating evil ghost cards

sonic cedar
outer basalt
#

ew (not at nick's code I SWEAR)

sonic cedar
#

oh brother

outer basalt
#

do we ping moderators or smthn?

sonic cedar
#

<@&1133519078540185692>

outer basalt
#

🔥

sonic cedar
#

the evil has been defeated

outer basalt
zenith sage
#

dare i say im curious

#

what evil has been smote

outer basalt
#

it was just a scam lol

zenith sage
#

ah

sonic cedar
#

steam scammer again

daring fern
sonic cedar
#

ill check rq

pure salmon
#

which variable hold a table of all the cards currently in the deck

#

?

daring fern
sonic cedar
daring fern
sonic cedar
#

I… did not

#

Take 2

#

ok no crash

#

now does it work

#

HECK YEAHHHHHH

#

Something youre goated tysm 🙏

pure salmon
#

how do i make this recursvely draw cards (when honey card B is spawned by A, B should call this code again to potentially draw honey card C)

#

is it something to do with calculate_context?

#

because i need to reevaluate context.hand_drawn

daring fern
sonic cedar
#

how do I make a value round to the nearest whole after an increase

pale holly
#

Ok just to be sure, getJokerID(card) can be used in order to detect the placement of my joker, and using something like G.jokers.cards[getJokerID(card)+1] can detect the card on the right then ?

I'm trying to do a joker that works like blue print with a few changes so i want to be sure if this what i could use in order to make my blueprint like joker work

sonic cedar
daring fern
pale holly
# daring fern Probably.

I'll go give it a shot, i'm looking trough Yahimod's code in order to see how i can remake a blueprint like joker since i don't think i saw any vanilla remake one in smods or something

pure salmon
daring fern
solid mesa
#

i need help, where i read smods documentation? i forgot is page

daring fern
solid mesa
sonic cedar
#

Hi aure’s cat

daring fern
pure salmon
#

when a card is drawn with draw_card i don't think it calls hand_drawn

daring fern
pure salmon
#

because that's when the enhancement happens?

daring fern
pure salmon
#

because i only make the check to draw another honey card when the honey card first gets drawn to hand

#

which happens in and only in hand_drawn afaik

daring fern
pure salmon
#

that crashes the game with no handler screen

solid mesa
#

what is "misc"? just miscellaneous that you can add if you want?

pure salmon
#

hmm

#

i also want to recalculate hand_drawn because i use that for joker effects

#

and i want those to trigger/increment when i draw a honey card

daring fern
wintry solar
pure salmon
sonic cedar
pure salmon
daring fern
wintry solar
pure salmon
#

i'm not sure what context.hand_drawn is supposed to be, on the wiki it says true but then how can i use ipairs on it??

red flower
#

it's a list of the cards drawn from deck to hand during a blind

wintry solar
#

Is hand drawn even on the wiki?

pure salmon
#

helpful

wintry solar
#

I really need to finish updating that page 😭

pure salmon
wintry solar
#

No

red flower
#

i dont know what calculate_enhancement is even

rapid stag
#

how do i do UI with pages and such

sonic cedar
#

testing,,,

rapid stag
#

like the stuff in collections

red flower
#

i have a recreation of the collection in my mod

rapid stag
#

is that also in ui_definitions cirSlain

sonic cedar
pure salmon
#

i just want to recalcuate the honey card effect when it's drawn by another honey card, because context.hand_drawn doesn't reevaluate when draw_card is played

red flower
#

cant you make your own context

wintry solar
#

Is the idea that when you draw one honey card it will draw the rest?

pure salmon
#

if you draw a honey card, 1 in 2 chance to draw another and it's recursive

#

got everything but that last part working

rapid stag
wintry solar
#

Then you cry and think of something easier to do

red flower
zenith sage
#

how might one get an enhancement to use a shader instead of a card back texture

zenith sage
#

🙏

outer basalt
#

my only guess as to how is maybe make separate rarities? I'd rather keep them all on the same rarity for thematic purposes but art and feasibility will always be at heads

pale holly
#

I guess getJokerID(card) wasn't working or do'nt exist, it instantly crash when loading the card in the collection

pure salmon
plain gazelle
#

How do I get sell value of the Joker/Consumable that was added (context.card_added)?
My Joker changes sell values of all Jokers and Consumables when context.card_added is true, but problem is that the sell value of the Joker that was added does not change

wintry solar
plain gazelle
plain gazelle
# daring fern No?

I just don't understand how hooking a set_cost would work, it's not a variable (like in Castle 2 example). (I don't fully understand how hooks in general work to be honest)

snow vale
#

that's 1 in 1

#

which is 100%

pure salmon
#

i have an oa6 in the screenshot

#

just for testing

snow vale
#

oh ok

daring fern
pure salmon
#

it's fine, after using calculate_context i'm reasonably happy with the behaviour

daring fern
plain gazelle
daring fern
snow vale
#

can i make an enhancement loc_txt's name diff color from usual? (aka using {C:red}{})

#

cuz this is happening to me

red flower
#

no

snow vale
#

😔

#

also why isnt this working?

#

i mean the black square right there

red flower
#

the key might be wrong

snow vale
#

the key is rainbow

#

NMVM

#

NVM

#

ub_rainbow

#

darn it

daring fern
#

plain gazelle
# daring fern No, I'm talking about `Card:set_cost`

Wait, I think I'm on the right track
I need to hook "function Card:set_cost()". It activates when a card's sell value is being changed. Inside the hooked function, I need to change the card's ".sell_value" with the help of ".self"?

daring fern
plain gazelle
#

Should work, thanks

vale plinth
#

you can have multiple atlassas in one file right?

daring fern
vale plinth
#

yea

#

so two of these

daring fern
vale plinth
#

alr thanks

sleek cliff
#

Is there a way to create a pool of destroyed Jokers?

daring fern
sleek cliff
#

I think a table of keys would be better

#

cause this is the idea

normal quest
#

anyone familiar with immolate.dll? I'd like to edit the brainstorm mod to find instant chicot instead of instant perkeo, but looks like the latest version of the brainstorm mod that does this just passes some args into Immolate.dll and idk how exactly all that works and what I would have to change to make it look for chicot instead

daring fern
sleek cliff
#

brings back a dead joker

daring fern
sleek cliff
#

yes

vale plinth
#

is there a list somewhere for all the color code thingies?

#

lol

daring fern
vale plinth
#

thanks

daring fern
# sleek cliff yes

You would probably hook Card:remove and check if its a joker and it was added to deck then add it to a table with the format of {self.config.center.key, self.ability}

outer basalt
red flower
#

no

#

you need to pick a key first

outer basalt
#

I currently have a function running to pick the key. It put it in the create card function and had it return the key?

wintry solar
#

You can generate the cards yourself for your booster though

outer basalt
#

That's basically what I'm trying to do 😭

#

This list is all the cards that can be generated.
Pick an item from the list
Put that in the key =

red flower
outer basalt
#

True. I do actually have one made I think I've been at this so long I lost the plot LMAO

#

Or I forgot why that didn't work??

outer basalt
#

Oh my god 😭 < dissociation moment

We solved that part but the thing I needed help on was the select_card BCS now it crashes when I select one 💀

#

But I can't. Select the card with the custom button

red flower
#

whats the crash

wintry solar
#

what type of cards are they?

outer basalt
#

Let me go see

#

I got up to eat and that's why the fuckin. Dissociation moment happened 😭

outer basalt
#

if I dont have select_card in there i can select the others fine just not that one

#

i can also. see the sell button on it so I think its something to do with the code i used from N. likely missed something 😭

wintry solar
#

add an area check to where you alter the buttons

red flower
#

honestly that was one of the first things i did in my mod so i dont remember any of it

outer basalt
#

thats what i thought. just like self.cardarea == G.jokers ?

outer basalt
#

i cant remember my code 5 seconds after making it 😭

red flower
#

all my button code has area checks

#

in fact i have a type of card that changes buttons in a booster (i dont know if thats what youre referring to)

outer basalt
#

OH. yeah i see it now

#

when i was originally looking at it I hadn't played joyousspring at all so I did NOT know what extra_deck etc. meant 😭

#

so I just disregarded it

red flower
#

play joyousspring!!

outer basalt
#

i haaave

#

now

red flower
#

but yeah thats kinda the hard part of using my code for examples haha

vale plinth
#

can someone tell me why this does not work. "attempt to call a nil value"

native zinc
#

at what line

vale plinth
#

lemme see

#

1 tf

#

this is 1

#

but this was working fine earlier

red flower
#

post the crash log

#

also that header doesnt look right lmao

outer basalt
#

It might be something wrong with loading the file. Sometimes I get weird things like that if my file has an error in it (like not closing SMODS.joker{

vale plinth
#

ohh wait it wasnt this file that crashed im stupid

#

this is

outer basalt
#

(two of the same card, not the same card every pack*)

vale plinth
#

weird

outer basalt
#

Oh wait nvm I'm dumb and quite unlucky LOL

#

^ it just rolled onto the same card multiple times I just need to add the can't have multiple logic to my randomness if

#

Ig

#

And you can now select the card YAY

midnight coyote
#

how do i check the current deck

midnight coyote
#

assert(SMODS.load_file("jokers.lua")())

vale plinth
#

what does asserting it do

#

cuz it worked fine earlier

midnight coyote
#

if it fails to load

#

it will then crash

vale plinth
#

ohh

midnight coyote
#

this is good for debugging

#

it basically is checking to see if it returns true

#

its asserting that it will always return true

#

and if the assertation fails then it will panic and crash

vale plinth
#

still

midnight coyote
#

jokers.lua is nil

#

it doesnt see jokers.lua

#

here let me do you one better

vale plinth
#

is it blind

#

dude

#

no

midnight coyote
#
DHY = {}
DHY.FUNC = {}
DHY.G = {}

DHY.G.MODPATH = SMODS.current_mod.path
local NFS = require("nativefs")

function DHY.FUNC.RequireFolder(path)
  local files = NFS.getDirectoryItemsInfo(DHY.G.MODPATH .. "/" .. path)
  for i = 1, #files do
    local file_name = files[i].name
    if file_name:sub(-4) == ".lua" then
      assert(SMODS.load_file(path .. file_name))()
      print("Loaded " .. path .. file_name)
    end
  end
end

function DHY.FUNC.RequireFolderRecursive(path)
  local function scan(currentPath)
    local fullPath = DHY.G.MODPATH .. "/" .. currentPath
    local files = NFS.getDirectoryItemsInfo(fullPath)

    for _, fileInfo in ipairs(files) do
      local fileName = fileInfo.name
      local fileType = fileInfo.type
      local childPath = currentPath == "" and fileName or currentPath .. "/" .. fileName

      if fileType == "directory" then
        -- Recursively scan subdirectories
        scan(childPath)
      elseif fileType == "file" and fileName:sub(-4) == ".lua" then
        -- Load the Lua file with proper relative path
        assert(SMODS.load_file(childPath))()
        print("Loaded " .. childPath)
      end
    end
  end
vale plinth
#

<@&1133519078540185692>

midnight coyote
#

this creates 2 functions

#

one that loads a folder

#

and one that loads a folder and also any folders within that folder

vale plinth
#

ohhh

midnight coyote
#

i use this in my mod

#

so now, make a folder in your mod's root called 'items'

#

then after those functions, add this line
DHY.FUNC.RequireFolderRecursive("items")

#

then put jokers.lua in items

vale plinth
#

alr

normal crest
midnight coyote
#

im setting my guy up with the good stuff

#

because imo all mods that get large enough need to load stuff like this because it makes it 20x easier to bugfix when you know exactly what broke

red flower
#

i just dont make code that crashes

midnight coyote
vale plinth
midnight coyote
#

yeah

vale plinth
#

so anything i put in items will load?

midnight coyote
midnight coyote
normal crest
red flower
midnight coyote
#

ugh how do i check to see what deck is being used

normal crest
#

G.GAME.selected_back

vale plinth
#

why am i getting the same crash wth

willow scroll
#

chat how i make it so the logo is not over there

midnight coyote
midnight coyote
normal crest
#

i don't think so

vale plinth
#

oh cus i didnt save

midnight coyote
#

make sure your file is saved

vale plinth
#

im too smart

midnight coyote
#

is the key

normal crest
#

yippie

willow scroll
vale plinth
#

@midnight coyote

#

:p

midnight coyote
#

add an extra end

vale plinth
#

where?

midnight coyote
#

move the call to line 40 and put the end in line 39

vale plinth
#

what does it end there

#

oh i see

midnight coyote
#

the function

vale plinth
#

it starts up

#

the mods dont work

#

in items i put jokers.lua and decks.lua @midnight coyote

midnight coyote
#

hm

normal crest
vale plinth
#

i can try it but this way is nicer (if it works)

long sun
#

how do you check if a specific mod is enabled?

vale plinth
#

otherwise ill try removing the ./

normal crest
long sun
#

cheers ^^

normal crest
#

You'd do if next(SMODS.find_mod('paperback')) then for example

long sun
#

tyty :D

midnight coyote
#

how would i forcefully start a shop

#

i need to start one at the beginning of the game

#

for a back

vale plinth
#

maybe check cryptid's code card

vale plinth
normal crest
#

What is your mod file structure

vale plinth
#

it specifically crashes by the second line

#

the first one is fine

#

My Mod file and in there the lua files

normal crest
#

Or was that smt else

vale plinth
#

now it's not in items

vale plinth
normal crest
#

What's your jokers.lua file

vale plinth
#

wdym whats it

normal crest
#

Since the decks.lua one works fine then the problem is with thst file

normal crest
vale plinth
#

ohh

#

it started doing this after i added this

#

wait let me delete this and see if it works

normal crest
vale plinth
#

ah.

normal crest
drowsy acorn
#

im trying to get this joker to subtract the score of the first hand of round from the required score, but the best ive been able to do is this, which has the issue of also triggering when you discard and draw new cards after the first hand. ive tried a lot of ways to try and limit it to only happening once per blind but ive gotten nowhere drspec2Whyyy

        if G.GAME.current_round.hands_played == 1 and G.STATES.SELECTING_HAND and context.hand_drawn then
             G.GAME.blind.chips = G.GAME.blind.chips - G.GAME.chips
             G.GAME.blind.chip_text = number_format(G.GAME.blind.chips)
             return {
                message = {'Calculated!'},
             }
        end
    end```
noble patrol
#

Hi I want to make my mod joker as a default starter joker.
So once player starts the game, the joker is on the slot in use already.
Is there a way for this? Can anyone point me to the documention or the function? Thanks!!

normal crest
#

Not sure if it'll work

drowsy acorn
#

i tried context.after, that doesnt work

normal crest
#

What happens?

drowsy acorn
#

the reason the if statement is like that is because that seems like the best way for me to get the right timing since it needs the round score to finish calculating before it can do what it needs to to the blind requirement

drowsy acorn
#

well, it does subtract

#

by 0

normal crest
#

Makes sense I guess

drowsy acorn
#

hence the very ugly if statement

normal crest
#

And hand_drawn triggers on each discards?

drowsy acorn
#

yeah

#

cuz its whenever cards are, well, drawn to hand

#

that includes discards

#

ive tried to set up some counter that increments by 1 every time the if statment is true and if its exactly 1 the rest of the calculations happen, but it never actually incremented

normal crest
#

That's probably the way tho

#

Set a flag on your joker if it has triggered

#

And only do the subtractions when it hasn't (in your current context)

#

And reset the flag at the end of round

normal crest
noble patrol
normal crest
#

And you want it to happen on every single run? Or is it tied to a deck for example

noble patrol
#

I want it to happen on every single run. If it is not possible, binding to a deck also works

normal crest
#

It's possible, it'd require hooking the blind apply to run function

#

But idk if you're familiar with hooking or looking at the game's source

normal crest
chrome widget
#

You've heard "All women are queens". Now get ready for:

pure salmon
#

hmm i want to make a joker that gains chips when wheel of fortune fails but i don't know anything about hooking, what's the easiest way to implement this joker

normal crest
#

I don't think you can do that with hooking, it'd have to be a lovely patch

wind steppe
#

what if you just take ownership of wheel and check for your joker

normal crest
#

That's not a good idea, taking ownership would mean redoing the entire wheel code

pure salmon
#

is there any good documentation on ownership? idk where i'd even start with that

normal crest
#

Even if you copy pasted it you'd break other lovely patches made by other mods

drowsy acorn
normal crest
#

Can I see what you've tried

noble patrol
normal crest
#

You just add some of your own code to an existing function

drowsy acorn
# normal crest Can I see what you've tried

not at my computer rn so i cant get it directly, but basically directly after the “then” i did
“local triggered_count = 0
triggered_count = triggered_count + 1”
and then i checked if triggered_count was equal to 1

normal crest
#

You'd need to add a flag to your joker's config

#

And modify that

zealous glen
noble patrol
pure salmon
#

ok i found the wheel code i think, how would i patch it so this joker gains chips when it fails? can i create a new context?

wind steppe
#

does anyone have a tutorial on lovely patches

normal crest
#

I think there's a wiki page in the smods wiki about lovely patches

#

But i don't remember

tall jewel
#

Is there any easy way to display an attention_text at an arbitrary pixel position (ie, love.graphics.getDimensions()/2)

zealous glen
#

There's maybe a tutorial in the lovely GitHub

wind steppe
#

in the sense that if i already knew how it worked and forgot, for example, a variable name i could go back and understand it but the barrier to entry is high

pure salmon
#

what's the basic syntax for making a new context? can i just define context.fortune_fail and set it to true or is it deeper than that

normal crest
#

SMODS.calculate_context {your_context_name = true}

#

Any additional information you want in your context you include in that table

sonic cedar
#

speaking of, can you trigger it with something like business card?

normal crest
#

you can add a context anywhere you want yeah

#

its just finding the right place for it and patching it in

sonic cedar
#

ok cool in that case here's my real issue

#

it's not patching

#

like here's the patch

#

but when i load the game up nothing happens to card.lua

normal crest
#

Did you copy that from the lovely dump

sonic cedar
#

yea

#

like every other patch

#

which does work

#

but for some reason this one isnt?

wintry solar
#

what's your priority?

normal crest
#

Looks like talisman is patching that too

sonic cedar
#

0

normal crest
#

If yours happen before talisman it won't apply

#

I think

zealous glen
wintry solar
#

what's your mod name?

normal crest
zealous glen
#

The patches would work

#

They might never run

#

But they would work

wind steppe
#

define "work"

zealous glen
#

The code do be patched

sonic cedar
normal crest
sonic cedar
zealous glen
#

But also if two mods want to modify the same Joker they might want to do so in a way that's not compatible

wintry solar
#

then your patch will never hit

normal crest
wintry solar
#

change your priority to 1

sonic cedar
#

ok

normal crest
#

Also your patch depends on talisman being enabled

sonic cedar
#

oh my god it’s alphabet sensitive too

normal crest
#

So if you don't want your mod to be dependant on talisman you'll have to change the pattern

sonic cedar
wintry solar
#

is there a reason you need it in the return table?

zealous glen
drowsy acorn
wind steppe
#

if i wanted to patch the round ending to disable mr bones (and similar) under specific circumstances how would i do that?

wintry solar
#

like, why can't you just target the pseudorandom line?

sonic cedar
#

no reason actually

#

the last one I patched (space) needed the func version to actually do anything so I was just trying to avoid anything else

#

but I guess in this case i don’t need it

normal crest
zealous glen
#

@wintry solar @willow plinth also I'll try to open that issue we had discussed tomorrow

zealous glen
sonic cedar
#

Ohhh

zealous glen
sonic cedar
#

that one space..

wintry solar
#

there's a double space there?

zealous glen
#

it seems that all it does is change the offset of those pop-ups, and it's for a mechanic I haven't implemented much

zealous glen
#

Usually for Jokers you'll do Card.ability.extra.…

normal crest
#

not necessarily, most people do config = {extra = {flag = false }}

#

I hate typing code in phone

zealous glen
#

which when using the constructor SMODS.Joker

#

is done by assigning config = { extra = {…}}

drowsy acorn
#

i see

pure salmon
#

YES I FINALLY DID SOMETHING FIRST TRY

#

straight up patching it

normal quest
#

Reposting: anyone familiar with immolate.dll? I'd like to edit the brainstorm mod to find instant chicot instead of instant perkeo, but looks like the latest version of the brainstorm mod that does this just passes some args into Immolate.dll and idk how exactly all that works and what I would have to change to make it look for chicot instead

somber osprey
#

Hey guys, how’s it going? I just need some help creating a Joker mod.

#

Can someone help me?

drowsy acorn
#

ok so i now have config = {extra = {triggered = false}}, how can i interact with this

north lodge
snow vale
#

how can i make so a consumeable isnt destructed after being used?

glass crown
#

how would one go about changing the colors of the main menu background swirl?

snow vale
#

i wanna store a joker on it to then whenever you sell it it respawns

wind steppe
wind steppe
snow vale
snow vale
#

i mean

wind steppe
#

with no creation animation it might work

snow vale
#

so uh

#

how to do that

sonic cedar
#

or i could just figure out why it triggers the gain twice

wind steppe
wind steppe
#

might want to check for negative so it can recreate itself as negative then

zealous glen
#

no need for the parentheses

wind steppe
# snow vale okk

if you can check for negative do this to recreate it as negative: SMODS.create_card({area = G.consumables, skip_materialize = true, key = "c_modprefix_consumablekey", edition = e_negative})

sonic cedar
drowsy acorn
sonic cedar
zealous glen
glass crown
# zealous glen Trance

i meant moreso in the way that like cryptid does it, where just having the mod causes the background colors to change to the blues n such

normal crest
zealous glen
wintry solar
sonic cedar
#

So 2 will actually go to 20

#

But as it keeps going instead of keeping that 2

drowsy acorn
# normal crest card.ability.extra.triggered

crashed D:
joker code for reference:

    key = 'calculator',
    loc_txt = {
        name = 'Calculator',
        text = {
            "Reduces required score by score of first hand of round"
        },
    },

    config = {extra = {triggered = false}},
    rarity = 2,
    atlas = 'CosmicTomfoolery',
    pos = {x=3,y=0},
    blueprint_compat = true,

    loc_vars = function(self, info_queue, card)
        return {
            vars = {}
        }
    end,

    calculate = function (self, card, context)
        if G.GAME.current_round.hands_played == 1 and G.STATES.SELECTING_HAND and context.hand_drawn and not card.ability.extra.triggered then --currently bugged to trigger whenever you discard after the first hand played
             G.GAME.blind.chips = G.GAME.blind.chips - G.GAME.chips
             G.GAME.blind.chip_text = number_format(G.GAME.blind.chips)
             return {
                message = {'Calculated!'},
             }
        end
    end
}````
wintry solar
#

what's your code that double gains?

sonic cedar
#

I’ll ss

somber osprey
#

I'm trying to make a Joker mod. I know the basics, but the rest wasn't working, so I deleted the code and now I want to start over.

normal crest
wintry solar
#

oh it's this thing

#

you don't need that weird decimal check btw

sonic cedar
drowsy acorn
wintry solar
#

that's probably what's screwing up your numbers

sonic cedar
#

thats a different thing

normal crest
drowsy acorn
#

that fixed that

wintry solar
#

yeah, the double gain must be from where you're calling the context

drowsy acorn
#

ok so now i just need to set triggered to true afterwards and then when the blind is defeated it gets set to false?

sonic cedar
wintry solar
#

yeah

sonic cedar
#

i seee,,

wind steppe
drowsy acorn
#

basically, but there's jokers that care about the round score so it sort of synergizes with those

wind steppe
#

oh thats cool

drowsy acorn
#

or i guess as it stands right now antisynergy since most of them want you to go under some percentage of blind requirement

#

also it does make it easier to hit stuff like mr bones

#

(i think)

wind steppe
#

it should

drowsy acorn
#

also its very satisfying seeing the blind requirement go down

#

makes me feel powerful drspec2Lethimcook

wind steppe
#

if you score naneinf what happens to the blind score

drowsy acorn
#

good question

#

oh i think the game would crash right

#

cuz youre doing arithmetic with a nil

wind steppe
#

it can handle naneinf score and nan blind score

#

its floating point i think itd just make the score naneinf

#

which might make the blind impossible now that i think about it

drowsy acorn
#

lol

normal crest
#

it'd just be -infinity

#

i think

wind steppe
#

how would i make this only trigger once at the end of the round no matter how many towers you have? (assuming you have at least 2)

    calc_dollar_bonus = function(self, card)
        local towers = SMODS.find_card("j_para_tower", false)
        if #towers >= 2 then -- I need to check if this is the first tower (or last, it just needs to only trigger once)
            return card.ability.extra.money
        else
            return nil
        end
    end
normal crest
#

as in, it only gives the bonus money one time?

normal crest
#

you'd have to put a flag on your card to mark when it has triggered

#

and then give money only if it hasn't

wind steppe
#

flags dont save across jokers i think?

normal crest
#

you put it in the config of the joker

wind steppe
#

no like i would have two separate jokers

#

that are duplicates

normal crest
#

and you get 1 dollar for each tower in your inventory

#

at the end of round

wind steppe
#

hold on

normal crest
#

holding on

wind steppe
#

what i mean is:

  • you have some amount of towers
  • you earn $20 if you have at least two towers and it doesn't stack
  • otherwise you get nothing
normal crest
#

I'd still go the flag route, just that you'd have to check that if any other tower has the flag then don't give money

drowsy acorn
#

i tried just calling end_round() but that was a whole buggy mess lmao

normal crest
# wind steppe how would i do that?

based on your current code, you'd only give the money if after looping through towers none of them have tower.ability.extra.triggered as true, and right before returning you set card.ability.extra.triggered = true is what I was thinking of

#

and then probably in context.starting_shop set the triggered flag to false

#

Tbh I'd do this with a lovely patch cus it's much more elegant

#

but I know you're not too familiar with them

floral spindle
#

how do I write something that applies an edition to a random joker you own

red flower
#

have you heard of wheel of fortune

floral spindle
#

ok

#

but like

#

how do I use that to write what I want my joker to do

red flower
floral spindle
#

oh

#

thank

sleek cliff
wintry swallow
#

is there any way to have my joker cost money but always sell for 0$?

wind steppe
wintry swallow
wind steppe
wintry swallow
red flower
#

context.buying_self exists now iirc

#

also add_to_deck would be better probably but i would still cause problems when set_cost is called on it

#

i feel like there should be a better way to dynamically change the sell cost of a card without changing the cost with extra_value or anything like that but idk what it should be

sturdy compass
#

Anyone have any ideas as to how I would apply shaders to a standalone sprite object? I would like to make this Maximus logo bounce like The Soul does

sonic cedar
#

so apparently the double trigger of my mult gain is because of how i'm calling my calculate context? is there something i should look out for to see if i need to remedy it?

sonic cedar
sturdy compass
#

Nah this is a tiny bit more advanced

#

I am getting closer tho

sonic cedar
wind steppe
sonic cedar
#

when a probability succesfully triggers (i have to do this manually)

sonic cedar
sturdy compass
sonic cedar
#

60 fps,,,

wind steppe
#

idk

sonic cedar
#

why would context.repetition even get called 😭

wind steppe
sonic cedar
#

hope it works then

sonic cedar
#

the FIRST instance the xmult triggers, there's no double trigger
A -> B

#

but the SECOND time and onward?
B -> C -> D

#

so there's something about triggering the mult gain a second time that's causing it to register it as two triggers?

wind steppe
#

use print ig?

#

find out if the double trigger happens the first time and something prevents the mult gain from happening

sonic cedar
#

right
how would i set that up?

wind steppe
#

you have debugplus right?

sonic cedar
#

yup

wind steppe
#

whenever context.chudhit is true run print("triggered") and triggered should appear in the console when your joker triggers

glass crown
#

how would you go about checking the enhancement of a card thats been played? for more context, im trying to make a joker that makes bonus and mult cards retrigger

sonic cedar
red flower
glass crown
#

gotcha, thank you

wind steppe
#

and ideally you'd put it right before the mult gain

sonic cedar
#

is it just print

#

k

spice wadi
# sonic cedar when a probability succesfully triggers (i have to do this manually)

i just wanna say rq that a solution ive used is hooking the pseudorandom function
because from inside the hook you can pull the G.GAME.probabilities.normal and the odds and calculate there if it will succeed and call the context
basically all chance abilities use the same variables (apart from lucky cards)
its worked for me so far

floral spindle
#

why isn't this applying negative to anything noedition = SMODS.Edition:get_edition_cards(G.jokers, true) eligible = pseudorandom_element(noedition, pseudoseed("Bordbcv")) eligible:set_edition(negative, true)

sonic cedar
wind steppe
sonic cedar
#

yeah

wind steppe
#

this is even more confusing

spice wadi
sonic cedar
wind steppe
#

but it triggers twice later as well?

sonic cedar
#

no no i just messed up earlier

wind steppe
#

oh

sonic cedar
#

it always triggered twice i forgot i still had the failsafe on

#

(the sqrt 10)

spice wadi
sonic cedar
#

gulp

#

better than nothing

spice wadi
#
local _pseudorandom = pseudorandom

function pseudorandom(seed)
    local result = _pseudorandom(seed)

    local odds = nil
    local extra_odds = nil
    local self_ref = nil

    for i = 1, 10 do
        local name, value = debug.getlocal(2, i)
        if name == "self" then
            self_ref = value
            break
        end
    end

    if self_ref and self_ref.ability and self_ref.ability.extra then
        local success = pcall(function()
            extra_odds = self_ref.ability.extra.odds
        end)
        if not success then
            local success = pcall(function ()
                extra_odds = self_ref.ability.extra.odds_1
            end)
        end
        if not success then
            local success = pcall(function ()
                extra_odds = self_ref.ability.extra
            end)
        end

        odds = G.GAME.probabilities.normal / extra_odds
        if result >= odds then
            print("Ability failed for seed:", seed, "result:", result, "threshold:", odds)
            SMODS.calculate_context{probability_failed = true}
        end
    end

    return result
end```
#

the odds_1 is cos thats what i used for the second lucky card ability in my patch for it

#

the pcall thing is to prevent crashes

#

debug.getlocal pulls the locals of the function calling it

glass crown
#
    key = 'trees_that_move',
    blueprint_compat = true,
    loc_txt = {
        name = 'Trees That Move',
        text = {
            "Retrigger each played",
            "{C:attention}Bonus Card{} or",
            "{C:attention}Mult Card{}"
        }
    },
    config = {extra = { repetitions = 1 } },
    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.repetitions } }
    end,
    rarity = 1,
    atlas = 'votdjokers',
    pos = {x = 7, y = 1},
    cost = 4,
    calculate = function(self, card, context)
        if context.repetition and context.cardarea == G.play and SMODS.has_enhancement(card, "m_bonus") then
            return {
                repetitions = card.ability.extra.repetitions
            }
        end
    end
}```
can someone point to why this joker's function isnt working? i havent implemented the mult retriggering yet but focus on the `calculate = function` section
wind steppe
red flower
glass crown
#

ahh icic

wind steppe
red flower
#

yes

glass crown
glass crown
#

,,, i somehow managed to forget to add context. 🤦‍♀️ im so great at this

wind steppe
#

is there a way to allow a joker to spawn duplicates of itself in the shop without showman? (only itself not other jokers)

tall jewel
floral spindle
#

how do I make a joker card not select itself when choosing a random joker

wild escarp
#

How could I make this change for each run? Trying to start with one random card for a challenge deck.

local SMODS_calculate_context_ref = SMODS.calculate_context
function SMODS.calculate_context(context, return_table)
    split_suit = pseudorandom_element({"S", "H", "C", "D"}, pseudoseed("split"))

    local _rank = math.random(2, 14)
    if _rank < 10 then
        split_rank = _rank
    elseif _rank == 10 then
        split_rank = 'T'
    elseif _rank == 11 then
        split_rank = 'J'
    elseif _rank == 12 then
        split_rank = 'Q'
    elseif _rank == 13 then
        split_rank = 'K'
    elseif _rank == 14 then
        split_rank = 'A'
    end
    return SMODS_calculate_context_ref(context, return_table)
end
floral spindle
#

how do I synchronize applying an edition and a text popping up

sleek cliff
#

I somewhat know what im doing, but beyond this I don't understand how to hook what Somethingcom said

#

maybe I want a card instead of keys

daring fern
sleek cliff
#

ah

daring fern
sleek cliff
#

no, not sold

daring fern
#

I meant something like this: ```lua
local remove_ref = Card.remove
function Card:remove()
if self.added_to_deck and self.ability.set == 'Joker' and not G.CONTROLLER.locks.selling_card then
if G.GAME then
G.GAME.destroyed_jokers = G.GAME.destroyed_jokers or {}
table.insert(G.GAME.destroyed_jokers, {key = self.config.center.key, ability = self.ability}
end
end
return remove_ref(self)
end

daring fern
# sleek cliff

This does not go in loc_vars also it is case sensitive.

hybrid shadow
#

if i wanted to check for a specific rank in the played hand during context.joker_main i'd have to run a loop to check through the played hand, right? if so, what's the right code to use inside the loop?

wooden nexus
#

Ignore that everything is a heart for the new suit and all that

#

I'm actually trying to REMOVE the 2-Ace from this suit

sleek cliff
daring fern
sleek cliff
normal crest
#

show more of your code

#

not the errors vscode gives you

sleek cliff
normal crest
#

Yeah no, this goes outside of the SMODS.Joker use

#

So put it before SMODS.Joker is even used or after you close the } corresponding to it

#

Also you accidentally removed the C from Card.remove in the declaration of remove_ref

sleek cliff
#

like this?

daring fern
sleek cliff
daring fern
sleek cliff
#

what should I do for the joker then?

daring fern
exotic imp
#

I want to start getting into modding balatro, would someone be able to point me to a video to get the basics of where to start please

wooden nexus
exotic imp
#

making

wooden nexus
#

There's no videos really

#

that i know of

sleek cliff
#

there is one

vale glen
#

Also read the lsp_def folder in Steamodded once you've downloaded it, it helps lots with function definitions

willow plinth
#

@manic rune made it but i can't find it :(

willow plinth
#

but yeah i'd also recommend reading too, this way you can reference stuff from the wiki

daring fern
wild escarp
daring fern
sleek cliff
#

what should I set it to then, set?

daring fern
sleek cliff
#

I doubt this is correct but:

daring fern
# sleek cliff I doubt this is correct but:

You are correct about it being incorrect, it would be something like: ```lua
local random_joker = pseudorandom_element(G.GAME.destroyed_jokers, pseudoseed("seed"))
SMODS.add_card({key = random_joker.key})

north lodge
#

What can I use to determine if I am in a run or not? I have parts I need to not run if I'm not in a game.

north lodge
#

In the collection would be fine, mostly just caring if a run is actively ongoing

red flower
#

to do list uses card.area and card.area.config.type == 'title'

normal crest
#

that will tell you if you're in a run

#

might be G.STATE tho

#

not stage

#

I can't remember

red flower
#

state changes all the time so probably not that

normal crest
#

true

#

it's G.STAGE

north lodge
#

Thanks

sleek cliff
daring fern
# sleek cliff bup

You would also probably put the card in a variable and add: ```lua
for k, v in pairs(random_joker.ability) do
card.ability[k] = v
end

#

Also you would need to remove it from the table.

daring fern
vale glen
sleek cliff
#

it is now

daring fern
sleek cliff
daring fern
# sleek cliff

You need to do local card = SMODS.add_card({key = random_joker.key})

sleek cliff
#

as a new line or updated line?

daring fern
sleek cliff
#

oki

wooden nexus
#

Question: If i have a custom rank, how do i disable it from changing suits?

normal crest
sleek cliff
wooden nexus
normal crest
daring fern
sleek cliff
daring fern
#

Would it be possible to check from context.post_trigger if it has triggered on a specfic scored card?

viral ember
#

How would I set a card's suit?

sleek cliff
sturdy compass
#

Also nice name Le

viral ember
#

lol

#

I could say the same to you

#

(I'm new to modding) what do you mean by suit key?

#

how would I set it to heart for example

normal crest
#

SMODS.change_base(card, 'Hearts')

viral ember
#

I see

#

thank you so much <3

#

I forgot to return

normal crest
#

that code will change your joker's suit to hearts

#

which doesn't make much sense

#

SMODS.change_base(context.other_card, 'Hearts')

sturdy compass
#

Does anybody happen to know how to make a Sprite object clickable?

sleek cliff
hasty mist
#

is there a way to modify another joker's loc_vars without using the absolute mess that is cryptid's misprintize function

normal crest
#

you can take ownership of a joker and modify the loc_vars function as you need

sturdy compass
#

I'm assuming she means on the fly

hasty mist
#

yeah

daring fern
hasty mist
#

im talking about value manip

#

how oil lamp works

viral ember
#

I must be doing something wrong lol

normal crest
#

that's not actually modifying the loc_vars of a joker afaik

#

just modifying its ability values

hasty mist
#

that's what i mean lol

#

im trying to see how misprintize does it but i cant make anything of it

#

its completely over my head

normal crest
#

I assume they just recursively loop through card.ability and find numeric values to modify

hasty mist
#

im trying to simplify it to make a easier and more flexible value manipulation function (that actually works with operators other than multiplication)

viral ember
normal crest
daring fern
viral ember
#

gimme a sec

normal crest
daring fern
normal crest
#

Oh I meant card.ability.extra (if it's a table)

#

Not the entire ability, my bad

daring fern
willow plinth
#

heyo modding dev chat

currently debugging the showdown mod, yada yada yada it has a mechanic that, if i understand the code correctly, should update the sprite of the vanilla Joker joker to a random position on the showdown_joker_variants atlas every time G.GAME.showdown_JVA updates

i changed the code quite a bit, especially reduced the update interval so i can debug better, but don't understand why it's still seemingly only updating the sprite pos once, and then just stays at that pos for ever

first image is the current code, second image is the atlas in question

for some reason it just gets stuck on the green variant (x=1,y=0), even though the log below print("SETTING SPRITE POS") shows a different pos every time

hasty mist
normal crest
#

I can see how it'd get complicated

hasty mist
#

and also the calculate functions tend to look really messy and complex (oil lamp for example) is there a reason you shouldnt be able to just target a i + 1 and return a value?

#

but then again i dont know much

tawdry shale
#

that would be greatly appreciated, i put the stuff above in my main.lua and got this error so far

hasty mist
#

but this really seems like it should be way easier

normal crest
willow plinth
normal crest
# viral ember

i see you're not using SMODS.Joker anywhere here, you must be doing something weird with it later on

viral ember
normal crest
#

you must be using a really old mod as a base to make your own

viral ember
#

oh?

hasty mist
#

is it not

viral ember
#

if there's a newer template do let me know 🙏

raven jewel
#

does anyone know how to change textures on mac?

normal crest
hasty mist
#

cryptid does something similar

normal crest
#

yes that's fine by itself, but look at the 2nd screenshot they sent

#

and no, that's not localization only

hasty mist
#

ah

#

i see

normal crest
vale glen
#

Vanilla Remade can be a good reference too, but that's for later

umbral zodiac
#

is there a way to make your mod intentionally fail to load
my mod requires a consumable stacking mod but works with either incantation or overflow so id like it to fail if either aren't installed, but afaik you cant have either/or for mod dependancies

sturdy compass
#

You can specify dependencies in your mod's metadata.json

#

For example

normal crest
#

it's there in the wiki

umbral zodiac
#

does that work with setting a dependancy that is "either x mod OR y mod, but both arent required" or

#

ok thank you

normal crest
#

blah blah

vale glen
daring fern
sturdy compass
#

Something I do wish we had tho were non-required mod recommendations

daring fern
vale glen
#

Could make a pop-up on mod load that checks for the recommended mods

sturdy compass
#

This is something some Beat Saber maps do and I think it'd be great here too

vale glen
#

Or something in the tabs for the mod

wild escarp
sleek cliff
daring fern
tall jewel
sleek cliff
sturdy compass
vale glen
sturdy compass
#

I don't know because it's just a sprite 😭

vale glen
#

Hrm

#

Wonder if that's why Axy's text nodes aren't responding either

sturdy compass
#

hrrrrmm

vale glen
#

Dumb idea would be to make a button with the Sprite texture

keen totem
#

Coarse Joker

  • Gains +3 Mult at the end of the round IF your Pixel Art Smoothing is Off
vale glen
#

Since we know that accepts clicks and hovers

keen totem
#

can you even get the games settings?

sturdy compass
#

You definitely can

vale glen
#

But better idea would be understanding why clicks and things don't work with sprites or other objects

viral ember
#

it doesn't seem to do anything tho

daring fern
viral ember
#

i-

#

that's my bad

#

this sets all cards in hand to hearts lmao

#

good to know it kinda works tho

daring fern
viral ember
#

I see

#

Ok it works but there's no animation

daring fern
viral ember
#

how do I get the animation lol

daring fern
vale glen
#

Or juice up

#

Or both, or neither

viral ember
#

flip

#

was trying to remember what base game did