#💻・modding-dev

1 messages · Page 407 of 1

thorn furnace
#

o

#

tho even when I'm in a blind and I use it, it doesn't do anything

manic rune
#

for some reason, changing G.GAME.blind.chips wont update the score requirement text

thorn furnace
#

do i have to like
manually reload it

maiden phoenix
#

Too op, make it Rare ty

daring fern
thorn furnace
#

thank u :>

manic rune
#

i think i made a polterworx joker, im sorry everyone

thorn furnace
primal terrace
#

Trying to figure out how to check for money spent

daring fern
manic rune
#

hook to ease_dollars, might not be consistent for effects that change G.GAME.dollars directly but its the cleanest approach

or if you want it to be absolutely consistent, then you might want to use update 🤔

primal terrace
#

It hooks ease_dollars and checks if the value has decreased

daring fern
manic rune
#

🤷‍♂️

#

some mods that dont know ease_dollars() exist, probably

bold sleet
#

-# me once

thorn furnace
manic rune
#

delay(0.1) doesnt really do anything here

shell timber
#

it's fine to ignore mods that change G.GAME.dollars directly because that is Incorrect

manic rune
#

true

manic rune
thorn furnace
manic rune
#

wait omg hi lyman

#

👋👋👋👋👋👋👋

bold sleet
#

I do wonder if it is possible to add an event to the queue and make it not be the last event.

slow ocean
#

Wanted to drop by and ask how useful would an API be that categorizes Jokers (i.e. chip jokers, mult jokers, scalers, food, etc)

Id imagine a release would come pre built with some popular mods already sorted

For mod makers it would allow you to basically compare a key to a table and return relevant categories. If it sounds useful, what would you imagine would need a category, and how strict do you think it would be

#

henlo

manic rune
#

oh thatd be super useful

bold sleet
#

very

shell timber
#

yeah that'd be somewhat useful

manic rune
#

i think food jokers should def be a category

bold sleet
#

You say like, tags for cards?
cavendish for example: joker, food
fool: consumeable, tarot

#

idk

slow ocean
#

The joker/Consumable category wouldnt be necessary since you can already check that but yes

bold sleet
#

ah

manic rune
#

yeah, you can check their set

slow ocean
#

Good idea to tag if it interacts with a special type like tarots or planets though

unborn bay
#

i have a joker rn that checks for food jokers which is quite finicky and requires people to add their food jokers to the pool

bold sleet
#

So, exactly, how would it work? You pass a key and it returns a table with all associated categories?

slow ocean
#

From a mod dev end too I'd imagine you'd be able to feed your own custom tags for your mods so it plays nicely with other CatAPI sorted stuff

shell timber
#

smods already has "pools" which do the same thing

#

just having a standard set of pools and a mod that applies them to vanilla would be good

slow ocean
#

Is this what the meme pool is

bold sleet
#

howthefuckdoesoneworkwithpools

unborn bay
#

meme pool is indeed a pool

manic rune
#

we just dont know

#

:3

slow ocean
#

Awesome

unborn bay
bold sleet
#

water pool

unborn bay
#

for the food pool dango uses i basically convert the center pool of food jokers to a key value dictionary

#

because iterating fucking sucks

manic rune
#

i have to

#

fucking work on ui again

#

asdlsadmsalm

#

god im sick of it by now

slow ocean
#

Is there merit in just making it a separate json file or something so it's easier to edit

unborn bay
#

unbelievable

manic rune
#

someone help

slow ocean
#

Node moment

manic rune
#

i cant work on ui no more 😭

shell timber
#

Buffet - Rare
When you discard a Royal Flush, destroy this joker and create a negative copy of every Food Joker

unborn bay
#

what if legendary food joker

manic rune
bold sleet
#

I could try to help you if my puter did not broke down and I actually knew how to work with (your) UI structure.

manic rune
#

im bad at ui

#

so i think everyone here is better than me

bold sleet
manic rune
#

:3

shell timber
#

anyways for pools smods already lets you define them on the joker definition

unborn bay
bold sleet
#

the what now?

manic rune
bold sleet
#

^ complete doofus, doesn't know what half of these things are.

#

ñom

slow ocean
#

Time to learn

shell timber
#

anyways building a new system for this probably isn't a good idea

#

since smods objecttypes/pools already exist

bold sleet
maiden phoenix
daring fern
#

#

warm flume
#

I'm struggling to get the level colours on my planet card to work. I thought I got it when I found G.C.HAND_LEVELS, but it's still just the default colour

warm flume
#

I do

daring fern
# warm flume I do

Try ```lua
colours = {
(
to_big(hand.level) == to_big(1) and G.C.UI.TEXT_DARK
or G.C.HAND_LEVELS[to_big(math.min(7, hand.level)):to_number()]
),
},

warm flume
#

Just tried it without talisman and it doesn't work either

warm flume
#

that works and I don't understand why :3
Is the handlevel == 1 and TEXT_DARK part even necessary?

#

Ah, I see why it is necessary now :3

#

Thanks for the help :3

thorn furnace
#

Does lua use pass by reference or pass by value
I want to make some qol functions

onyx sonnet
#

tables are passed by reference

#

there might be something else passed by reference too

#

but most thing slike ints and strings and bools are passed by value

thorn furnace
#

unfortunate

#

wanted to just add a smooth_lerp_set function as a general qol thing

hoary stream
#
        if context.playing_card_added and not context.blueprint and playing_card:get_id() == 9 then
            card.ability.extra.count_nine = card.ability.extra.count_nine + 1
        end
    end```
daring fern
#

You would need to iterate over it.

hoary stream
#

so i need to check for every card that is added right

hoary stream
#

is there anyway to check the table of new card added to the deck

daring fern
pale venture
#

Adding an event for animation purposes in context.before that grants enhancements to scoring cards seems to not make the enhancement apply during scoring, is there a way to fix it?

daring fern
#

It can't be calculated if it's in an event.

pale venture
#

I see, so you can't really make a flip animation in that case if i'm not mistaken

thorn furnace
#

how do I add a sticker to a given card

daring fern
thorn furnace
#

thank u :>

warm flume
#

I want to have a single planet card for 7 similar hands, but if I do that then they wouldn't work with Blue Seals because that only checks config.hand_type of the planet cards, which can only hold one hand. Any ideas for potential workarounds?

daring fern
untold vigil
#

So it has to have true after ... .total_rounds?

warm flume
daring fern
warm flume
#

Thanks

daring fern
molten musk
#

whats does collection rows mean in this example

SMODS.ConsumableType {
    key = 'vremade_Spectral',
    default = 'vremade_familiar',
    collection_rows = { 4, 5 },
    primary_colour = G.C.SET.Spectral,
    secondary_colour = G.C.SECONDARY_SET.Spectral
#

@daring fern

daring fern
molten musk
#

um... 🤔

#

in more detail?
i get it but not

maiden phoenix
#

When you open your consumable in Collection, it's the amount of cards that shows per row

thorn furnace
#

How would I go about duplicating a card

molten musk
#

so lets say i add 3 spectrals

#

i do { 3,1}??

maiden phoenix
thorn furnace
rugged pier
thorn furnace
maiden phoenix
hushed field
maiden phoenix
#

Or 1, 2 idk

#

Whichever you prefer

molten musk
#

what about 3, 0
what will happen?

rugged pier
maiden phoenix
thorn furnace
daring fern
molten musk
hushed field
#

I tried to read back up and see what the issue was for pools, as I'm considering seeing if I can set something up for it for smods to make crossmod stuff easier without needing to incldue everything during coding. But discord's not showing any messages when I scroll up

daring fern
thorn furnace
maiden phoenix
#

The first parameter of copy_card takes the card you want to copy

#

so for example copy_card(G.jokers.cards[1])

molten musk
#

is pos always 3,4?

daring fern
thorn furnace
#

neat
I thought you had to use four

maiden phoenix
#

Actually I think for playing_card you need the fourth parameter too?

molten musk
#

my first mod so pear with me ...

maiden phoenix
#

Here's an example w a playing card

molten musk
daring fern
thorn furnace
maiden phoenix
#

Non-playing cards don't need the fourth parameter, unless you wanna strip edition or something

molten musk
#

on what basis...

#

like surley i dont use whatever pos

maiden phoenix
untold vigil
maiden phoenix
thorn furnace
molten musk
maiden phoenix
#

And it works for all kind of cards?

maiden phoenix
thorn furnace
maiden phoenix
thorn furnace
#

👀

#

thank u

maiden phoenix
#

nope

warm flume
maiden phoenix
#

Nvm it is my bad

#

Both are used in the code

#

@thorn furnace There's no s in playing_cards sorry

thorn furnace
#

yea no worries

molten musk
#

can someone explain this line to me, need to understand so i can modify

 info_queue[#info_queue + 1] = G.P_SEALS[card.ability.extra.seal]
warm flume
#

info_queue is the list of extra info tooltips, #1116390750314307698_queue is the amount of things in that list
info_queue[index] gets the entry at the index; #1116390750314307698_queue + 1 would be a new index, because it comes 1 after the highest entry
and then it sets that entry to the seal set in the cards extra thingy

molten musk
#

oh, i get it now, thx absent

thorn furnace
#

It's a lua W that they do arrays like that

untold vigil
warm flume
#

-# I think technically #info_queue + 1 doesn't always give a fresh entry, if the list isn't already in order, but the assumption is that no one goes out of their way to set entries at weird places for no reason

thorn furnace
#

i mean I assume it just gives the memory address at that point

red flower
unborn bay
#

if you're talking about if some other thing sets something to nil then no

#

that doesnt remove the element

#

the corresponding key or index will still exist

warm flume
#

I'm still getting used to lua, so I could be wrong, but the way I see it:
If the list has entries at index 3, 4, and 5, but is otherwise empty, then it has a length of 3
and #array + 1 would then be 4, which would already be set

red flower
#

no because # counts from 1

#

afaik

#

so #array + 1 will be 1

unborn bay
#

indices can have nil values

#

it wouldn't make sense otherwise

red flower
#

what wouldn't make sense

thorn furnace
# red flower no because # counts from 1

Yea
It seems like it's counting just the total number of used indexes
So it'll always be new

Having entries at indexes 3, 4, and 5 still leaves 1 and 2 existing
so #list + 1 would be 6

warm flume
red flower
#

no I don't think that's true

red flower
#

otherwise no

unborn bay
#

the argument that indices 1 and 2 would be skipped only applies if the table is a dictionary

#

which is not the case

red flower
#

I'm pretty sure they are skipped

molten musk
#

is this code correct for a spectral consumable that adds seal?

warm flume
#

-# The easy way to find out is to run it and see :3

red flower
#

yeah they're not lol

#

at least not in the online compiler

thorn furnace
#

Because the length of a table t is only defined if the set of its positive numeric keys is equal to {1..n}

red flower
#

but {nil} is skipped
i hate this language

warm flume
#

Hmm intteresting

molten musk
warm flume
#

What do you mean with nothing is shown?

thorn furnace
red flower
#

it does

#

why

#

idk

thorn furnace
#

the lua manual lied to me

molten musk
#

game crashed when i looked up seals

unborn bay
#

something is after nil

molten musk
#

there was nothing in spectrals

unborn bay
#

so it would count as such

thorn furnace
unborn bay
#

nils only don't count IF its the last element in the array

thorn furnace
unborn bay
#

you tell me that

int array[] = {40, 10, NULL, 20}

isnt a sequence

warm flume
thorn furnace
unborn bay
#

the manual is wrong

#

the lua manual in general fucking sucks

molten musk
#

dont know how to copy all the text ...

thorn furnace
# thorn furnace I'm quoting the manual

A table with exactly one border is called a sequence. For instance, the table {10, 20, 30, 40, 50} is a sequence, as it has only one border (5). The table {10, 20, 30, nil, 50} has two borders (3 and 5), and therefore it is not a sequence. The table {nil, 20, 30, nil, nil, 60, nil} has three borders (0, 3, and 6), so it is not a sequence, too.

red flower
warm flume
unborn bay
#

blame lua for making tables both arrays and dictionaries

red flower
thorn furnace
#

also 5.4

molten musk
#

ok to explain what i have
i have main code which "summons" other codes as shown
thought the problem was cause joker.lua was empty
so i tried removing that and then this happened

red flower
#

i hate this

thorn furnace
thorn furnace
#

Like when _jeb and the others were making Minecraft Java and they said "hey Java sucks let's rewrite this entire thing in C++ instead"

warm flume
# molten musk

Probably forgot to close some bracket or if statement somewhere, and that's why the file fails to load

hushed field
#

#1365341899245752390 message

Thinking about setting up a probability function for Smods, but I don't think everyone checks the feature requests there, so linking it here in case people have thoughts

molten musk
#

or its cause i didnt add the new seals in the seals code

primal robin
#

You better not know how arrays work in JS ehehe

molten musk
#

had the original ones

#

need to modify them

hushed field
# molten musk

This crash basically always means you're not closing or ending a function or bracket somewhere.

molten musk
#

gonna go search for that then ...

unborn bay
# red flower i hate this
Traditional array with values nil, 1, nil, 20, nil
#: 4
pairs: 4
ipairs: 0
Dictionary with values 1: hi, 2: nil, 3: hello, 4: world, 5: nil
#: 1
pairs: 4
ipairs: 1
primal robin
unborn bay
#

dont even get me started on js

unborn bay
#

in general table count counting in lua is very stupid

#

just note that pairs skips nil values and continues and ipairs doesn't

primal robin
#

It's straightforward: start from 1, check value by this key, if nil then stop

red flower
unborn bay
#

you can chalk it up to lua implementation being the weirdest thing ever

molten musk
#

now what

primal robin
#

The fact that string keys and number keys are different is crazy

red flower
molten musk
#

this is the 4th diff crash now

unborn bay
#

yeah no any kind of counting via # is gone if you use string keys

#

yknow what fuck it

hushed field
unborn bay
#

im adding a joker that makes fun of this for no reason whatsoever

#

"guess the table n count joker"

red flower
#

let's goo

hushed field
molten musk
#

..... anger

#

and here i thought i sloved it

#

i really had 3diff crashes after it when i modified the code

#

😩

hushed field
#

can you show your code in some screenshots?

molten musk
#

i can stream if u are up to a VC...

hushed field
#

screenshots are a lot easier, I'm technically still working atm, haha

molten musk
#

here u go

#

seals are the same as red blue and gold

#

just name diff

#

this too

hushed field
#

It's not the solution for it, but I really recommend getting a vsc extension to colour match matching brackets

#

that's very, very helpfulf or issues like these

#

but yeah, you're missing a bracket, two lines above key = 'phantom'

molten musk
#

this one?

hushed field
#

I can check which one I use when I'm home, but I'm not sure which one is best or if they all work for lua, sorry

thorn furnace
daring fern
thorn furnace
#

at this point it's probably just better to handle jokers vs consumables vs playing cards on a case by case basis

#

I was hoping I wouldn't have to do that :/

drowsy gull
#

Increasing the cost doesn't work with multiplication? Yes, if I just add a number it works, but if I try to multiply... nothing seems to happen

molten musk
maiden phoenix
thorn furnace
#

o

maiden phoenix
#

Oh nvm it's not emplacing that is

thorn furnace
#

i mean you still have to like
G.hand:emplace(card)

maiden phoenix
#

hold on lemme dig SMODS utils

daring fern
thorn furnace
#

o i didnt kno u could do that

maiden phoenix
#

Yea you can use SMODS.add_card

thorn furnace
#

I was thinking about that

maiden phoenix
thorn furnace
#

add_card would just be one line

molten musk
#

YoiCry now i remember why i stopped coding 2 years ago ....

maiden phoenix
#

Oh actually SMODS.add_card allow for using the card itself as a parameter

#

You need to try

#

Goes like SMODS.add_card(card) and that's it, no emplace or anything

#

Wait I think I'm reading the lsp wrong

#

Oh no it returns a card mb

thorn furnace
#

I mean honestly it's not too bad to just copy like the key and the edition and whatnot

#

though it does kinda mess up stacking jokers

#

lemme check the source code

red flower
thorn furnace
#

yall hate on vs too much fr

molten musk
#

what should i use then

red flower
#

visual studio code

#

(different program)

thorn furnace
molten musk
#

i know its diff program

#

lazy to download it now

#

maybe later

#

and vs works just fine

maiden phoenix
thorn furnace
#

does the add_to_deck() part work for jokers and consumables too?

thorn furnace
#

baller

bold sleet
#

knight

thorn furnace
maiden phoenix
#

Show your code

thorn furnace
#
apply = function(self, card, val)
  local copy = copy_card(card, nil, nil, card and card.playing_card and G.playing_card or nil)
  copy:add_to_deck()
  card.area:emplace(card)
end
thorn furnace
#

im blind

#

thank u

#

there we are

red flower
#

reposting things from the smods server
i know a lot of you are not comfortable making issues on github so if there's anything you think should be easier to do with smods let me know and I'll see if I can figure out something

#

I'm not fixing the docs tho

#

I'm bad at writing

gray void
#

Can a joker be not found in shop or duplicated from other effects when its already owned? Im trying to make an unduplicatable joker

molten musk
maiden phoenix
red flower
red flower
molten musk
#

already have it

red flower
#

also I hope you played my mod and tried out subterrors lol

molten musk
#

ok now i got vsc, that doesnt fix the problem tho ...

molten musk
gray void
thorn furnace
red flower
maiden phoenix
#

Show your whole seal code

molten musk
maiden phoenix
#

No

thorn furnace
# thorn furnace it's a bit of a journey but there appears to be one more issue with the sticker ...
SMODS.Sticker {
  key = "kiss",
  badge_colour = HEX('c261bd'),
    
  apply = function(self, card, val)
    if card.area then
      local copy = copy_card(card, nil, nil, card and card.playing_card and G.playing_card or nil)
      copy:add_to_deck()
      card.area:emplace(copy)
    end
  end,
  calculate = function(self, card, context)
    if context.end_of_round and not context.repetition then
      SMODS.destroy_cards(card)
    end
  end
}

What is up with the formatting getting ruined when I paste these things

maiden phoenix
#

Discord window too small

thorn furnace
#

i mean like it replaces each tab with like three tabs

paper zealot
native zinc
#

vsc is not bad

#

it has all i care about and all i ever wanted (regex replace)

thorn furnace
red flower
red flower
molten musk
#

which one?

red flower
#

oh yeah that's your problem

native zinc
#

wow .Lua

red flower
#

you're missing a loc_txt or localization file

maiden phoenix
thorn furnace
#

oki
tho the cards don't actually get destroyed at the end of the round so it might not trigger

molten musk
maiden phoenix
#

Didn't you say the card gets destroyed?

red flower
paper zealot
shell timber
#

the b got returned to canichatandobserve

thorn furnace
red flower
#

lua should enforce snake casing

#

and Lua camel case

shell timber
maiden phoenix
thorn furnace
molten musk
thorn furnace
#

it doesn't appear on either of them
But the card gets cloned so obviously it does something

red flower
#

well it needs a localization file inside with all the text

molten musk
#

will figure it out

maiden phoenix
#

There's no sprite loading

#

I think

thorn furnace
#

I mean it's not like the game's crashing due to failing to load an image

red flower
maiden phoenix
#

Well yea cuz you're loading none

thorn furnace
#

everything else seems to have a default image

maiden phoenix
#

Try setting a pos but without the atlas

molten musk
#

i have it installed

maiden phoenix
#

See if vanilla seal sprite work and don't dissapear

thorn furnace
maiden phoenix
#

I don't understand how is a seal sprite is showing up when none is specified

thorn furnace
#

oh

#

wait

#

could you rephrase

maiden phoenix
#

How does your seal have a sprite if none is specified

#

Is it part of SMODS.Seal?

thorn furnace
#

it's a sticker

maiden phoenix
#

Oops mb

#

Also I forgot SMODS.Sticker might have default values in it's constructor

#

Ok yea it does, so that's weird

thorn furnace
#

yea

maiden phoenix
#

I see the constructor has this in it's apply fucntion try adding the line too in your apply func

#

At the beginning

thorn furnace
#

oki

#

that fixed it

#

thank u

maiden phoenix
#

Sick ref btw

#

very clever

thorn furnace
#

Once I am done this mod it will be peak

#

not Cryptid levels of broken but definitely easier

#

(not because I want it to be broken but because I'm bad at balancing things while maintaining thematic relevance)

thorn furnace
#

did you draw this

native zinc
#

yes

thorn furnace
#

It was going to be cryptid levels of broken before I started balancing it

#

now it's just like
Moderately good

molten musk
#

yep, cant figure out localization ...

thorn furnace
# thorn furnace that fixed it

On the note of the consumable in this pic uhh
Is there a proper way to create a consumable that adds a sticker to any selected object
In my code I just have it like this and it barely works (and doesn't work for consumables)

use = function(self, card, area, copier)
  if #G.consumeables.highlighted == 1 then
    SMODS.Stickers["jojo_kiss"]:apply(G.consumeables.highlighted[1], true)
  elseif #G.hand.highlighted == 1 then
    SMODS.Stickers["jojo_kiss"]:apply(G.hand.highlighted[1], true)
  else
    SMODS.Stickers["jojo_kiss"]:apply(G.jokers.highlighted[1], true)
  end
end,
    
can_use = function(self, card)
  return (G.consumeables and #G.consumeables.highlighted == 1)
  or (G.jokers and #G.jokers.highlighted == 1)
  or (G.hand and #G.hand.highlighted == 1)
end
red flower
#

i mean it's not going to work for consumables unless you make the highlight limit bigger

#

and check for the other card highlighted

thorn furnace
#

Hypothetically
Asking for a friend

red flower
#

G.consumeables.config.highlighted_limit iirc

#

but it's kinda complicated if you dont want to change the limit all the time

#

Not exactly the same case but I have consumables that let you highlight 8 cards and the logic is kinda dumb

thorn furnace
#

I'm guessing there's like a while_holding function or something I put that in

red flower
#

they have an add_to_deck and remove_from_deck functions

thorn furnace
#

oh
I thought that would've stayed active even with other items

gray void
molten musk
#

im gonna kidnap someone from here and make him do the code jimbo_spin

red flower
thorn furnace
#

fair enough

#

eh should be fine

steep bronze
#

I wanted to know if there is any version of Balatro where the code is open, just so I can take as an example what localthunk did and help with my mod

red flower
#

You can extract the .exe and get all the code or look inside the lovely/dump folder in your mods folder

red flower
faint yacht
#

...why all of this on one line...

for _, area in ipairs(SMODS.get_card_areas('jokers')) do for _, _card in ipairs(area.cards) do
red flower
#

nested fors are icky so if theyre in one line it's like they're not there :3

faint yacht
#

Not helpful if I want to intercept the "for" loop creation and adjust it in the same way I did with SMODS.calculate_main_scoring...

#

-# Guess I need an another shot at the SMODS.get_card_areas hook.

red flower
#

you can always use a regex patch

faint yacht
#

...if I knew how to use it for such, I'd do it.

red flower
#

what are you trying to add?

snow vale
#

how can i make so the joker has a description on the side with the description of the joker it is copying?

#

by description i mean these things

red flower
#

info_queue[#info_queue+1] = G.P_CENTERS[key_of_the_copied_joker]

snow vale
#

okk

#

do i have to write em by hand...?

faint yacht
red flower
#

you can with ;

primal terrace
#

What I want to do is make a custom deck that makes my modded jokers appear more frequently, but it doesn't seem to have any effect

Or maybe I'm blind or it's confirmation bias

daring fern
snow vale
#

the joker descriptions

daring fern
snow vale
#

it aint working

red flower
#

where are you using that

snow vale
#

loc vars

red flower
#

does it display an empty box? does it crash?

snow vale
#

absolutely nothing

#

it simply doesnt appear

red flower
#

can i see more code

snow vale
#
    key = "soulwheel",
    loc_txt = {
        name = 'Soul Wheel',
        text = {
            'Every round, will change its',
            'soul copy.',
            '#1#',
        }
    },
    atlas = 'soulwheel',
    cost = 4,
    pos = {x = 0, y = 0},
    config = { extra = {
        text = "{C:red}Determination: +2{} mult"
       },
    },
    blueprint_compat = true,
    loc_vars = function(self, info_queue, card)
        info_queue[#info_queue+1] = G.P_CENTERS['j_ub_determination']
        return { vars = {card.ability.extra.text} }
    end,
    set_badges = function(self,card,badges)

    end,
    calculate = function(self,card,context)
        if context.repetition and next(SMODS.get_enhancements(context.other_card)) then
            return { repetitions = 1 } 
        end
    end    
}```
stiff quiver
#

how can i check the edition of a card?

red flower
red flower
snow vale
#

wait

#

no

#

it was det

#

😭

keen totem
#

how would i do something whenver the player spends money?

stiff quiver
daring fern
keen totem
daring fern
keen totem
#

so something

keen totem
#

believe it or not

#

people can

#

not know things

red flower
primal terrace
keen totem
#

both

primal terrace
#

The code on the bottom is a hook, that lets the joker's code know when the money value changes, and by how much

daring fern
red flower
primal terrace
#

Hooks are freaky

keen totem
#

well

#

that guy called lua LUA

#

so

#

instant death

red flower
primal terrace
#

I plucked the hook code from ExtraCredit "Hoarder"

#

Now it is this, way more elegante

keen totem
#

what are mod and x

faint yacht
#

smooth.

daring fern
keen totem
#

what do you mean x is instant

daring fern
keen totem
#

dont know what instant is

daring fern
#

So it goes instantly.

primal terrace
keen totem
#

how do i check if the money change was caused by spending?

daring fern
primal terrace
keen totem
#

wouldnt that one playing a card loses you $2 boss blind also activate that?

keen totem
#

can i stop it from activating that?

primal terrace
#

if context.MLP_ease_dollars and to_big(context.MLP_ease_dollars) < to_big(0) and not context.blueprint then

It's checking if the ease_dollars value is negative, which means that money is lost

daring fern
keen totem
#

i dont even know what patches are

#

ive just heard about them

undone slate
#

Hello. I'm using SampleJimbos as a reference for coding a joker but I find it a bit annoying due to it having more than one joker, and the structure of what's needed within my own lua file is not easily recognisable from the different original files.
Is there any other reference I can check out there?

keen totem
#

so i have no idea how i would even go about that

prime stone
#

Am I able to separate jokers into separate lua files instead of having all of them in one big file and if so how would I be able to

keen totem
#

yea

red flower
keen totem
red flower
#

the lovely github

daring fern
red flower
#

and check the patches in other mods

primal terrace
#

Speaking of lovely patches...

long sun
#

how can i get a list of all Tarot cards in the game?

undone slate
#

many thanks

daring fern
long sun
#

cheers ^^

#

also, how do i get the key of a Tarot card, again? ^^"

red flower
daring fern
faint yacht
#

One line... and I make Consumeables do their thing before Jokers. 🧠

prime stone
red flower
#

yes

prime stone
#

okie dokie, ty

primal terrace
# red flower yes?

I want to make a custom deck that makes the jokers from my own mod appear more frequently, similar to this one from SDM_0's stuff

But when I try it in game, it doesn't seem to have an effect on the Joker's rates

#

Maybe it's confirmation bias, or I'm blind and missed something in my code

red flower
#

oh yeah i saw that

#

but i dont have the code for the game with me rn

#

to see if the patch makes sense

hard mica
#

Anyone know how to fix this? I'm trying to add 10 playing cards with lucky enhancement on them at the end of a ante boss but the card just stays there

red flower
#

People yearn for the per-card rarity system

primal terrace
plush stream
#

I have been following a tutorial and this code is not working and I can't figure out why

#

I know the effect is not gonna work but

#

I just want it to appear

red flower
#

try removing the meow at the beginning

plush stream
#

oh

#

um

#

sorry

#

... that did not work

#

yeah I probably have like 20 mistakes here

long sun
#

mm, i've extended looking at all Tarots to all Resource cards, and this is crashing:
local resource = pseudorandom_element(G.P_CENTER_POOLS.phanta_Resource, pseudoseed('monopolychosenresource')).config.center.key

#

(haven't tested this on the Tarots, this is what i wanted to do)

#

do i need to add next()? instinct is telling me that'd do something

long sun
#

ah ^^" cheers

daring fern
#

I think.

plush stream
#

wait its that strict??

daring fern
long sun
#

yay! that worked :D

plush stream
#

It's still not working ;-;

tall wharf
#

oh hey ghost

long sun
#

heyoooo!!

daring fern
plush stream
#

yeah I added that

daring fern
plush stream
ashen atlas
#

hey yall, any ideas on how to stop this from destroying all card played if there is a heart and have it only destroy the hearts.

    for _, card in ipairs(context.scoring_hand) do
        if card:is_suit("Hearts") then
      return {
                        message = "Upgraded",
                        remove = true
            }
        end
    end             
end```
daring fern
plush stream
#

that did not fix it...

#

How many mistakes have I done...

daring fern
red flower
plush stream
daring fern
plush stream
#

?

daring fern
plush stream
#

Do I replace this part with that?

gray void
#

@red flower going back to the unduplicatable joker thing, i decided to just make my joker self destruct if theres another copy

red flower
#

makes sense

red flower
gray void
#

Btw thanks for the help

sturdy compass
#

Lol

red flower
#

hi astra

sturdy compass
#

Hello N

plush stream
gentle rain
#

is there documentation for quantam enhancements

#

thinking of ways to implement this and i feel like id have to use wild card quantam enhancements, right?

#

ok i found this but it just. says what quantam enhancements are without giving what function to use lmao

snow vale
#

i can show u

gentle rain
#

that would be appreciated

zenith sage
#
if cardarea == G.jokers and context.before then
    if (context.first_hand) then
        for k, v in ipairs(context.scoring_hand) do
            v.SMODS.has_enhancement(v, wild) true```
#

something like that

sturdy compass
#

Or smthn like that

zenith sage
#

^ obviously not the correct syntax for the func but

snow vale
#

you would need if context.check_enhancement and context.scoring_hand then
and on the return a return { m_wild = true}

zenith sage
#

just setting it to true should work

snow vale
#

also you have to enable quantum enhancements

sturdy compass
snow vale
#
    return {
        quantum_enhancements = true
    }
end```
#

this is for quantum enhancements to enable

gentle rain
sturdy compass
#

But yes it is

gentle rain
#

i always assumed i would need it to be specifically a wild card because stuff like flower pot specifically checks for the wild card enhancement in vanilla code

#

unless steamodded changes that to check for any_suit?

sturdy compass
#

I think it might actually

gentle rain
#

i see i see

burnt quartz
#

How I get the chips amount from a card in calculate func?

snow vale
burnt quartz
#

If I define a

Config{
   extra{
      chips= x
}}

This chips amount will replace the original amount of chips from a marked card?

undone slate
#

getting an 'unexpected symbol near "," ' error, but I've no idea where to start looking for that error, no line is provided

burnt quartz
#

For example, a card marked with a seal

undone slate
#

thanks

snow vale
burnt quartz
undone slate
#

json, sorry lol

snow vale
undone slate
snow vale
#

json is somehow really strict

#

you cant even comment 😭

burnt quartz
snow vale
#

np

undone slate
#

Damn, great

#

thanks

snow vale
#

np too

burnt quartz
snow vale
red star
#

Can anyone point me to where in the code it creates the bar where the Jokers go? (Or the Consumables bar. I suppose either would work.) Attempting something stupid so I don't want to drag anyone else in farther than I have to.

snow vale
red star
#

Yes, the card area.

snow vale
#

o

burnt quartz
daring fern
snow vale
red star
# daring fern

Fantastic, thank you. I've read the smods UI article several times today but was getting nowhere.

red flower
#

yeah those are not UI elements in the same sense, they're objects like cards

red star
#

That explains the disconnect I was having between what I was reading and what I was trying to accomplish.

#

Thanks.

undone slate
#

same error now with the JSON fixed.
Sending code (this time the actual LUA)

red flower
#

ok please use a newer example mod as a base lol

#

a lot of that stuff is deprecated

plain gazelle
#

I want my Joker to give +3 hand size at the beginning of the round and then take the hand size away when the second hand is played.

Using context.first_hand_drawn kills the player after selecting the blind (because for whatever reason the -3 hand size happens several times)

Using G.GAME.current_round.hands_played == 1 makes the +3 hand size work at first hand but then does the -3 hand size several times at second hand, bringing the hand size down to 0.
How do I make the -3 hand size work only once?

red flower
#

if context.hand_drawn and G.GAME.current_round.hands_played == 1 then

#

see if that works

plain gazelle
#

Yeah, it works now. Thanks!

undone slate
#

the joker is functionally similar to invis joker so I just checked what the og files had on it, but they are confusing

red flower
red flower
undone slate
#

checking it out rn

plush stream
#

Im trying to make to make the joker give 33 chips but it keeps doing something else than that :< Is there a big mistake in this code?

faint yacht
#

Just do return { chips = card.ability.extra.chip }.

plush stream
#

uhhh where do I need to add the end?

daring fern
#

Also move the end inside the table.

plush stream
#

oh yea
i might be stupid

undone slate
#

Quick question over vanilla remade's invis.
is this the section that checks for other jokers in hand or is it this one?

timid zinc
#

How do I make an object appear under "Other" in the collection?

plush stream
#

Theres apparently an unexpected symbol near line 35 which I can't see

daring fern
daring fern
#

Every function and if and for and while needs an end

zenith sage
#

current money is G.GAME.dollars right

daring fern
midnight coyote
#

what’s the var for current score

#

or do i just calculate mult * chips myself

plush stream
daring fern
midnight coyote
daring fern
midnight coyote
#

i want current chips and current mult, i’m trying to see if the score is gonna set on fire

#

so current chips is just chips then

#

mhm

#

alright

daring fern
midnight coyote
#

good god

#

alright

zenith sage
#

how might one take the floor / ceiling of a number

#

i tried ceil() and Math.ceil()

daring fern
#

math.ceil()

zenith sage
#

thank you

#

love that capital matters

chrome widget
#

Yeah the built in lua math library is math

#

Annoying because I think the one for Javascript was Math so coming over from JS from my last project I keep screwing it up

long sun
#

i'm making a consumable that converts 3 cards into random enhancements — what's the best way of doing this?

long sun
#

what does that do, again? ^u^"

daring fern
tall wharf
#

is it possible to modify a spawn rate of a joker

long sun
#

wait one more thing, does it take any arguments?

long sun
#

ah :D tyty

tall wharf
#

if a joker is present

tall jewel
#

alright so smallll issue with something I'm trying to do. I'm trying to add a card to the deck directly, and for some reason it only adds to the "temp limit" and not the actual limit (ie can't see it in the deck preview)

FaeLib.Builtin.Events.BlindCompleted:register(function (blind)
    if (FaeLib.Tags.BossBlinds:contains(FaeLib.Builtin.GetCurrentBlindKey())) then
        for _, value in ipairs(G.jokers.cards) do
            if FaeLib.ForagerCards[value.config.center.key] then        
                G.E_MANAGER:add_event(Event({
                    trigger = "immediate",
                    func = function()
                        SMODS.calculate_context({ playing_card_added = true, cards = {FaeLib.ForagerCards[value.config.center.key]:create()} })
                        return true
                    end})
                )
            end
        end
    end
end
)

    ForagerCard.create = function (self)
        local card = SMODS.add_card({area = G.deck, key = self.card_to_create.key or  self.card_to_create.config.center.key})
        return card
    end

In this case, card_to_create is a SMODS.Enhancement

#

It properly creates the card but doesn't add it fully

undone slate
#

is there a way for me to get whatever i've done added into my hand?

#

whatever i've done is a pretty good descriptive heh

#

add the joker I coded into the joker bar without finding it in-game

undone slate
#

thx

zenith sage
#

is there a calculate_dollar_bonus func for jokers or does that one need hooked

daring fern
red star
daring fern
tall jewel
tall jewel
zenith sage
daring fern
zenith sage
#

🙏

undone slate
#

I've got a problem with my joker lol

#

I've got the extra set as

daring fern
undone slate
#

it's empty apart from the function(self, info_queue, card)

#

that may be it actually

#

but I'm unsure what should go there then

tall jewel
#

<- oopid

red flower
#

you can add a fake rarity to it maybe if it's just one joker

daring fern
undone slate
#

later in the code they are referenced as card.ability.extra.accountant_rounds/total_rounds

#

and the main function of the code is after a calculate = function rather than the loc_vars

#

yeah, fixed by adding the extra stuff yeye

summer furnace
#

I have a question, is there like a wiki that has a full in depth explaination on what every thing means and has for variables, etc.? Like for example in the C# microsoft wiki?

daring fern
summer furnace
undone slate
#

due to my mod but outside of my mental grasp

mint raven
#

Heyo people, wanted to try and test out modding this game, am both very unexperienced with doing so and coding in general, are there any rescources I could follow to get some guidance? I cant find anything on google about actually writing mods for the game, just how to install stuff

mint raven
#

damn, thanks

midnight coyote
#

where’s this mythical steamodded visual studio code extension i hear of

burnt quartz
#

I want to debuff a card halfing they chips, What I can do?

#
    calculate = function(self, card, context)
        if context.pre_joker or (context.main_scoring and context.cardarea == G.play) then
            return {
                chips = -(card.ability.chips / 2) --card.ability.extra.divisor) --card.ability.value_multiplier * self.base.nomimal
            }
        end
    end
}

I tried this and don't work

burnt quartz
#

No, is a seal

daring fern
red flower
long sun
#

what are the primary and secondary colours of a consumable type used for, again?

summer furnace
#

is there a method for getting the suit of a card?
I want to get the suit of a card and save it into a variable, so I can check something later

summer furnace
#

thanks!

daring fern
burnt quartz
zenith sage
#

is is_suit = function(suit, bypass_debuff, flush_calc) valid

daring fern
zenith sage
#

darn

long sun
midnight coyote
#

i don’t use vsc usually

long sun
#

(ignore the loc error)

midnight coyote
#

in an intellij enjoyer

long sun
red flower
# midnight coyote how

i just open the mods folder in vscode, but you can also add it to the lua config i dont recall how exactly

burnt quartz
daring fern
burnt quartz
daring fern
summer furnace
#

is there a possibilty I could have a loop, that does not crash the game?

daring fern
# long sun

I think the primary colour does mostly nothing.

summer furnace
daring fern
burnt quartz
#
calculate = function(self, card, context)
        if context.pre_joker or (context.main_scoring and context.cardarea == G.play) then
            return {
                card.base.nominal = card.base.nominal / 2 --card.ability.extra.divisor) --card.ability.value_multiplier * self.base.nomimal
            }
        end
    end

like that?

daring fern
midnight coyote
burnt quartz
# daring fern Move it outside of the return.
        if context.pre_joker or (context.main_scoring and context.cardarea == G.play) then
            card.base.nominal = card.base.nominal / 2
            return {
                card.base.nominal --card.ability.extra.divisor) --card.ability.value_multiplier * self.base.nomimal
            }
        end
    end```
summer furnace
burnt quartz
#

isn't it necessary?

daring fern
midnight coyote
#

i’m nil checking way more

daring fern
burnt quartz
#

oh, I gonna try

summer furnace
daring fern
summer furnace
#

oh okay thanks!

burnt quartz
#

Dind't work unu

zenith sage
#

how might one implement
function Card:is_suit(suit, bypass_debuff, flush_calc)

snow vale
#

how can i like select the next thing on a list?

#

oh nvm

#

wait

zenith sage
#

ig my question is like

summer furnace
#

So I have this line of code local current_suit = context.other_card.base.suit that crashes my game, why doesn't that work?

zenith sage
#

in the same way as smeared joker

snow vale
#

how can i make lists on lua?

zenith sage
#

like for example spades and hearts are functionally the same

daring fern
zenith sage
#

okay yeah thats what im doing but its not working at all

normal crest
zenith sage
#
function Card:is_suit(suit, bypass_debuff, flush_calc)
    if flush_calc then
        if next(find_joker('Plaid Joker')) and (self.base.suit == 'Hearts' or self.base.suit == 'Spades') == (suit == 'Hearts' or suit == 'Spades') then
            return true
        end
        if next(find_joker('Plaid Joker')) and next(find_joker('Smeared Joker')) then
            return true
        end
        return self.base.suit == suit
    else
        if self.debuff and not bypass_debuff then return end
        if next(find_joker('Plaid Joker')) and (self.base.suit == 'Hearts' or self.base.suit == 'Spades') == (suit == 'Hearts' or suit == 'Spades') then
            return true
        end
        if next(find_joker('Plaid Joker')) and next(find_joker('Smeared Joker')) then
            return true
        end
        return self.base.suit == suit
    end
end
summer furnace
# daring fern Code?
        if G.GAME.current_round.hands_played == 0 then
            if context.before then
                local current_suit = context.other_card.base.suit
                for k, v in pairs({}) do
                    local random_suit = SMODS.change_base(context.other_card, pseudorandom_element(SMODS.Suits, pseudoseed('suits')).key)
                    if current_suit ~= random_suit then
                        break
                    end
                end
            end
        end
    end```
daring fern
normal crest
#

yeah they're tables

#

just number indexed

snow vale
#

wait didnt they start by 0

daring fern
snow vale
#

or am i confusing languages

#

oh ok

zenith sage
#

lua is not 0 index, usually

gentle rain
# snow vale oh so it isnt []

[] is for a certain item in a table, so table[3] would give you the third result in a table
{} is for the table itself

snow vale
gentle rain
#

im only familiar witu lua

snow vale
#

im familiar with python and gmlcode so

#

and now on lua

zenith sage
normal crest
daring fern
zenith sage
#

thank you

gentle rain
# zenith sage how do i hook it instead of overwriting it?
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...

#

guide to function hooking in lua

snow vale
gentle rain
#

🫵

summer furnace
daring fern
summer furnace
#

oooh okay that makes sense

snow vale
#

how are jokers named in things like this? (like j_key_key or any other way)

snow vale
#

i mean

gentle rain
summer furnace
snow vale
#

i meant

#

imma send the whole code idk how to explain it

#
        for i = 1, #G.jokers.cards do
            if G.jokers.cards[i] == card then
                other_joker = card.ability.extra.soul
            end
        end
        if other_joker and other_joker ~= self then
            context.blueprint = (context.blueprint and (context.blueprint + 1)) or 1
            context.blueprint_card = context.blueprint_card or card

            if context.blueprint > #G.jokers.cards + 1 then
                return
            end

            local other_joker_ret, trig = other_joker:calculate_joker(context)
            if other_joker_ret or trig then
                if not other_joker_ret then
                    other_joker_ret = {}
                end
                other_joker_ret.card = context.blueprint_card or card
                other_joker_ret.colour = G.C.bluepring
                other_joker_ret.no_callback = true
                return other_joker_ret
            end
        end```
daring fern
snow vale
#

but with an specific card

#

that you dont necessarily have to have it

daring fern
snow vale
summer furnace
daring fern
daring fern
summer furnace
gentle rain
snow vale
#

no

#

a diff card

gentle rain
#

could you put the effect in plain text please

daring fern
red flower
snow vale
gentle rain
#

:P

daring fern
summer furnace
summer furnace
daring fern
summer furnace
#

no

#

Like for example a pair
the one card gets turned into spades
and the other to hearts

#

but the issue is when randomizing lets say a spades card, it can be turned into a spades card

normal crest
#

how are you randomizing the suit right now

summer furnace
red flower
#

I would make a new table with all the suits except the card's and do a pseudorandom_element on that

summer furnace
summer furnace
#

yea but if I remove if context.before then it still crashes

red flower
#

you need to manually iterate through context.scoring_hand

summer furnace
#

so it works, but not in the intended way, I just tryed it hahahha

It should only randomize the played/scoring card not the entire hand 😭

red flower
#

you still need context.before

#

but idk what you're trying to do exactly, can you explain it again?

summer furnace
#

lets say you are playing a pair with a spade and a heart card
the spade card gets turned into diamonds (it could also get turned into anyother suit except spades)
and the heart gets also turned into diamonds for example (it could also get turned into anyother suit except heart)

red flower
#
if context.before and G.GAME.current_round.hands_played == 0 then
    for _, playing_card in ipairs(context.scoring_hand) do
        local valid_suits = {}
        for key, _ in pairs(SMODS.Suits) then
            if key ~= playing_card.base.suit then valid_suits[#valid_suits+1] = key end
        end
        SMODS.change_base(playing_card, pseudorandom_element(valid_suits, pseudoseed('suits')))
    end
end
#

like this?

summer furnace
#

maybe I'll try it really quickly, but I don't have an idea what the valid_suits[#valid_suits+1] excatly means :/

red flower
#

it appends to the end of the array

summer furnace
#

ok so does it add the suit to the end of the array?

red flower
#

it adds all suit keys in SMODS.Suits to a new array except the one the card has

summer furnace
#

ooooh ok I get it now

#

so the code does nothing now

#

like nothing happens when I play a first hand

red flower
#

uhh maybe the keys are wrong

normal crest
#

you probably have to append value.key instead of the key

#

if they're different at all

red flower
#

i dont think so

#
if context.before and G.GAME.current_round.hands_played == 0 then
    for _, playing_card in ipairs(context.scoring_hand) do
        local valid_suits = {}
        for _, v in pairs(SMODS.Suits) do
            if v.key ~= playing_card.base.suit then valid_suits[#valid_suits+1] = v.key end
        end
        SMODS.change_base(playing_card, pseudorandom_element(valid_suits, pseudoseed('suits')))
    end
end
#

might as well try it

summer furnace
#

btw the second for needs a do, if not it will crash

red flower
#

oh yeah yeah

summer furnace
#

still does nothing :/

#

Should we try again with randomizing it until it is not the same suit?

#

cause I'm confident that that randomizing works, since it worked before

normal crest
#

that code looks fine to me

#

can you share what yours looks like

#

after pasting that in

summer furnace
# normal crest after pasting that in
        if context.before and G.GAME.current_round.hands_played == 0 then
            for _, playing_card in ipairs(context.scoring_hand) do
                local valid_suits = {}
                for _, v in pairs(SMODS.Suits) do
                    if v.key ~= playing_card.base.suit then valid_suits[#valid_suits+1] = v.key end
                end
                SMODS.change_base(playing_card, pseudorandom_element(valid_suits, pseudoseed('suits')))
            end
        end
    end```
red flower
#

idk then lol

#

I would recommend that over re-randomizing but if it doesnt work idk

normal crest
#

me neither, make sure you saved the file, restarted your game and started a new round

red flower
#

do you have debugplus

summer furnace
summer furnace
normal crest
summer furnace
#

nope will get it now tho

red flower
#

i was going to ask you to print(valid_suits)

#

you can do it without that but debugplus makes it nicer

summer furnace
#

Now I have it

red flower
#

add print(valid_suits) after change_base

normal crest
#

and wrap the change_base call with assert()

summer furnace
normal crest
#

assert(SMODS.change_base etc etc)

summer furnace
#

it sayed tryed to call something

normal crest
#

Did the game crash

summer furnace
#

no

red flower
#

can you press / and screenshot the message

summer furnace
#

how can I look at the message longer

#

uuuh

#

funny story

#

/ does nothing 😭

red flower
#

i think your pc is cursed

summer furnace
#

yea it might be

normal crest
#

/ should open the console

red flower
#

there should be a key that opens the console

hushed field
#

alt or shift / if your settings are set up that way, no?

summer furnace
#

so / I am doing with shift 7

normal crest
#

nope that doesn't work

#

do you have a numpad

summer furnace
#

yes

normal crest
#

it should have a / key on top

#

try using that

summer furnace
#

oh yea now it works

normal crest
#

oh funny story, pseudorandom_element returns two values

#

the value and the position

summer furnace
#

😭

normal crest
#

do local suit = pseudorandom_element blah blah before the change_base call

#

and just pass suit to the change_base function

red flower
#

it should give you the first value regardless

normal crest
#

yeah but 1 is not a valid rank

red flower
#

oh yeah

normal crest
#

so it's complaining

red flower
#

you need to do , nil