#💻・modding-dev

1 messages · Page 506 of 1

formal parrot
#

Garb has something like this where he changes the title screen

lament agate
#

@maiden phoenix does your mod have sleeve?

lament agate
runic jay
#

Or did I misunderstand what you meant?

lament agate
#

and you have to define the atlas after that

#

there's the res

#

dont forget 2x and 1x

lament agate
gray void
#

The upgrade's better

runic jay
lament agate
#

i forgot the essential

lament agate
#
    prefix_config = { key = false }
}:register()
#

make sure you set your mod's priority otherwise it'll clash with other mods that modifies main menu logo

lament agate
vestal magnet
#

how do i make a joker not show up in booster packs

red flower
lament agate
#

buf

red flower
#

buf

slim ferry
#

buf?

red flower
#

buf as in buffoon

ancient mango
#

in smods how do i create my own parts for pokerhands like that i can put in the evaluate?

red flower
ancient mango
#

ik i just dont understand how to define the part and how it works cause it doesnt explain it

red flower
# ancient mango ik i just dont understand how to define the part and how it works cause it doesn...

here's an example from my mod
it works the exact same as a pokerhand but you can reference it in other hands

https://github.com/nh6574/JoyousSpring/blob/fe288a6d23745e1c1726d6efd7d4e1a66277f9d4/src/others/PokerHands.lua#L376

GitHub

Yu-Gi-Oh! Mod for Balatro. Contribute to nh6574/JoyousSpring development by creating an account on GitHub.

ancient mango
#

i still dont understand

red flower
#

Well you will need to be more clear as to what you don't understand

ancient mango
#

i want to make a part which is like flush with 4 finger but as a part so that i can use it for a poker hand later

#

but i dont understand the structure and the way to define the part and the part where the cards are

red flower
#

Do you know how to do that without pokerhand parts?

#

As in just in SMODS.PokerHand?

ancient mango
#

no

red flower
#

Then you need to start from there haha

ancient mango
#

but i dont understand what that means

red flower
#

It's a function that returns the list of hands that make your poker hand

ancient mango
#

ok like is there an example

red flower
#

this is the flush function in vanilla

frosty rampart
#

you have to define the function for that specific poker hand. it gets parts (a table of all the poker hand parts contained in the played hand) and hand (a table containing all the played cards) as arguments, you have to check the hand for whatever criteria you want, and then return a table of all the cards that should score

#

defining a poker hand part doesn't get the parts as an argument, just the hand

ancient mango
#

but like i dont understand lua i just want the basic things needed to make the part work and a basic thing of like what it does and i can do the rest

frosty rampart
#

you kind of need to understand lua to mod the lua game

ancient mango
#

like i understand lua but not if i just get given lua code

#

and nothing else

red flower
#

Sadly, for poker hands you need to have some basic lua understanding nailed down

#

It's not that hard, it's just checking cards in a loop and adding them to a table but if you don't understand that there's not much we can do to help other than write the code for you

#

If you have any questions about the specific parts you don't understand we can help you out with that

ancient mango
#

ok what do i check for for a flush

red flower
#

that there are X cards of the same suit

ancient mango
#

and how do i do that

#

i count them and check the number?

red flower
#

the way this does it is it goes through every suit and counts if the cards have it and adds them to a table

red flower
#

if the number is higher than the number you want you return the table with the cards

#

(btw you can literally just copy that code and hardcode four fingers to 4 if thats all you want)

ancient mango
#

oh

lament agate
#

is it possible to add extra messages in 1 joker

red flower
#
return {
  message = "message 1",
  extra = { message = "message 2" } 
}
placid star
#

is there a function that triggers after all objects are loaded into the game? for reference i want to check if a joker is from my mod and has the default Joker atlas, if it does i want to change its sprite_pos

placid star
red flower
ancient mango
#

what does #hand mean

red flower
#

length of the hand table

#

also please use the version of get_flush in the lovely/dump

ancient mango
#

oh

#

where is the lovely/dump

red flower
#

in your mods folder

next timber
#

can someone just like. give me a brief explanation of luajit2 because im a little confused on if its meant to speed things up or help with metatable comparison or what, it seems like complicated stuff, cause the thread seems to be saying it helps with speed but when i bring up metatable comparisons i seem to get pointed to luajit2

red flower
#

I don't know much about it but it's luajit with some things backported from newer lua versions like being able to change the metatable stuff for comparisons

next timber
#

i see

ancient mango
#

what is SMODS.four_fingers() and SMODS.Suit.obj_buffer

red flower
#

SMODS.four_fingers() is a function that checks if you have four fingers and returns the length of the straight/flush (it's there for other mods to hook)

SMODS.Suit.obj_buffer has a list of all the suits

foggy ginkgo
#

It's talisman issue ik but idk what to fix it by

red flower
#

I think it's an issue on talisman's side

#

it has some problems with bignum returns

foggy ginkgo
#

Yeah when I turned it off it works

foggy ginkgo
#

Idk what to put

red flower
ancient mango
#

yea but where in smods

red flower
#

smods/src/utils

sonic cedar
#

good morning modding dev

faint yacht
red flower
#

hii

sonic cedar
#

hiiii

#

oh right modding

foggy ginkgo
faint yacht
#

to_big(G.GAME.chips) - to_big(G.GAME.blind.chips)?

sonic cedar
#

Is there a way to check if a Joker has a certain function in its definition? for example, add_to_deck

red flower
sonic cedar
#

holy peak

modern kindle
#

Good schmorning chat

red flower
#

hiiii

sonic cedar
#

hiiii dilly

modern kindle
#

Hello hello

faint yacht
red flower
#

to_number will probably work but break with high numbers

foggy ginkgo
#

Aye it works

#

Didn't know there was a difference between to_big and to_number

faint yacht
#

¯_(ツ)_/¯

red flower
faint yacht
#

to_number actually gives you a number.

sonic cedar
#

why not just... add a to_big check...am i missing something (example image)

foggy ginkgo
#

Makes sense

ancient mango
#

wtf does four_fingers and 1 or 0 mean

red flower
#

well, it's a comparison that talisman hasnt patched yet

sonic cedar
#

ohhh okay carry on

red flower
modern kindle
#

Im dreading attempting fridge work today
God punishes me for being free

ancient mango
#

so if its a number then its 1 otherwise is 0

red flower
ancient mango
#

like ik logic gates and boolean algebra i was just wondering why

sonic cedar
red flower
#

the link i sent explains how it works in lua

faint yacht
ancient mango
sonic cedar
faint yacht
# red flower evil lua
SRB2's implementation of Lua is based on a modification of Lua 5.1 called BLUA (which stands for "bastardized Lua"...
red flower
modern kindle
ancient mango
#

bru wtf

#

replace all is stupid

modern kindle
#

Hmm
What do you guys think 4 equals

sonic cedar
red flower
modern kindle
#

I will add you to my mod

red flower
#

yay

sonic cedar
#

win

modern kindle
#

Nobody likes those

red flower
#

im nobody

modern kindle
#

Will you go see a cyclops

sonic cedar
#

so something like this?

faint yacht
red flower
sonic cedar
#

peak

sonic cedar
#

ok if i did this right i might have just made cross ijiraq functionality

modern kindle
#

I will disable it

sonic cedar
modern kindle
#

Fix my fridge rn

sonic cedar
#

well for starters is it running

modern kindle
#

No it fell

sonic cedar
#

then you bett- oh

modern kindle
#

knotty orchid
#
    
set_blind = function(self)
        local count = 0
        for _, hand in ipairs(G.GAME.hands) do
            if hand.played and hand.played > 0 then
                count = count + 1
            end
        end

        if count > self.config.extra.max_hand_types then
            G.GAME.round_resets.discards = G.GAME.round_resets.discards - 1
            ease_discard(-1)
        end
    end```
Any reason this doesn't work? I want to give -1 discards if number of hand types played > config
red flower
#

that looks fine to me

#

did you try adding some prints to see if it counts fine

knotty orchid
#

Yep, i can't understand why it doesn't work

knotty orchid
#

let me try

red flower
lament agate
#

hello devs

knotty orchid
#

my god balatrojoker

worthy stirrup
#

Sorry to bother, i honestly cant remember its been so long, did i set this up right

SMODS.Joker{
    key = "twitch_viewers",
    config = {
        extra = {
            avg_viewers = 0
        }
    },
    loc_txt = {
        name = "Twitch Viewers",
        text = {
            "Avg Viewers: {C:attention}#1#{}",
            "{C:inactive}(via TwitchTracker){}"
        }
    },
    pos = {x = 0, y = 0},
    rarity = 2,
    cost = 4,
    atlas = 'CustomJokers',
    blueprint_compat = true,
    eternal_compat = true,
    loc_vars = function(self, info_queue, card)
        return {vars = {card.config.extra.avg_viewers}}
    end,
}
slim ferry
#

it looks correct

red flower
#

card.ability.extra.avg_viewers in loc_vars

worthy stirrup
#

did i switch the two by accident

slim ferry
#

but also you dont need eternal_compat = true because thats already the default

worthy stirrup
#

oh right, oops lol

worthy stirrup
red flower
worthy stirrup
#

OH

#

why the hell did i put config lmao

#

no wonder it wasnt working

#

thank you so much

sonic cedar
#

are my comments understandable /genq i want to make sure this isnt hard for people

red flower
#

I would recommend adding the comments like this so they get autocomplete

sonic cedar
#

you can do that??

red flower
#

also your function names are maybe a bit too generic

#

oh or are those inside Hyperglobal

sonic cedar
#

yep!

red flower
#

ah then it's fine

sonic cedar
#

ok im gonna try the comment thing

knotty orchid
#
   config = { extra = { discards = 1, max_hand_types = 6 } },
    loc_vars = function(self)
        return { vars = { self.config.extra.max_hand_types, self.config.extra.discards } }
    end,

}```
any reason this localization does not work for blinds?
red flower
sonic cedar
#

ooo even better

red flower
knotty orchid
#

it just shows nil

#
   bl_ina_inazuma_town = {
                name = "Ciudad Inazuma",
                text = { "Si has jugado más",
                    "de #1# tipos de mano",
                    "-#2# descarte" }
            },```
red flower
#

i think blinds need a collection_loc_vars

knotty orchid
#

That was the problem

#

thanks

sonic cedar
worthy stirrup
#

okay, so im making an api call, would i be printing data.body, because of right now its only returning the number 200 when it should return "{"avg_viewers":714,"avg_channels":43,"rank":230,"hours_watched":120232}"

    calculate = function(self, card, context)
        if context.joker_main then
-- Make the call to the fuckin website
            data = https.request("https://twitchtracker.com/api/games/summary/balatro", "GET")
            print(data)
        end
    end,
sonic cedar
#

but this is useful too

sonic cedar
red flower
worthy stirrup
#

ima keep it a buck 50, i got no idea how to deal with 3 returns

sonic cedar
#

ok got it

languid canopy
#

where am i supposed to find the code im looking for ?

red flower
worthy stirrup
#

oh, its that simple?

#

oh.

ocean sinew
#

local code,body,headers=http.request(url, {method="GET"})

worthy stirrup
#

it works fine without it so

ocean sinew
#

oh then you don't need to do that

modern kindle
#

alright so now that im back to the drawing board, you guys have any idea how to make seals work on jokers within a specific card area without patching that cardarea into joker eval?
i have seals working on jokers themselves, so i tried then integrating a cardarea check into my hook but that showed no results

modern kindle
#

i have a joker which stores other jokers, currently i have seals working on jokers
they do not work if stored within the joker

#

wait i mightve just done it

runic jay
lament agate
#

credits to @maiden phoenix

# Sprite in description
[[patches]]
[patches.pattern]
target = "functions/misc_functions.lua"
pattern = "elseif part.control.E then"
position = "before"
payload = '''
elseif part.control.tngt_S then
        final_line[#final_line + 1] = {
            n = G.UIT.O,
            config = {
                object = Sprite(0, 0, 7, 3, G.ASSET_ATLAS["tngt_goddamnit"], {x = 0, y = 0}), align = "cm"
            }
        }
'''
match_indent = true

# Sprite(px, py, width, height)
#

@worthy stirrup

red flower
worthy stirrup
#

Thank you

lament agate
#

goodluck

worthy stirrup
#

ill try

runic jay
red flower
#

P_SEALS

stark rune
#

I am making a custom consumable type, I have the name right and stuff, but all the cards have an 'error' type?

red flower
#

do you have a loc_txt or localization file? can i see it

stark rune
red flower
#

it should be en-us

stark rune
#

i just copied the text and put it in a file in discord

#

just typed it wrong

#

ig

red flower
#

in the dictionary it should have k_sanguine as well

stark rune
#

ah, thanks

runic jay
red flower
#

please post the code as well

sonic cedar
runic jay
red flower
sonic cedar
#

oh ok

#

OH WAIT uh

#

what's it called

#

tostring()

#

right

red flower
#

yes

lament agate
#

thanks btw @manic rune

manic rune
#

no clue what i did but sure

lament agate
manic rune
#

:3

#

np

lament agate
#

i hate you for it but thank you

red flower
lament agate
#

crad shuffler

runic jay
red flower
#

the function definition

#

also just ctrl+f lol

runic jay
#

oh god damn it...

#

I have sure I didn't miss any

#

guess one slipped through the cracks...

languid canopy
#

hello, what's the atlas for planet cards ?

red flower
#

the default one?

#

'Tarot'

languid canopy
#

oh okay thanks

#

oh come on

#

is it bc i didn't put any img for them

slim ferry
#

its because the atlas youre referencing doesnt exist

#

or the atlas cant be generating because you reference a file that doesnt exist

#

or something

ancient mango
#

i dont know how to syntax help SMODS.PokerHandPart { key = "flush4", func = function(hand) local ret = {} local suits = SMODS.Suit.obj_buffer if #hand > 4 then return ret else for j = 1, #suits do local t = {} local suit = suits[j] local flush_count = 0 for i=1, #hand do if hand[i]:is_suit(suit, nil, true) then flush_count = flush_count + 1; t[#t+1] = hand[i] end end if flush_count == 4 then table.insert(ret, t) return ret end end return {} end end }

languid canopy
slim ferry
#

can you show

#

the code

red flower
#

smods will append your prefix to the atlas

slim ferry
#

does it?

red flower
#

so if you want the default you need to remove that line

ancient mango
#

can someone help me

#

please

slim ferry
#

oh like that nv

red flower
ancient mango
#

hello?

runic jay
red flower
red flower
slim ferry
ancient mango
#

and im tired

red flower
#

i would recommend taking a break then or doing something simpler for today

runic jay
#

Yeah, well I got the same error again after I put it in the correct folder

ancient mango
#

i can do it also i dont have anything else to do

slim ferry
runic jay
runic jay
red flower
#

the sound definition and when you play the sound

slim ferry
#

oh dont you need to define it with SMODS.Sound

#

unless that what youre trying to do

runic jay
#

huh... where would one put SMODS.Sound?

slim ferry
#

anywhere

#

in any file that loads before the sound is used

#

just like SMODS.Atlas or anything else like that

modern kindle
#

i seem to have blue seal working, just red and gold not now

languid canopy
runic jay
slim ferry
#

define the SMODS.Sound just like you would anything else

#

like a joker or smth

slim ferry
red flower
#

if you dont want the default then make an SMODS.Atlas

sonic cedar
languid canopy
red flower
#

the atlas is just for the sprite

languid canopy
#

oh yeah so i need to put a png file for the atlas to work

red flower
red flower
sturdy compass
#

mfw I just fixed bugs while watching a class lecture danceman

slim ferry
languid canopy
red flower
red flower
slim ferry
languid canopy
#

(im sorry if my questions are bothering stupid to you, im new at lua

slim ferry
#

atlas defines the file path and key for the atlas, with which you can refer to it later

sturdy compass
slim ferry
#

and some other stuff

sturdy compass
languid canopy
#

oh in the main then

#

ok i see

slim ferry
#

you can put it in any file as long as it gets loaded properly

languid canopy
#

yeah makes sence

slim ferry
#

but most people do it in main

sonic cedar
#

i need to update my wiki but i cant cause the stuff isnt fully implemented 😭

red flower
runic jay
slim ferry
#

you have to put quotes around the key

red flower
#

pls post code

modern kindle
slim ferry
#

"ButterDog" instead of ButterDog

#

assuming you did the SMODS.Sound stuff

red flower
#

with deck view

slim ferry
#

oh uhhhhhh

slim ferry
red flower
#

youre missing the quotes

slim ferry
#

oh right

#

file path needs quotes

runic jay
#

ain't no way I forgot that😭

ancient mango
# red flower i dont see an error here

oh wait here is the right code:

    key = "straight4"
    func = function(hand)
        local ret = {}
        if #hand < 4 then return ret else
            local t = {}
            local IDS = {}
            for i=1, #hand do
                local id = hand[i]:get_id()
                if id > 1 and id < 15 then
                    if IDS[id] then
                        IDS[id][#IDS[id]+1] = hand[i]
                    else
                        IDS[id] = {hand[i]}
                    end
                end
            end

            local straight_length = 0
            local straight = false
            local can_skip = next(find_joker('Shortcut')) 
            local skipped_rank = false
            for j = 1, 14 do
                if IDS[j == 1 and 14 or j] then
                    straight_length = straight_length + 1
                    skipped_rank = false
                    for k, v in ipairs(IDS[j == 1 and 14 or j]) do
                        t[#t+1] = v
                    end
                elseif can_skip and not skipped_rank and j ~= 14 then
                        skipped_rank = true
                else
                    straight_length = 0
                    skipped_rank = false
                    if not straight then t = {} end
                    if straight then break end
                end
                if straight_length == 4 then straight = true end 
            end
            if not straight then return ret end
            table.insert(ret, t)
            return ret
        end
    end
}```
runic jay
ancient mango
#

oh it was a comma

sturdy compass
ancient mango
#

oh wait new error

#

oh nvm thats something else

languid canopy
#

oh come on now

#

what is going on

red flower
# runic jay

are you sure it's not called something like butterDog.ogg.ogg

red flower
languid canopy
red flower
sturdy compass
#

Also I wanna see the play_sound function cuz it could also be a lack of a mod key

runic jay
languid canopy
red flower
languid canopy
#

like this ?

red flower
sturdy compass
#

Yeah your play_sound function does not have the mod key included in the sound key

languid canopy
#

its the same

sturdy compass
#

so in your case it needs to be play_sound('modkey_ButterDog')

red flower
# languid canopy

it's weird that you can see the extension for it but not the jokers file

sturdy compass
#

Also you do not need to initialize the sound with the modkey, SMODS does that automatically

languid canopy
#

uhh wait a sec

#

windows being stupid ?

red flower
#

i think it has a double extension

languid canopy
sturdy compass
#

That is not what I meant

languid canopy
sturdy compass
#

replace modkey with YOUR mod's key

languid canopy
#

booty crumbs windows

runic jay
#

oh...

#

I am the big dumb it appears

red flower
#

i need to finish the wiki soon to i can just link this stuff to people

modern kindle
#

i would eat your wiki

red flower
#

u would gain all the forbidden knowledge

modern kindle
#

maybe itd let me cinrge ah ah shit work

ancient mango
#
    key = "Gay Flush",
    mult = 10,
    chips = 110,
    l_mult = 5,
    l_chips = 45,
    example = {
        { 'S_K', true },
        { 'S_J', true },
        { 'S_T', true },
        { 'S_9', true },
        { 'H_8', true }
    },
    evaluate = function(parts, hand)
        return parts._highest -- Temporary
    end
}```
languid canopy
#

is the thingy for localisation for planets is p or is it smth else (this not working atm)

red flower
#

c_

sonic cedar
#

now we're cooking

ancient mango
modern kindle
#

good news is aside of that message blue may work after all.. but red obviously for some unknown reason doesnt trigger on the fridge either, but idk how to manage that
red and gold themselves dont work inside either

ancient mango
#

oh right

runic jay
sturdy compass
#

What is your mod key that you set in your metedata

#

This value

#

I prolly should've been saying prefix but key is close enough

runic jay
#

I... uh... kind of don't have that?

sturdy compass
#

Are you using headers...

sonic cedar
#

hiii astraaa

ancient mango
sturdy compass
#

hi tomato

modern kindle
#

hi astra

runic jay
sturdy compass
#

hi dilly

sturdy compass
#

please use a metadata file instead

red flower
ancient mango
#

no like in the file but i figured it out what prefix do i need?

runic jay
sturdy compass
#

.json

red flower
quick kraken
#

What/Where is the function that initializes the shop?

sturdy compass
red flower
quick kraken
#

So I can just hook that?

#

dt is the only parameter it wants? (other than self)

red flower
#

you can hook it, the "just" part depends on what you need to do

quick kraken
#

Ok

sonic cedar
#

there has to be an easier way to do this

#

or if there's a harder way, at least let it be an automated one

ancient mango
red flower
red flower
ancient mango
red flower
ancient mango
#

ok well i got it from vremade

red flower
#

youre missing the brackets

sonic cedar
#

thats literally the win i needed

ancient mango
#

i actually like better

graceful oak
#

is there any way to add credits? specifically in the collabs section

#

i dont think ive seen any mod do that so idk if its possiblah

sturdy compass
ocean sinew
graceful oak
#

oh damn thanks

ancient mango
#

i have a pokerhandpart which is four fingered flush but just not needing four fingers and another one thats the same but with straight and i want to make a pokerhand thats both of them but not on the same four like the image but i dont know how to do that

ocean sinew
red flower
#

whats joker

sonic cedar
#

(joker is G.P_CENTERS[v])

runic jay
sonic cedar
#

my internet slowed down so you asked before i could specify

ocean sinew
#

and thats line 11

modern kindle
#

ill share mine

ocean sinew
#

so I would guess the problem is you're calling :register()

vestal magnet
sonic cedar
red flower
# sonic cedar is this right

it's only missing the colon in joker:calc_dollar_bonus(card) then
keep in mind card needs to have all the attributes the modded card needs

red flower
sonic cedar
ocean sinew
#

@red flower do you need to call register for mod icon???

ancient mango
sonic cedar
runic jay
ocean sinew
#

try removing register and see if it works

runic jay
ocean sinew
#

I think it should fix

#

It's saying you're trying to index a nil value at line 11

slim ferry
#

what

ocean sinew
#

before this_atlas:register() put print(this_atlas) to check If It's a valid value

ocean sinew
#

[SMODS TRBMod "TRBMod.lua"]:11: attempt to index a nil value

slim ferry
#

yes but

#

what file

#

line 11 is cool but that doesnt say anything on its own]

ocean sinew
# slim ferry what file

------------MOD CODE -------------------------

local this_atlas = SMODS.Atlas {
key = "balatro",
path = "TRBbalatro.png",
px = 332,
py = 216,
prefix_config = { key = false }
}:register()

slim ferry
#

cool??

#

but

ocean sinew
slim ferry
#

you dont need to do that

#

its just SMODS.Atlas

ocean sinew
#

@runic jay what file

ocean sinew
#

I don't think you need to do it still but not sure

slim ferry
#

i wouldnt try to help if you dont actually know how it works since thats probably only going to cause more confusion

ancient mango
#

why are there these weird thin black lines outlining the color of the cards

slim ferry
#

card shadow i think?

ancient mango
#

nope

#

shadows are off in the image

slim ferry
#

hm

runic jay
ancient mango
#

it was pixel art smoothing

red flower
runic jay
red flower
#

all

#

this works for me without the register part

runic jay
red flower
#

remove the this_atlas:register()

runic jay
red flower
#

ok lets go step by step

#

does it crash if you remove that line?

runic jay
#

no

red flower
#

what happens to the logo? is it the same as normal or does it disappear?

near heart
#

how can i detect when any joker is added similar to how hologram detects when a playing card is added

runic jay
red flower
near heart
#

thanks goat

sonic cedar
worthy stirrup
#

How could I display a card in a description like how the poker hands do

red flower
tepid crow
#

(there's a solution there if you start scrolling around)

sonic cedar
#

that was way too funny

rapid stag
#

quesiton about next(), am i right in thinking that when you just call it with only the table argument, it returns the length? so if you do something like next({ item1, item2 }) it returns 2?

red flower
#

no, it returns the key value pair of the next value

#

so in that case probably 1, item1

rapid stag
#

?
but when i do

local midasMask = SMODS.find_card('j_midas_mask')

print(next(midasMask))

with midas mask in possession, the returned value is 1

red flower
#

yes

rapid stag
#

ah, so it

red flower
#

thats the key of the key value pair

rapid stag
#

so with indexed tables, it will return the index as key

red flower
#

yes

rapid stag
#

i see, thanks

red flower
#

its not guaranteed to start from 1 tho

tepid crow
#

lua is also weird and will sometimes cut off multiple returns

red flower
rapid stag
#

aren't indexed tables always in order, though

hidden sable
red flower
#

no, if you use pairs for example it doesnt guarantee order

#

ipairs specifically checks for 1, 2, 3 etc

sonic cedar
#

sense

hidden sable
#

yimsock!

sonic cedar
#

codesnap extension

hidden sable
#

cool

#

thank you

#

anyways

#

you should post more context

#

to the problem

worthy stirrup
hidden sable
#

fuck

red flower
#

i think aikoshen does

worthy stirrup
#

fair enough, thank you

frosty rampart
#

chat where is a consumable type's primary_colour used pls and thank u

graceful oak
#

ok for some reason i cant seem to make the artist ui show up

#

i might be hella dumb and misinterpreting the code lol

modern kindle
#

hi eremel

graceful oak
#

tried looking at how anothe rmod does it but they do a different way and its a scarier way and its very scary

frosty rampart
jolly shadow
#

how do i have a joker destroy a card in hand whenever a hand is played

wintry solar
#

Hi dilly

frosty rampart
#

secondary question: is there a way to make this text here black? (disregard the missing localization i haven't written it yet) i know i can just add the color to the localization for the name itself, but i dunno about the card counts

ocean sinew
runic jay
#

I just don't understand anymore

red flower
frosty rampart
frosty rampart
jolly shadow
# jolly shadow how do i have a joker destroy a card in hand whenever a hand is played
if context.destroying_card then
            local card_to_destroy = pseudorandom_element(G.hand.cards);

            if context.destroying_card == card_to_destroy then
                local mult_to_add = card_to_destroy:get_chip_bonus();
                local is_face_card = card_to_destroy:is_face();

                if is_face_card then
                    card.ability.extra.Xmult = card.ability.extra.Xmult + 1;
                else
                    card.ability.extra.mult = card.ability.extra.mult + mult_to_add;
                end

                if next(SMODS.find_card("j_eddy_edward")) then
                    local _card = SMODS.add_card { set = "Base", rank = "Ace", area = G.deck };
                    G.GAME.blind:debuff_card(_card);
                    G.deck:sort();

                    SMODS.calculate_context({ playing_card_added = true, cards = { _card } });
                end

                return {
                    message = "X",
                    remove = true,

                    mult = card.ability.extra.mult,
                    Xmult = card.ability.extra.Xmult
                };
            end
        end

why doesnt this work (from calculate)

red flower
#

destroying_card is for play only, destroy_card works in hand

#

youre also missing the seed to pseudorandom_element

#

(and it will pick a card for each card)

graceful oak
#

i might be tupid i just dont know how to make da ui work... very sad

#

idk if its this way or where to include the code

red flower
vernal path
#

Is there a reasonable way to loop through this table and apply the modifiers to a table of cards, or should I just do each one manually
local enhancements = {c.ability.extra.enhancement, c.edition.key, c.seal}

#

Or like, as a case switch using the index of a for loop

red flower
#

whats the goal?

vernal path
#

Apply enhancements from destroyed cards onto random cards in the deck

worthy stirrup
#

does the generate_ui function support UI structure

#

wait

#

its ui, of course it will

red flower
vernal path
#

Yeah, so i have to do it manually

#

thats okay

red flower
graceful oak
red flower
#

i think i know whats wrong

graceful oak
#

ye gimme a sec

red flower
#

generate_ui doesnt go inside text and doesnt work like that

graceful oak
red flower
# graceful oak

why are you calling the function inside generate_ds_card_ui

graceful oak
#

actualyl yea why am i doing that wtf

#

lol

#

thought itd read the base values from that func #fail

red flower
#

you want to return main_end in loc_vars

#

like blueprint

graceful oak
#

yuh that was the reason that was silly

worthy stirrup
#

sorry, could i get a tiny example, is it like loc_vars = {main_end = {}}

graceful oak
#

thank you vro

worthy stirrup
#

thank you

#

There we go its working now, thank you so much

hybrid shadow
#

i have to thank toma whenever shes here bc i managed to kinda get my rarity code basing itself off of flags

worthy stirrup
worthy stirrup
#

ohh, i had an extra set of {}

#

god i wish i could see these things

hybrid shadow
red flower
#

you would need to check that in get_weight and return 0

worthy stirrup
#

okay, i am now able to spawn a game object like cardarea, but how would i put something into that cardarea

hybrid shadow
hybrid shadow
red flower
worthy stirrup
#

ill try that out, thank you again, i assume "S_A" is a ace of spades?

frosty rampart
worthy stirrup
#

YES, ITS ALIVE

pastel kernel
red flower
#

you can change c_base for an enhancement

worthy stirrup
#

thank you so fucking much, i would never have been able to do this my self

graceful oak
vernal path
#

Okay, i think i'm misunderstanding what pseudorandom_element provides, since i thought it provides a table

if context.remove_playing_cards then
            for _, c in ipairs(context.removed) do
                
                -- Put all enhancements into a table
                local enhancements = {}

                if c.config.center then
                    enhancements[1] = c.config.center.key
                end

                if c.edition then
                    enhancements[2] = c.edition.key
                end

                if c.seal then
                    enhancements[3] = c.seal
                end
                print(enhancements)
                -- apply enhancements to random cards in deck
                local target_cards = {}
                for _, d in ipairs(G.deck.cards) do
                    table.insert(target_cards, d)
                end
                G.E_MANAGER:add_event(Event({
                    func = function()
                            for index, e in ipairs(pseudorandom_element(target_cards, pseudoseed('the_crow'))) do
                                if index == 1 and enhancements[1] ~= "c_base" then
                                    e:set_ability(enhancements[1])
                                end
                                if index == 2 and enhancements[2] then
                                    e:set_edition(enhancements[2])
                                end
                                if index == 3 and enhancements[3] then
                                    e:set_seal(enhancements[3])
                                end
                            end
                        return true
                    end
                }))```
red flower
vernal path
#

ahhh, so

#

okay

#

uhm

#

hm

red flower
#

how many random cards do you want to change

vernal path
#

max of three, but it's supposed to be random each time

worthy stirrup
#

Okay, hopefully last question, how can i get the next card that will be pulled from the deck

red flower
pastel kernel
# graceful oak the one and only

Please give me the answer to my question, what is your opinion on the community for the hit game “Italian fatass climbs up the tower”?

hybrid shadow
worthy stirrup
#

thank you once more

pastel kernel
frosty rampart
red flower
# vernal path yes
local amount = pseudorandom("seed", 1, 3)
for i = 1, amount do
    local playing_card, index = pseudorandom_element(target_cards, 'the_crow')
    if enhancements[i] then
        if i == 1 then
            playing_card:set_ability(enhancements[i])
        end
        if i == 2 then
            playing_card:set_edition(enhancements[i])
        end
        if i == 3 then
            playing_card:set_seal(enhancements[i])
        end
    end
    table.remove(target_cards, index)
end
worthy stirrup
#

to be sure, if i add one, it will give me the second card

hybrid shadow
#

alr cool

floral narwhal
#

Hi i'm making a balatro music pack mod and idk what are in-game musics key

red flower
frosty rampart
worthy stirrup
#

i mean, i guess it does show you it

red flower
#

lol

worthy stirrup
#

suits me right for trying to make a shortcut by doing object = G.deck.cards[#G.deck.cards]

red flower
#

i also wouldnt do that because it might get destroyed when you close the description

#

you would need to make a copy

pastel kernel
#

Is it possible to make a code for “spawn a random joker from joker pool, ignore flagged jokers, jokers from two different rarities are flagged”?

worthy stirrup
#

oh, now i see what you mean, damn it. i guess i do actually gotta try

pastel kernel
#

I’m not returning to modding yet, I’ve still got to finish a drawing prompt.

worthy stirrup
#

i feel like theres an easier way to get the card's G.P_CARDS["S_A"], G.P_CENTERS['c_base'] other than grabbing the card and translating it with a table of all options

red flower
#

card.config.center.key for the enhancement

worthy stirrup
#

seems easy for that :3

red flower
#

i dont remember for the suit and rank let me check

vernal path
red flower
#

oh then remove the table.remove

graceful oak
pastel kernel
graceful oak
#

ye

vernal path
worthy stirrup
#

oh, i just realized im gonna need to make sure it hides the card if theres not a card in that area

hybrid shadow
#

it didnt work apparently

red flower
worthy stirrup
#

THANK YOU

hybrid shadow
worthy stirrup
#

sorry caps

#

okay, so ive got this, if the player has no cards in their pile, how can i make sure the card just doesnt show up or am i good?

{n = G.UIT.O, config = {align = "cm", object = Card(0,0, 0.5*G.CARD_W, 0.5*G.CARD_H, G.deck.cards[#G.deck.cards].config.card_key, G.P_CENTERS['c_base'])}},
#

wait no, i broke something 1s

red flower
#
G.deck.cards[#G.deck.cards] and {n = G.UIT.O, config = {align = "cm", object = Card(0,0, 0.5*G.CARD_W, 0.5*G.CARD_H, G.deck.cards[#G.deck.cards].config.card_key, G.P_CENTERS['c_base'])}} or nil,
#

yeah youre also missing the p_cards thing

worthy stirrup
#

so i put p_cards[G.deck.cards[#G.deck.cards]]?

red flower
#

G.P_CARDS[G.deck.cards[#G.deck.cards].config.card_key]

worthy stirrup
#

yea, thats what i meant, my bad

#

thanks again

hybrid shadow
#

stupid formatting question but between param1 and (param2 or not param3) and param1 and (param2 or (not param3)) which of these actually gets read properly in code

red flower
#

both are equivalent

worthy stirrup
#

IT WORKS YAY

#

thank you so much for your time

hybrid shadow
#

(i know how to properly write this just gonna simplify rq) so i could write flag_check and (showman_check or not flagcard_check) and that would check if the flag is true and either showman is there or the associated card is not there

red flower
#

yes

hybrid shadow
#

god this codes gonna be a mess but hopefully it will work

sonic cedar
#

why isnt this importing the card into the table am i doing this wrong

#

the exceptions one works fine

red flower
#

idont understand what this does lol

maiden phoenix
sonic cedar
red flower
#

and what is it doing

sonic cedar
#

not adding it

worthy stirrup
maiden phoenix
#

Ah

sonic cedar
worthy stirrup
#

sorry

sonic cedar
worthy stirrup
#

i know it has nine sols with it so id look for a pack with that

red flower
sonic cedar
red flower
#

whtas onpayaout

#

whats

#

im very bad at typing i think

sonic cedar
red flower
#

is it true?

sonic cedar
red flower
#

im assuming the second argument is k and the third is v?

sonic cedar
#

yes

red flower
#

maybe its backwards?

sonic cedar
#

at least i

#

think i did?

red flower
#

no i mean in here

sonic cedar
#

local P_CENTERS = obj??

red flower
#

no lol

sonic cedar
#

ok good lmao

red flower
#

G.P_CENTERS[k]

sonic cedar
#

ohhhh-

#

but wait isnt k the non-ijiraq joker

red flower
#

isnt that what youre checking?

#

if the original has a calc_dollar_function?

sonic cedar
#

this table exists so i dont have to list each individual card key like i used to, and support modded jokers

in the example jokers, the og does not calculate dollars, but the fake one does

red flower
#

ohh

sonic cedar
red flower
#

oh

#

is test the prefix of the mod

sonic cedar
#

yep

brave blade
#

Is there a function I can use to trigger a game loss?

red flower
brave blade
#

Thanks!

sonic cedar
#

oh n already

#

nvm

red flower
# sonic cedar

no idea, i would try printing all the values and see what they give

#

like printing obj

sonic cedar
#

can i do that from console do you think

red flower
#

i would do it in the function

sonic cedar
#

same

red flower
#

welp

sonic cedar
#

does CDB not get saved to the cent-

#

of course it

#

doesnt

frosty rampart
#

yippee :3 works in the collection and the mod additions list
now to figure out the badge text

sonic cedar
#

maybe one of the keys is nil?

brave blade
#

What's the difference between G.GAME.round_resets.ante and G.GAME.round_resets.blind_ante?

sonic cedar
#

no those are fine,,

subtle urchin
#

Is there any guide on custom seal, bosses or decks? Or tags?
I’ve already did stuff with jokers and consumables but can’t find anything about how to start with those, if there’s not I’ll just check code of existing mods, thanks!

brave blade
red flower
brave blade
#

Anything with a calculate() function can use nearly all of the contexts in the Calcuate Functions page I believe

sonic cedar
#

i figured it out

#

and i know exactly why

#

i think

subtle urchin
stiff locust
#

how do I check a context during calc_dollar_bonus without context being nil

red flower
#

it also doesnt need to because it only gets called at one specific point of time

stiff locust
#

but I need to check if the blind beaten was a boss blind

#

I want this to give end of round money only if it was a boss blind that was beaten

red flower
#

G.GAME.blind.boss

stiff locust
#

that didn't work

#

it crashed in specific runs and I don't know why

red flower
#

whats the crash

stiff locust
#

something adjacent to G.GAME.blind.boss is nil I won't be able to recreate it reliably

normal crest
stiff locust
#

it only happened to me once but someone using my mod ran into it way too much

wintry solar
#

I wonder if thats a reloading on cashout issue

red flower
stiff locust
red flower
#

oh is talisman deleting saved runs

#

also this works fine even on reload

stiff locust
#

it annoys me because I don't know what is actually causing the crash

#

and I won't know if it is fixed or not until either me or that guy randomly crash

red flower
#

it might be some mod doing something weird

stiff locust
#

I doubt it

#

the only mod I have that does anything with boss blinds is morefluff adding the DX boss blinds for ante 8 if you redeem its funny voucher

#

0 other modded blinds and nothing like bonus blinds

normal crest
#

Do you have the crash log from when it happened

stiff locust
#

i'll check

#

I don't think I have a crash log for it no
I clear my logs when i update smods (probability update required me to do a stability patch)

#

it's not an easy crash to run into in a regular run

brave blade
#

Can anyone help me out with this error? I'm trying to hook onto Game:start_run() so that I can run an apply function for my challenge

stiff locust
#

you need a specific legendary fusion with 1 of 2 boss blinds to even get the effect that is causing the crash

normal crest
brave blade
#

Ohh, okay

#

Sorry, I'm pretty new to hooking functions

stiff locust
#

so I guess this crash is going with that chie crash where I have no idea if I've fixed it or not until someone reports the crash to me

floral narwhal
#

Its not working

hybrid shadow
#

is the next(SMODS.find_card for Showman just ("j_Showman"))?

brave blade
#

It looks like Showman's internal name is 'j_ring_master' for some reason?

hybrid shadow
#

im not entirely surprised given canio is 'j_caino' but it still feels weird

red flower
hybrid shadow
red flower
#

it checks for showman and then any mod can hook it to pretend that theres a showman

normal crest
#

it'd check if the showman effect should apply, for whatever reason that might be

#

by default only if you own showman

faint yacht
brave blade
#

So what's the "proper" way to spawn in a Joker? Because I know there's several functions that add cards

hybrid shadow
#

i cannot wait to show yall how bonkers this code will look at the end of all this

brave blade
normal crest
#

SMODS.add_card { key = "j_prefix_key" }

red flower
#

my shift key is not working im going to throw this keyboard out a window

normal crest
#

you have two shift keys don't you

red flower
#

i dont wanna use right shift..

normal crest
#

time to use right shift

red flower
#

also all the keys at the bottom are working kinda badly

normal crest
#

Do you throw your keyboard out the window often

red flower
#

thank you

normal crest
#

Cus that'd explain it

red flower
#

that was the problem

vague crest
#

if i wanted to have a calculate thing that runs specifically when a challenge is active (basically just a deck modification like anaglyph deck) what would the process be for this

#

i had this and i had high hopes but nothing is running

hushed field
#

I have three jokers that share a mechanic, causing the game to crash whenever they get spawned in. I've got a single lovely log that's implying it's an issue with it getting stuck in recursion, but I can't figure out why. The calculate of the joker's only check for joker_main, so shouldn't do anything weird. This is the config for one of them, which is very similar to the other two jokers. I'm kind of at a loss for what could be going on.

paper elbow
red flower
#

a challenge calculate would be cool

paper elbow
#

Also JokerForge is pretty cool and surprisingly versatile. I've been able to do some weird effects with it without having to modify the Lua much at all.

red flower
vague crest
#

oh is that all thats missing?

modern kindle
red flower
hushed field
modern kindle
#

how are you creating the codex itself? is that just generated within or are you going the lovely file route

vague crest
#

is this all i need to do to fix that? ill be honest i dont fully understand all of this code i got it from somethingcom515

normal crest
#

It's probably possible

hushed field
# modern kindle how are you creating the codex itself? is that just generated within or are you ...

https://github.com/icyethics/Kino/blob/v0.10_dev/src/codex.lua

the create_codex function here! But codex's are only created when the joker is first calculated. Originally, I had it create one upon add_to_deck, but I incorrectly assumed that may have been the issue

GitHub

a balatro mod for movie dorks. Contribute to icyethics/Kino development by creating an account on GitHub.

red flower
floral narwhal
hushed field
#

It can, but no other card needs to be present

vague crest
hybrid shadow
#

gotta love fucking up code because i forgot which joker to actually look for

paper elbow
#

If I want to make a set of consumable enhancements ( i.e. stone cards that trigger an effect and self-destruct when scored ), should I make each effect its own enhancement or have an enhancement with subtypes?

hushed field
tepid crow
modern kindle
#

is it this v0.10

hybrid shadow
#

do 'or' specifiers prefer whatever would make the if statement true

#

like if i did not (param1 or param2) would it see if either one is false and use that 'not' to make the statement true

red flower
#

no it evaluates (param1 or param2) first

hushed field
#

I truly am at a loss as to what it could be, haha

hybrid shadow
red flower
#

yes

modern kindle
hushed field
#

playing cards, but once it's in your possession, it doesn't cause any crashes, as far as I know

modern kindle
#

when does the crash occur, in shop?

hybrid shadow
hushed field
#

Part of the issue is that I can't easily reproduce the contexts of the crash, haha. If you just play a run, the game will crash to desktop upon rerolling or leaving the payout screen

hushed field
#

when you reload your run, it will work, and one of the spawned jokers will be Oppenheimer, Zodiac, or Arrival

modern kindle
#

i rerolled the shop, and did cash out for no crash

hushed field
#

yeah, it's not consistent

#

It relates to the save system, but I haven't figured out how exactly

#

let me grab some logs that make me suspect this is the issue

#

this one was send to me today. It's got a bunch of mods, but it was an issue in the collection, and you can see that if you ctrl-f Oppenheimer, that after that it starts getting stuck into a copy_table loop it can't break

hybrid shadow
hushed field
#

i guess that's where infinity ends

#

lot lower than i was expecting tbh

#

but yeah, I wouldn't actually peruse them too much, if you ctrl f for arrival or oppenheimer, you can see where the behaviour changes and the loops starts

red flower
#

people should start naming hooks with real names

paper elbow
#

How can I add a custom button to cards with its own callback?

quick kraken
hybrid shadow
#
spades_slick = Card:is_suit(spades)```
red flower
#

this will crash because youre saving cards to it

#

or not?

#

it says that it has cards in the log at least

modern kindle
#

I wouldn't think so, it seems fine

#

It is apparently on card creation in shop or though tarot cards or etc

hushed field
#

as well as in the collection, apparently

red flower
#

it's when set_ability is called

modern kindle
#

I have an autoclicker running through shop right now with its weight up and it hasn't crashed yet

#

Haven't crashed in collection yet either

red flower
#

but yeah the problem is that its trying to copy cards in codex_lastplayed

hushed field
#

I should check my code better than, because I was under the impression that I didn't store cards, but only a rank and a suit, haha

modern kindle
#

yea actually thats exactly what it is, i played a test hand and then went into shop and insta crashed

red flower
#

thats what im seeing too but thats not what the log says haha

modern kindle
#

i thought the dummy table is what it pulls from until you played a hand and it was in your deck, is it not pulling from there?

hushed field
#

That should be how it works, yeah

red flower
#

oh does this update the dummy table

hushed field
#

but I guess that explains it, that it improperly stores the last played hand somewhere?

modern kindle
#

i did suggest that he may be storing things in the dummy table and changing it somehow

#

but i didnt think so

hushed field
#

it shouldn't, but that might be where I fucked up

red flower
#

i would try making the dummy table into a function that returns a new table

modern kindle
#

yea that would make sense

hushed field
#

I'll do that, yeah

modern kindle
#

i should trust myself more if thats the case cause i told you in dms i was thinking it was the dummy table lmao

hushed field
#

That makes so much sense, as well. I'll let you know if it works after investing 10k into rerolls, haha

red flower
#

i still dont know why its saving cards tho

modern kindle
#

probably to display it on the codex

red flower
#

no i mean i dont see it i the code

modern kindle
#

oic

hushed field
#

I think the issue is that I set the dummy codex up to also be the global that stores the last hand, so it'd get overwritten 🤔

modern kindle
#

last played becomes the dummy doesnt it

red flower
#

oh yeah this will do it

hushed field
#

probably. I suspect it writes into the dummy, with the way I've set it up

modern kindle
#

yea

#

see i be knowing

hushed field
#

I'll try that out after my cat's bored so I don't have to type with one hand while I flail a toy around with the other, haha

#

but really appreciate the help guys, that was driving me ab-so-lutely crazy

modern kindle
#

if it works be sure to give N and i 300 usd

#

thats the friendship price

hushed field
#

🥲

#

i can send you a picture of my cat exploring my backpack as payment, haha

modern kindle
#

hell yea animals are awesome

hybrid shadow
#

yall wanna see the worst coded if statement ever

frosty rampart
frosty rampart
#

i sure do love lovely patching dead~1 maybe i'll try to make this more general eventually, but for now it works

long sun
#

heyo!

#

i have this code here

#

Straight works correctly with Valant Gramarye

#

however, Straight Flush doesn't

#

oh i see

#

wait

#

right, i see, a Straight Flush is also a Straight, which is now a Straight Flush

#

mm. annoying

#

i feel like i'd break something if Straight Flushes no longer contained Straights

gusty iron
#

how would i make a suit act like 2 suits at once?

long sun
#

gonna give it a go anyway ^^;

frosty rampart
gusty iron
frosty rampart
#

yea that should be a fairly simple (albeit a little tedious) hook

gusty iron
#

So if something triggers spades, it would trigger:

  • Spades
  • Spearts
  • Spiamonds
  • Splubs
spice wadi
#

how does one patch other mods? im not sure of the syntax for it

#

nvm i think im an idiot and forgot quotes somewhere

long sun
#

okay i've figured out what's wrong!

#

no clue how to fix it!

#

so, the Joker makes Straight Flush evaluate as Straight

#

however

#

a Straight Flush contains a Flush, which ranks higher than Straight -u-

#

so it turns Straights into Straight Flushes and Straight Flushes into... Flushes 😭

#

i'm just gonna change the ability because i cannot be arsed™

#

flush > straight flush > flush

red flower
long sun
#

oh?

red flower
long sun
#

oh. -u-

#

gosh the hoops i went through for this to be more easily doable 😭

#

thanks ^U^ lifesaver

gusty iron
#

could anybody help me edit is is_suit() hook?

frosty rampart
#

(I'll be able to help soon, didn't mean to leave you hanging)

gusty iron
long sun
#

what do i do for the context? i've done it incorrectly ;u;

gusty iron
#

what's it supposed to do?

long sun
#

Straights count as Straight Flushes and vice versa

gusty iron
#

ah

#

hm

spice wadi
#

this maybe?

long sun
#

oh part of me assumed that was localised

#

so if it was different in a different language then it wouldn't work

#

but that might not be the case

#

so i'll try it

#

oh it's not localised ^u^ okay good

#

thanks!!!!

red flower
#

oh i didnt read lol

long sun
#

^u^

primal robin
#

Salty ghost

#

!!!!!!