#💻・modding-dev

1 messages · Page 693 of 1

silk latch
#

Each played card of (the most prevalent suit in the deck) gives (1+0.1N)x Mult when scored, where N is the number of cards in that suit.

naive coral
#

how can i detect the editions and stickers of jokers, and then remove/ shuffle said stickers and editions?

daring fern
# silk latch Each played card of (the most prevalent suit in the deck) gives (1+0.1N)x Mult w...
if context.individual and context.cardarea == G.play then
    local suits = {}
    for k, v in pairs(G.playing_cards) do
        for kk, vv in pairs(SMODS.Suits) do
            if v:is_suit(vv.key) then
                suits[vv.key] = (suits[vv.key] or 0)+1
            end
        end
    end
    local suit, count = 'Spades', 0
    for k, v in pairs(suits) do
        if v >= count then
            suit, count = k, v
        end
    end
    if context.other_card:is_suit(suit) then
        return {xmult = 1+(0.1*count)}
    end
end
real estuary
#

how do i make custom ui for a watermark for a demo of my mod? [i need full script thx]

shell timber
silk latch
#

okay cool also had to fix the localization shit being wrong and now it's good to go

#

might nerf it to 0.05x per ngl

daring fern
# naive coral how can i detect the editions and stickers of jokers, and then remove/ shuffle ...
local modifiers = {}
for k, v in pairs(G.jokers.cards) do
    if v.edition then
        table.insert(modifiers, {edition = true, key = v.edition.key})
        v:set_edition(nil, true, true)
    end
    for kk, vv in pairs(SMODS.Stickers) do
        if v.ability[vv.key] then
            table.insert(modifiers, {sticker = true, key = vv.key})
            v:remove_sticker(vv.key)
        end
    end
end
pseudoshuffle(modifiers, 'seed')
for k, v in pairs(modifiers) do
    local eligible_jokers = {}
    for kk, vv in pairs(G.jokers.cards) do
        if (v.edition and not vv.edition) or (v.sticker and not vv.ability[v.key]) then
            table.insert(eligible_jokers, vv)
        end
    end
    if next(eligible_jokers) then
        local joker = pseudorandom_element(eligible_jokers)
        if v.edition then
            joker:set_edition(v.key)
        end
        if v.sticker then
            joker:add_sticker(v.key, true)
        end
    end
end
silk latch
#

Why the fuck is this here? I set its weight to 0. (This is supposed to be a Challenge-exclusive version of another Joker.)

frosty rampart
#

per-object weights only work if you enable the optional feature
add this to your mod (just in the main lua file or whatever)

SMODS.current_mod.optional_features = {
  object_weights = true
}
white zinc
#

i'm looking into global variable shenanigans and one modpack i'm seeing has their global variables and functions all in a functions.lua file. is having a separate file for global variables necessary or can i just define them in a standard joker.lua file?

formal rock
#

oh sweet

daring fern
real estuary
white zinc
gilded blaze
#

no

#

you can put just about anything

#

even non-existent values, in which case it gives nil in the description

white zinc
#

second question, i'm trying to have some variables that are just for the description of the card and i'm getting errors when i try to do this (it's the commented out lines). where should i instead do the arithmatic so that it doesn't throw an error?

stiff locust
#

the code in loc_vars runs when the joker is hovered over

gilded blaze
#

you were trying to execute code inside table definition, which doesn't work of course

white zinc
#

would this work then?

daring fern
gilded blaze
#

ah, you mean num_inc and denom_inc, which lua consider globals instead

white zinc
gilded blaze
# white zinc update: no, they're showing as `nil` values
loc_vars = function(self, info_queue, card)
    card.ability.extra.num_ex = card.ability.extra.num_inc + 1
    card.ability.extra.denom_ex = card.ability.extra.denom_inc + 4
    return {vars = {card.ability.extra.num_ex, card.ability.extra.denom_ex}}
end
#

yea, you got the wrong idea when I said you can put anything

white zinc
#

so in this case, i do need to use the card.ability.extra prefix?

gilded blaze
#

anything works, even globals
for local storage inside the card, refer to card.ability

#

stuff in config (prototype values) gets copied over to card.ability (modifiable values)

white zinc
gilded blaze
#

ah, I forgor

#

the return values were remnant code from my previous interpretation

#

there, try again

white zinc
#

i still have nil values in the description

gilded blaze
#

oh wait

#

are the values related to probability

white zinc
#

yeah

gilded blaze
#

yikes, the above code would not respond to SMODS' probability mechanic

white zinc
#

ahh

#

i'm gonna try putting the arithmatic calculations in the set_ability function, maybe that'll work?

gilded blaze
#

set_ability is called once upon card creation

white zinc
#

so that wouldn't work then?

gilded blaze
#

keep it in loc_vars

#

when changes are made in calculate, just update the values again

near coral
#

Is it worth the effort to make only the rekoj inside grade 10 to have the edition visual applied if possible

gilded blaze
#

is it a separate draw layer

#

then it wouldn't be so hard to do

#

another DrawStep should easily do it

dawn knoll
#

my enhancement doesn't give Xchips when in hand, even though it's supposed to do that, can someone help?

daring fern
dawn knoll
#

ah ok

knotty wren
#

how can I remove enhancements and seals from cards held in hand after pressing play, for a blind qwq

white zinc
#

does doing get_suit() on a wild card always return "true" or does it only return true if the original card was that suit?

near coral
#

I'm trying to make the base blind size scale slower so that on ante 8 the base is 25,000 but it didn't work

#

The base is 570 on ante 8 rn

#

Which is definitely not what I wanted

#

Is the (G.GAME.modifiers.scaling or 1) - 0.5 the wrong move

gilded blaze
# knotty wren how can I remove enhancements and seals from cards held in hand after pressing p...
press_play = function(self)
    G.E_MANAGER:add_event(Event({func = function()
        local triggered = false
        for _, v in ipairs(G.hand.cards) do
            local has_modifier = false
            if v.config.center.key ~= 'c_base' then
                triggered = true
                has_modifier = true
                v:set_ability('c_base', nil, true)
            end
            if v.seal then
                triggered = true
                has_modifier = true
                v:set_seal()
            end
            if has_modifier then
                G.E_MANAGER:add_event(Event({func = function()
                    v:juice_up()
                return true end }))
            end
        end
        G.GAME.blind.triggered = triggered
    return true end}))
    return true
end
near coral
daring fern
daring fern
white zinc
#

G.hand is all the cards held in hand, right? if i have a joker that does money calculations at the end of round (akin to golden joker, delayed grat, e.g.), does G.hand still work?

daring fern
white zinc
#

oof

near coral
white zinc
#

thanks

red flower
#

you can save the number in context.end_of_round and then use it later to give the money

near coral
#

John saga I request assistance

naive coral
#

whats an easy solution here to prevent this jokers from "eating" an edition when it randomizes the editions of cards

near coral
naive coral
#

not quite what i did, but got it working so it doesnt matter

white zinc
#

apologies for my very uncondensed coding, but i'm running into an issue where it seems my variable card.ability.extra.largest always is 0 when i get to the money calculation. i'm thinking it's either a syntax issue, a variable issue, or a flaw in my logic

white zinc
#

hooray, thank you

#

G.hand is just the area, and G.hand.cards is referring to the cards themselves

#

i'm learning lol

karmic prism
#

So I'm currently trying to make a custom back. When I start a run with it, the blinds don't pop up so the game is softlocked. I'm guessing the problem is with the events I'm trying to have happen. The consumable I want is also not appearing. Do I need to add an event for that as well?

red flower
#

without opening the file i guess the event doesn't return true

#

opening the file i see the event doesn't return true :3

karmic prism
#

what does that mean

#

am I missing a line on the event?

#

sorry

red flower
#

yes, the function of the event should return true

#

if it doesn't then it keeps running

karmic prism
#

oh that makes sense

#

thank you

#

yep sure enough adding the line worked.

#

thanks again

gilded blaze
near coral
#

John saga of sagatro

#

Help

knotty wren
graceful storm
#

ok so for context:
i have no idea what im doing
i am literally using jokerforge as a base cause i dont know what im doing
ive never touched coding like properly ever

anyway why is this destroying all the jokers instead of just one

stiff locust
#

i am literally using jokerforge as a base cause i dont know what im doing
i ould

#

would heavily recommend you do not do this

#

jokerforge's code uses so many unneeded redundancies because of its nature

graceful storm
#

a h

stiff locust
#

it teaches bad practice

sturdy compass
graceful storm
#

alright good thing it was caught ahead of time

stiff locust
#

vanillaremade s a great resource for code references

#

but you can just look at other mods' code

sturdy compass
#

VanillaRemade is also great

graceful storm
#

yeah fair

#

time to just learn shit lmao

sturdy compass
#

Yup lol

stiff locust
#

it's pretty easy to pick up

sturdy compass
#

It is, Lua is a very good beginner language, and Balatro is an easy game to mod relative to other games

timid zinc
#

Give a modder a jokerforge and they code a joker for a day

stiff locust
#

teach a modder to code and they make jokerforge

karmic prism
#

should I be using events or the initial_deck function to reduce the number of starting cards in a deck?

sturdy compass
#

Probably initial_deck

karmic prism
#

ok so if i wanted to remove an entire suit what would that look like?

#

would it be
initial_deck = {
suits = {'Heart'},
exclude = true
},

sturdy compass
#

That looks right aside from “Hearts” needing to be plural

karmic prism
#

ah yes I've since fixed that

#

hmm when I run it like this the deck still contains all suits

sturdy compass
#

Where is your initial_deck being set? It shouldn’t be in a function or anything, it should just be an attribute of your SMODS.Back, much like a config table

karmic prism
sturdy compass
#

Hm yeah that does look right

#

Your SMODS is up to date too, right?

karmic prism
#

I'll check

#

ah that could be the issue I'm still running beta 1620

sturdy compass
#

Hmm no that’s the latest release

#

How odd

karmic prism
#

well next I'll disable other mods

#

thank you for helping make sure my formatting was correct

sturdy compass
#

👌

karmic prism
#

your beginner video guides were also most helpful

sturdy compass
#

Very glad to hear people are getting the most out of those. I really need to get onto adding more episodes, this damn event mod just been taking up too much of my time lol

karmic prism
#

ok I disabled everything and it still doesn't work but it's pretty late I'll try more tomorrow

narrow prawn
#

still no clue how to change the blind icon

#

i can change it if i reload the blind

#

but its always one off

#

and i can never change it back to the original

#

i removed the code because it didnt work but

#

like

#

i cant figure ts out

#

😭

wispy falcon
#

bump

narrow prawn
#

Is there a way I could do a “take “ feature like how there is in cryptid

#

In booster packs

clever lily
#

how do i make these things appear

solemn wharf
#

hi i was making a joker that transforms into another joker and it gets a flip animation in between, the thing is that i wanted to make the joker stay flipped during like 2 secs how could i do it?

#

this is what i have now

fading rivet
gilded blaze
# solemn wharf this is what i have now

use events

if context.after then
    local percent = 1.15 - (1 - 0.999) / (1 - 0.998) * 0.3
    G.E_MANAGER:add_event(Event({ -- flip to back
        trigger = 'after',
        delay = 0.15,
        func = function()
            if card.facing == "front" then
                card.genuine_flip = true -- flag to indicate this flip belongs to this effect
                play_sound('card1', percent)
                card:juice_up(0.3, 0.3)
                card:flip()
            end
            return true
        end
    }))
    G.E_MANAGER:add_event(Event({ -- transform
        func = function()
            card:set_ability('j_pjok_elevado')
            card:set_cost()
            SMODS.calculate_effect({message = localize('k_transform') --[[you used hardcoded text in non-English, which isn't recommended]], sound = 'pjok_elevado_sound', instant = true}, card)
            return true
        end
    }))
    G.E_MANAGER:add_event(Event({ -- flip to front
        trigger = 'after',
        delay = 0.15,
        func = function()
            if card.genuine_flip then -- check the flag instead of card.facing
                card.genuine_flip = nil
                card:flip()
                play_sound('tarot2', percent, 0.6)
            end
            return true
        end
    }))
end
solemn wharf
#

im not really used to work with events

#

thanks :)

solemn wharf
#

okay i customized a little bit and its woking perfectly!! thanks again!!

daring heron
#

havent modded in a while, how do i load all the files from a specific folder?

#

in my case a "decks" folder

red flower
#

check the bottom of that question

clever lily
#

which is lua but in roblox studio

versed swan
#

Assuming you're using VSCode or a derivative of it, you'll need to install the Lua extension by sumneko

#

I think

graceful storm
#

its been about an hour since i started trying to learn modding and its not even showing my mod in balatro let alone the mod launcher i use

#

🥹

#

what did i do wrong....

red flower
graceful storm
#

yes

red flower
#

can you post it

graceful storm
#

maybe im just missing something idk

red flower
#

hmm can you post the latest log in lovely/log

graceful storm
#

uh sure lemme

#

how do i do that

red flower
#

Mods/lovely/log look for the one with the latest date

graceful storm
red flower
#

it says the description is wrong

#

try removing the ' ?

graceful storm
#

oh ok

#

..

#

OH

#

IM DUMB

#

i misspelled description

red flower
#

ah lol

graceful storm
#

LMAOO

red flower
#

didnt notice

graceful storm
#

okay NOW it appears

#

the fact i went that long without noticing is a crime

#

yayyyy it work

#

and the custom icon too

knotty wren
#

I tried making a fortune teller for spectral cards and it upgrades and adds the chips but it doesn't score, I used the fortune teller code for the base but idk qwq

clever lily
#

i downloaded it now

red flower
clever lily
#

oh wait i didnt know vanilla remade adds the library for smods too

red flower
#

smods adds the library for smods, vanillaremade has a guide

clever lily
#

i was a little too lazy to set it up

knotty wren
#
        name = "Mermaid",
        text = {
            "{C:chips}+20{} chips per {C:chips}spectral{}",
            "cards used this run",
            "{C:inactive}(Currently {C:chips}+#1#{C:inactive})"
        }
    },
    calculate = function(self, card, context)
        if context.using_consumeable and not context.blueprint and context.consumeable.ability.set == "Spectral" then
            card.ability.extra.chips = card.ability.extra.chips + card.ability.extra.chip_mod
            return {
                message = localize('k_upgrade_ex'),
                colour = G.C.CHIPS
            }
        end
        if context.joker_main then
            return {
                chips = card.ability.extra.chip_mod * (G.GAME.consumeable_usage and G.GAME.consumeable_usage.spectral or 0)
            }
        end
    end,```
red flower
#

chips = card.ability.extra.chips

knotty wren
#

will that account for spectrals used before buying the joker?

daring heron
#

how would i make a deck that selects 13 random cards and turn them into a (weighted) random edition?

#

and with weighted i mean like the wheel

knotty wren
red flower
#

i think it is G.GAME.consumeable_usage_total.spectral

#

but then you need to not scale a value

red flower
daring heron
#

the part where i make the deck lmfao

#

i pretty much forgot all the previous knowledge i had

red flower
#

well im not making it for you, i can point you out to guides depending on the speficic knowledge youre lacking

mystic river
#

apply = function for i,v in g deck cards do v: set edition(poll edition{guaranteed = true})

something shaped vaguely like that

red flower
#

like do you know how to make a basic deck

daring heron
#

i guess yeah

mystic river
#

(that is not valid Lua syntax do not copy paste that)

daring heron
#

mostly it's the card selection and editioning along with the formatting of the code

slim ferry
#

is there like an easy way to hook functions for boosters with take_ownership_by_kind like with regular taking ownership

#

also just to be sure take_ownerships run after other injection right

daring heron
#

for the editioning i could just use wheel's code probably but idk how to rngselect

daring heron
#

how do i make the random weighted for the editions?

#

or is it already

white zinc
#

this bit of code is giving me some trouble. when a joker is added, i want to iterate through all the jokers in your possession and give them the eternal tag. i think the problem is with my for loop because i'm not doing anything with the jokers variable at the moment

slim ferry
#

because youre checking for two contexts that dont happen at the same time

#

context.check_eternal is unrelated to actually applying the sticker

knotty wren
red flower
slim ferry
red flower
white zinc
knotty wren
#

oh, just tried it with a spectral, you're right

#

but then shouldn't "or 0" fix it?

red flower
red flower
knotty wren
red flower
#

show code and log

daring heron
#

what do the letters here mean?

#

in checkered deck remake

red flower
#

key, value

#

key is a number in this case while value is the card

#

i should give them better names and use ipairs, i think thats just copied from vanilla

knotty wren
white zinc
#
            for _, jokers in pairs(G.jokers.cards) do
                if context.check_eternal == true then
                    jokers:add_sticker("eternal", true)
                end
            end
        end```

it's still not working. and just fyi i do know that check_eternal just checks whether a joker CAN have an eternal sticker, not if it currently does
#

card_added is the correct context though, right?

slim ferry
# knotty wren

consumeable_usage and consumeable_usage_total are two different values

#

youre checking for the former when you should be checking the latter

slim ferry
#

its for checking when a joker is being checked if its considered eternal

#

which is not relevant here

#

i forget whats used for checking sticker compat though

daring heron
# red flower

so how would i make this only select 13 to convert?

red flower
slim ferry
#

that works

#

i recall there being a function though

red flower
red flower
#

on what

daring heron
#

i have no idea what you said

red flower
#

do you know what a table is

clever lily
#

how do i check if the joker is a specific joker

daring heron
#

kinda

#

not in lua

clever lily
#

like if its brainstorm it do the thing

slim ferry
red flower
daring heron
#

kinda

#

in code yes but not specifically in lua

red flower
#

ok in code works, do you know what is an array index

#

like array[i]

knotty wren
daring heron
clever lily
#

it is right

slim ferry
#

yeah

#

its j_brainstorm for brainstorm iirc

red flower
# daring heron ok yeah i do

well G.playing_cards is an array with indices 1 to 52 for all the cards (at the start without modifying the deck)
you can pick 52 different numbers that correspond to 52 different cards

#

so you want 13 of those

daring heron
#

yep

red flower
#

what's the part that you're having problems with then?

daring heron
#

lua formatting

red flower
#

what does that mean

#

how to pick a random number?

daring heron
#

yeah

red flower
#

i gave you a link?

daring heron
#

right

red flower
daring heron
#

am i stupid 🥀

#

i know i did smth wrong but i have no idea what

red flower
#

you are missing a couple of ends

gusty compass
#

Looks like it's missing a few ) too I can't help but notice

white zinc
#

jokers.joker.config.center.eternal_compat?

red flower
#

no, just jokers.config.....

daring heron
#

like this?

red flower
#

because you have parentheses without closing for the event

gusty compass
#

There's a missing in keyword I'm pretty sure

red flower
#

oh yeah

gusty compass
#

Before ipairs

#

Also I was gonna ask how would I go around to disable cards from scoring via a joker

daring heron
#

like this?

red flower
gusty compass
#

Yea

slim ferry
#

do packs default to using vanilla Card:open or whatever if the create_card function exists but return nothing

gusty compass
#

Antisplash

red flower
daring heron
#

ok wait i added another } after end and now there's no errors

#

so this would make all clubs have an edition right?

red flower
slim ferry
#

okay so

#

how can i make packs run the original thing anyway

#

after take ownership does its thing with the function

gusty compass
#

Or something along the lines

red flower
#

are my links broken

gusty compass
#

?

red flower
#

why did the two of you read the thing below the thing i linked too

#

cebee too

gusty compass
#

I mean you sent calculate functions

red flower
#

this one

daring heron
#

i read past it lol my bad

gusty compass
#

Oh

#

Yea I think that was on my end mb

white zinc
#
            for _, jokers in ipairs(G.jokers.cards) do
                --if jokers.config.center.eternal_compat == true then
                    jokers:add_sticker("eternal", true)
                --end
            end
        end```

alright, i found the source of my issue. even with the eternal_compat filter removed, the code never seems to run the loop. or if it does, it's not giving the stickers. do i just have my for loop set up wrong?
red flower
#

that looks correct to me

#

can i see the rest of the code

white zinc
knotty solstice
#

I'm making a thing that optimizes retriggers by instead of executing each retrigger individually it only executes one and then the values are multiplied by the amount of retrigger
the way I'm doing it currently for card retriggers(example: hanging chad) is checking context.other_card and adding the last retriggers of that card to the current joker
could checking only for context.other_card for adding the retriggers glitch something?

red flower
# white zinc

just to be sure, you want all jokers to be eternal with this card is bought/added?

#

or when any card is added

white zinc
red flower
#

ah ok

#

then idk it looks fine

white zinc
#

OHHHH

#

I JUST FIGURED IT OUT

#

when you buy a joker, it's not included in the set

#

so i'll need to include that newly bought joker in with the set

red flower
#

yeah, you can also use an event

white zinc
#

should i just put my whole loop in an event then?

red flower
#

yes

daring heron
#

well this doesnt work

white zinc
#

omg yessss finally

#

thank you for your help

daring heron
#

just trying to make it apply editions rn

#

nvm i got it

#

your sources lied to me smh my head

red flower
#

no

daring heron
#

it said card:set_ability which crashed

red flower
daring heron
#

playing_card:set_ability worked tho

red flower
#

i linked to that

red flower
#

card is a generic name

daring heron
#

i read the wrong thing 😭

red flower
#

it would be whatever name you give the variables

white zinc
#

does context.buying_card only trigger if it's bought from the shop? if this card were to be spawned randomly via tarot card, would it go off?

red flower
#

no, thats what card_added is for

white zinc
#

ahh, i imagine adding in a card via debug mode wouldn't trigger card_added then lol

red flower
#

i think it does

daring heron
#

can i add a line break to the deck name in localization?

red flower
#

im pretty sure yes

red flower
#

lol

gusty compass
daring heron
gusty compass
#

alr

#

thanks

daring heron
#

so what should i do then, just give it a different name?

red flower
#

i can probably make that work on smods

#

but i dont promise it will be soon

daring heron
#

no worries

#

ok so uhh

#

when i select the deck it doesnt let me play once i start the run

mystic river
#

the event has to return true, otherwise it runs again next frame

daring heron
#

oh i see

#

well now it only enhances the 2,.

#

i can figure this out

#

surely

karmic prism
#

anyone know why this doesn't remove suits from a deck?
initial_deck = {
suits = { 'Clubs', 'Hearts', 'Spades', },
exclude = true
},

daring heron
#

i did it :D

#

how do i remove the sound from it editioning the cards tho?

red flower
karmic prism
#

oh like all caps?

red flower
#

i think i fixed the docs yesterday

mystic river
red flower
mystic river
karmic prism
#

ooooh

red flower
#

i just thought about it

karmic prism
#

that worked thank you so much :)

red flower
#

honestly, i will just make smods take both

daring heron
red flower
#

i think that the uppercase one is weirdly inconsistent

mystic river
#

don't recall offhand, check the function definition
in the vanilla code, probably, unless smods hooks it

red flower
daring heron
#

ok now how do i make it select 13 random cards instead of only clubs

mystic river
#

there's nothing built-in for this, but what i'd do is pick 13 unique random numbers from 1 to #G.playing_cards and then check if the index variable is equal to any of those numbers

#

(the index being the underscore in for _,playing_card in ipairs, i would rename this since you're actually using it now)

daring heron
#

huh so what do i do?

red flower
#

you got explained the same thing by two different people, if you want more guidance you will need to be more specific

#

or do you just want it coded for you

daring heron
#

can i have some more guidance

#

also i'm sorry if i'm a little- stupid for a lack of better words

red flower
#

i dont mean specific about wanting guidance lol, i mean specific at what you're confused about

daring heron
#

not sure how to code the random cards thing

red flower
#

i can gather that

#

did you understand how to get a random number

daring heron
#

i think so yeah

#

holdon lemme try smth

#

this deck wouldnt need any loc_vars right?

#

are those just for tooltips?

frosty rampart
#

i do think this is something you should take a crack at on your own first, a very important part of writing code is being able to break down a big task like this into smaller subtasks and then write the code for each block

frosty rampart
daring heron
#

yeah i'll try, i'm just confused sometimes on what specific things mean

daring heron
frosty rampart
#

ye

daring heron
#

alr thanks

#

then how do i access loc_vars in the description?

#

nvm got it

daring heron
#

no idea where to start lol

frosty rampart
#

first step would be to, as mynty said, pick 13 random numbers and make sure they're all different from each other

clever lily
daring heron
#

i uh,. dont know how to do that actually

#

i could probably make it pick 13 random numbers but idk how to make it so theyre all different

#

yeah no i have no idea how to start lol

#

not sure if someone writing it for me and then me reading through it to understand would help

#

i feel like to do this i could make an array with all cards, and then pull 13 from them

#

though i have no idea how to actually translate it into code

red flower
#

this is how i would so this

G.E_MANAGER:add_event(Event({
    func = function()
        local all_cards = SMODS.shallow_copy(G.playing_cards)
        for i = 1, 13 do
            local chosen_card, chosen_index = pseudorandom_element(all_cards, "seed")
            if chosen_card then
                local random_edition = SMODS.poll_edition({ key = "modprefix_seed", guaranteed = true, no_negative = true } )
                chosen_card:set_edition(random_edition, true, true)
                table.remove(all_cards, chosen_index)
            end
        end
        return true
    end
}))
daring heron
#

remade my (very) old code which got me this

#

can i ask what a shallow copy is?

red flower
#

copies the table without copying the tables inside

#

basically so you dont remake the cards inside G.playing_cards

#

exactly like this loop you have

daring heron
#

neat

#

thanks for the help!

#

sorry if i was difficult to work with lol i still have a long way to go

clever lily
#

oh wait

#

its 1 not r_common

#

i think

red flower
#

G.jokers.cards[i]:is_rarity("Common")

#

or :is_rarity(1) also works

wispy falcon
#

bump

brittle yacht
#

EXTREMELY IMPORTANT BUMP

rare minnow
#

How do you code decks?

mystic river
rare minnow
#

So, why won't this work? Doesn't crash the game, just doesn't show up

fading rivet
#

is the file loaded

rare minnow
#

What does that mean again?

fading rivet
#

something like that

rare minnow
fading rivet
#

your main file

red flower
fading rivet
#

oh yeah that page exists

rare minnow
#

Thanks

brittle yacht
#

would a modded pool with vanilla jokers look like this?

SMODS.ObjectType {
    key = 'lennypool',
    default = 'seltzer',
    cards = {'seltzer', 'diet_cola'},
    inject = function(self)
        SMODS.ObjectType.inject(self)
    end,
}```
frosty rampart
#

it also has to be j_selzer because thunk moment

brittle yacht
#

ight

#

local joker_card = SMODS.add_card({ set = 'shit_lennypool' })
so this would look like this?

#

if i wanted to create one of the two jokers?

daring fern
brittle yacht
#

oh ight

brittle yacht
# daring fern No, `SMODS.ObjectType`s don't have mod prefixes.
    key = "lenny",
    config = {
        extra = {
        }
    },
    loc_txt = {
        ['name'] = 'Lenny Leonard',
        ['text'] = {
            [1] = 'If {C:attention}Glass Card{} breaks in {C:legendary}The Eye{}{} {C:attention}Boss Blind{},',
            [2] = 'Create a {C:dark_edition}Negative{} {C:attention}Diet Cola{} or {C:attention}Seltzer{}.',
            [3] = '',
            [4] = '{C:inactive,s:1.2}(Ow my eye, I’m not supposed to get {C:attention,s:1.2}[Glass Card]{}{C:inactive,s:1.2} in it!){}'
        },
        ['unlock'] = {
            [1] = 'Unlocked by default.'
        }
    },
    pos = { x = 0, y = 0 },
    cost = 20,
    rarity = 4,
    blueprint_compat = false,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = true,
    atlas = 'lennybg',
    pools = { ["shit"] = true },
    soul_atlas = 'lenny',
    soul_pos = { x = 0, y = 0 },
    in_pool = function(self, args)
        return (
            not args 
            or args.source ~= 'sho' 
            or args.source == 'buf' or args.source == 'jud' or args.source == 'rif' or args.source == 'rta' or args.source == 'sou' or args.source == 'uta' or args.source == 'wra'
        )
        and true
    end,
    
    calculate = function(self, card, context)
        if context.remove_playing_cards  then
            if SMODS.get_enhancements(removed_card)["m_glass"] == true and to_big(G.GAME.blind.config.blind.key) == to_big("bl_eye") then
                return {
                    func = function()
                        
                        if #G.jokers.cards + G.GAME.joker_buffer < G.jokers.config.card_limit then
                            G.GAME.joker_buffer = G.GAME.joker_buffer + 1
                            G.E_MANAGER:add_event(Event({
                                trigger = 'after',
                                delay = 0.4,
                                func = function()
                                    play_sound('timpani')
                                    SMODS.add_card { key = "shit_lennypool" }
                                    card:juice_up(0.3, 0.5)
                                    return true
                                end
                            }))
                        end
                        return true
                    end
                }
            end
        end
    end
}```

im having issues is there something wrong with it
#
SMODS.ObjectType {
    key = 'lennypool',
    default = 'j_seltzer',
    cards = {'j_seltzer', 'j_diet_cola'},
    inject = function(self)
        SMODS.ObjectType.inject(self)
    end,
}```
daring fern
brittle yacht
#

ight

brittle yacht
#

with the m_glass

rare minnow
#

Does anyone know why my deck won't show the text?

frosty rampart
#

not "Backs" plural

rare minnow
frosty rampart
#

could you post your full localization file

fading rivet
frosty rampart
#

i mean just post the file lol
anyway the Back table is supposed to go inside the descriptions table, it's currently coming after it

rare minnow
fading rivet
#

no 😭

rare minnow
#

it works though

fading rivet
#

how???

#

have you played it yet

rare minnow
#

I tried it, it works

red flower
#

it doesnt

#

the config does the thing

rare minnow
#

oh

red flower
#

the apply is ignored

rare minnow
#

my bad

#

So just get rid of the {{?

red flower
#

yeah

rare minnow
#

ok

red flower
#

maybe you confused the vanillaremade comments?

#

the --[[

rare minnow
#

oh, yeah, that's it

red flower
#

yeah thats just to comment it out

rare minnow
#

Oh, that makes more sense

silk latch
#

does a higher weight number make an item rarer or more common?

fading rivet
#

common

silk latch
#

this crashes with Cryptid's consumable-ized cards, seemingly due to the can_use function not properly accounting for the consumable itself being a playing card but I don't know how to do that

#

and the crash log from trying to use it on itself (which is the only thing it allows in that context)

daring fern
white zinc
#

does context.joker_type_destroyed refer just to destroying or does it also happen when a joker is sold?

fading rivet
#

and it also checks consumables

white zinc
#

so if i wanted to know if a joker got sold or destroyed, i'd have to use 2 different contexts then

fading rivet
#

yes

#

and a check that its a joker

white zinc
#

ok gotcha

white zinc
daring fern
white zinc
#

if i want to check if the card being sold or destroyed is itself, would using context.card work for that?

fading rivet
#

check the wiki

white zinc
#

the wiki says it should, but i'm a bit confused as it seems context.card is listed a lot

fading rivet
#

oh wait i misread that

#

got selling use context.selling_self

white zinc
#
            if card.ability.set == 'Joker' then
                if context.card ~= true and context.selling_self ~= true then
                        G.jokers:change_size(1)
                        card.ability.extra.extra_slots_given = card.ability.extra.extra_slots_given + 1
                end
            end
        end```

i have this right now, however, it seems that it is ignoring the selling self and context.card line
#

i think i'm just using these incorrectly

frosty rampart
#

context.card is never true, because it's either a table or nil
instead of checking something ~= true you should just do not something

daring fern
near coral
knotty wren
#

is there a way to determine what boss blinds can appear on a challenge

#

like only the debuff bosses (example)

sturdy compass
#

You can disable all other blinds if need be

knotty wren
#

how ; 0 ;

sturdy compass
#

Basically lol

white zinc
#

what's the best way to move a card from one card area to another? for example, i have a card in G.hand that i want to move to G.discard

torn thunder
#

isn't it G.hand:emplace ,? I haven't mod in a while

proper swan
#

the joker crashes the game when it triggers

#

did i put the joker key in right?

torn thunder
#

get rid of the square brackets

#

And the parenthesis

daring fern
proper swan
torn thunder
white zinc
proper swan
#

this happened when i started a run with a deck i made

daring heron
#

what do yall name objects you don't have a name for yet?

#

in my case a deck

daring heron
#

could i somehow pull the 8 here into a loc_vars so i can access it in the description?

daring fern
daring heron
#

for some reason every time i start up balatro it doesnt save my progress

fading rivet
real estuary
#

just a question but uhhh

#

how do i make high res textures in balatro for a texture pack

torn thunder
#

high resolution textures r just the original ones upscale from 71x95 to 142x190 no changes

#

and they go into 2x folder instead of 1x

daring heron
#

why doesnt this work?

#

trying to make a deck with only these ranks

red flower
#

initial_deck = { Ranks = { 2, 3, 4, 5, 6 } }

#

the ranks might need to be strings im not sure

daring heron
#

and how do i add aces to that list?

#

is it just ace?

red flower
#

"Ace"

daring heron
#

ok well now i have a deck with no cards

red flower
daring heron
#

how do i make them strings

#

nvm got it

vale grove
#

iam trying to make baseball card but instead of uncommon jokers its for a custom pool of jokers i have, how do i check if a joker is in my pool?

red flower
vale grove
red flower
#

no

#

it can be ["yourpoolname"] but it's the same thing

vale grove
#
attempt to index global 'joker' (a nil value)"
```that gives this error tho
red flower
#

joker was a generic name i gave the joker object you need whatever is called in the place you are using it

#

i assume context.other_joker

vale grove
#

yes

#

i thought you meant it as an and

#

like context.other_joker and that line

red flower
#

yes that's what i meant

#

but i didn't want to assume the context you were using

vale grove
#

so its pretty fair to assume if you ask me

red flower
#

why are you arguing with me on this 😭

vale grove
#

im not

#

im just saying i think its fair to assume when im giving you context yk?

red flower
#

ok?

viscid talon
#

my localisation isnt fully working and im unsure how to fix it

#

jokers work fine, as do decks and blinds and such

#

its just the consumables specifically where it falls apart

#

the consumables themselves are fully functional, it looks like the file isnt calling to the correct localisation is all

#

its the same for divine cards

viscid talon
#

trying this again and it doesnt work lol

#

im so dumb

#

yippee

viscid talon
#

how do you remove the edition off a card

#
        if context.end_of_round and context.game_over == false and context.main_eval then -- Devolution
            if card.ability.extra.energy <= 0 then
                G.E_MANAGER:add_event(Event({                                             -- Devolve Effect
                    trigger = 'after',
                    delay = 0.4,
                    func = function()
                        local evolution = card
                        play_sound('timpani')
                        card:set_ability("j_hatch_hatchet") -- The Original Joker
                        card:set_edition()
                        card:juice_up(0.3, 0.5)
                        return true
                    end
                }))
                return { -- Devolve Message
                    message = "Reverted!",
                    colour = G.C.BLUE
                }
            else -- Losing Energy...
                card.ability.extra.energy = card.ability.extra.energy - 1
                return {
                    message = "Losing energy...",
                    colour = G.C.BLUE
                }
            end
        end
    end
})
maiden phoenix
viscid talon
#

o oke

faint yacht
#

function copy_card(other, new_card, card_scale, playing_card, strip_edition)

viscid talon
#

oke

knotty wren
#

why no name, why name error qwq

dapper sun
#

please use a localization file instead

slim ferry
#

label string missing

#

but also yeah thats probably a good idea

dapper sun
#

oh you can do that

slim ferry
#

loc_txt lets you do like pretty much all text thats required

dapper sun
#

i was gonna say once you use a loc file you can put it at misc.labels.modprefix_devour_seal = "Devour Seal"

knotty wren
#

what's this mean?

#

I tried to add a spectral card

devout rain
knotty wren
#

nvm fixed it

knotty wren
#

aight

#

i don understan

rigid solar
#

devour_seal isnt the seal's key

#

you're missing the mod prefix

knotty wren
#

eeaauuhhhh

#

I see

rigid solar
#

and _seal after (unless in the seal's definition you just put "devour" as the key)
like modprefix_sealkey_seal

knotty wren
#

if the mod id is MarMod how do I add the prefix?

#

is it just that?

rigid solar
#

it's whatever you put there in your json

knotty wren
#

it crashed still

#

qwq

viscid talon
#

Blue Card: Gain +50 Chips if no purchases are made in shop.
how would i track if there are no purchases made in shop

rigid solar
#

like the code

knotty wren
#

I can spawn it using ctrl-e on debugplus

#

and it works

rigid solar
#

then idk 😶

knotty wren
#

is it prefix_ or m_prefix_

torn thunder
knotty wren
torn thunder
#

it say marm when should be mar

knotty wren
torn thunder
#

o

torn thunder
#

On last line

rigid solar
torn thunder
rigid solar
#

yeah seals are modprefix_sealkey_seal

knotty wren
#

le code

#

lizzie was right, it's without _seal at the end

#

I looked at another mod that adds seals

rigid solar
#

oh i was looking at some code, but not the right part, oop

rare minnow
#

How do I just make a deck get rid of every Spade?

rigid solar
#

add an event in its apply function that goes through your deck and deletes all spades

rigid solar
#

which part

rare minnow
#

Remove the spades. Like, would it be like how Abanoned deck does no_Faces = true, Or do i have to do something else?

rigid solar
#
  apply = function(self)
    G.E_MANAGER:add_event(Event({
      func = function()
        local to_destroy = {}
        for _, v in pairs(G.deck.cards) do
          if v:is_suit("Spades") then
            to_destroy[#to_destroy+1] = v
          end
        end
        SMODS.destroy_cards(to_destroy)
        return true
      end
    }))
  end
rare minnow
#

thank you

torn thunder
normal crest
#

don't be afraid

dawn knoll
brittle yacht
#
    key = "lenny",
    config = {
        extra = {
        }
    },
    loc_txt = {
        ['name'] = 'Lenny Leonard',
        ['text'] = {
            [1] = 'If {C:attention}Glass Card{} breaks in {C:legendary}The Eye{}{} {C:attention}Boss Blind{},',
            [2] = 'Create a {C:dark_edition}Negative{} {C:attention}Diet Cola{} or {C:attention}Seltzer{}.',
            [3] = '',
            [4] = '{C:inactive,s:1.2}(Ow my eye, I’m not supposed to get {C:attention,s:1.2}[Glass Card]{}{C:inactive,s:1.2} in it!){}'
        },
        ['unlock'] = {
            [1] = 'Unlocked by default.'
        }
    },
    pos = { x = 0, y = 0 },
    cost = 20,
    rarity = 4,
    blueprint_compat = false,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = true,
    atlas = 'lennybg',
    pools = { ["shit"] = true },
    soul_atlas = 'lenny',
    soul_pos = { x = 0, y = 0 },
    in_pool = function(self, args)
        return (
            not args 
            or args.source ~= 'sho' 
            or args.source == 'buf' or args.source == 'jud' or args.source == 'rif' or args.source == 'rta' or args.source == 'sou' or args.source == 'uta' or args.source == 'wra'
        )
        and true
    end,
    
    calculate = function(self, card, context)
        if context.remove_playing_cards  then
            if SMODS.get_enhancements["m_glass"] == true and to_big(G.GAME.blind.config.blind.key) == to_big("bl_eye") then
                return {
                    func = function()
                        
                        if #G.jokers.cards + G.GAME.joker_buffer < G.jokers.config.card_limit then
                            G.GAME.joker_buffer = G.GAME.joker_buffer + 1
                            G.E_MANAGER:add_event(Event({
                                trigger = 'after',
                                delay = 0.4,
                                func = function()
                                    play_sound('timpani')
                                    SMODS.add_card { key = "shit_lennypool" }
                                    card:juice_up(0.3, 0.5)
                                    return true
                                end
                            }))
                        end
                        return true
                    end
                }
            end
        end
    end
}```
silk latch
dapper sun
#

cryptid

silk latch
#

no that's just the one joker

dapper sun
#

i mean the deck/sleeve

silk latch
#

Tried to change it to activate when the card is scored so that it actually copies the card after midas mask and Hurtbreak Wonderland (If the first played hand is a single, editionless 8/Ace, adds a random edition) an so it could have synergy with retriggers, and now it's doing that
where did I fuck it up

keen totem
#

how would i create a specific card with SMODS.add_card

dapper sun
#

SMODS.add_card({key=key})

brittle yacht
#

how to make a deck that spawns one random card from a pool on start?

red flower
#

SMODS.add_card({set=poolkey})

dapper sun
#

the wonders of SMODS.add_card

#

it sure does add cards

brittle yacht
#

lol

#

i js got the formatting wrong ig then

red flower
#

remember to do it in an event if it's a deck

brittle yacht
#

do i need the prefix

red flower
#

and it needs an area

red flower
#

unless you added it manually to the key

brittle yacht
keen totem
#

if you're making a specific card, does SMODS.add_card() actually require a "set" value?

sturdy compass
#

It does not

red flower
red flower
keen totem
#

does it not do that with a "set" set

red flower
#

if add_card has the set it fallsback to it if the card is banned

#

if not it crashes

#

i personally dont care but i have gotten crash reports

keen totem
#

is there a way to detect if a certain card is banned

red flower
#

G.GAME.banned_keys[key]

keen totem
#

i just noticed something in vremade that might be wrong

dusk stream
#
    key = "nano",
    loc_txt = {
        name = "Nano Shinonome",
        text = "nano nano nano nano"
    },
    atlas = 'bwaaajoker',
    pos = {x = 2, y = 0},
    soul_pos = {x = 3, y = 0},
    rarity = 1,
    cost = 1
}``` not sure what i did wrong but it's crashing the game
the crash is in [#⚙・modding-support](/guild/1116389027176787968/channel/1456641579346297053/)
keen totem
#

cartomancer uses G.C.PURPLE for the +tarot message, but it should use G.C.SECONDARY_SET.Tarot

#

unless purple is what the game actually uses, in which case some other effects use the wrong one ig

dusk stream
#

wait nvm

#

the error wasnt specific

#

turns out the text needs to be a table

dapper sun
#

text should be a table

#

yea

keen totem
#

is this the base game's thing for this?

#

cause its inconsistent in vremade as to which color it uses

dapper sun
daring fern
dapper sun
#

😭

#

bc i'm trying to make a rare card equivalent for my custom card type

#

(not to be confused with consumable type)

#

i have at least noticed that it stops it from appearing naturally in boosters

daring fern
dapper sun
#

ah

#

i may just

#

make the weight very low

#

what's the weight for rare spectrals normally?

#

..how do i set a card's weight?

daring fern
dapper sun
#

ty

dapper sun
#

considering its ability

knotty wren
#

how could I make a booster pack that contains only seal spectral cards? including modded ones?

daring fern
# knotty wren how could I make a booster pack that contains only seal spectral cards? includin...

You would create a pool then you would do this: lua local oldsmodsinjectitems = SMODS.injectItems function SMODS.injectItems() local g = oldsmodsinjectitems() for k, v in pairs(G.P_CENTERS) do if v.set == 'Spectral' then local description = table.concat(localize({type = 'raw_descriptions', key = v.key, set = 'Spectral', vars = {}}), ' ') if description:match('^Add a (.-) ?Seal to (.+) selected cards? in your hand$') then SMODS.insert_pool(G.P_CENTER_POOLS['poolkey'], v) end end end return g end Then you would do return {set = 'poolkey', skip_materialize = true, key_append = self.key}

knotty wren
#

I'll definitely take a look at this

#

wdym you can select parts of a description holy moly

glass scaffold
#

So 2 questions:

How do you detect if an achievement is earned and if a specific blind is defeated?

timid zinc
#

if you want to count "spending money" as buying something from shop

#

this would make it include rerolls and not include discounted items tho

white zinc
#

trying to get my mod icon to appear. is there anything else i have to do aside from putting this in metadata.json? (i have the sprite in both 1x and 2x with the right pixel count)

white zinc
#

and so if it's not showing up ... skill issue? lmao

daring fern
white zinc
#

1.0.0 beta 1503a

daring fern
white zinc
#

works now, thanks!

wintry solar
# dapper sun would 0.05 be reasonable?

I am pretty sure that weights won’t be what you’re after here, they work within an object type, but I’m not 100% on how your cards appear in the shop

naive coral
#

whenever a joker is ankhed in my mod, its atlas seems to be missing. what is going on? is this a common issue

#

(ignore the bad crop/screenshot)

daring fern
naive coral
#

wouldnt it be an atlas issue? it might happen with all jokers, i cant test im playuing multiplayer with my friends

fading rivet
#

and also the joker code

timid zinc
#

is there a way to tell if the game state is that a hand is currently being played

fading rivet
#

iirc yes lemme check

timid zinc
#

wait i think i just wrote the code wrong

fading rivet
#

G.STATES.HAND_PLAYED i think

timid zinc
#

i checked just G.STATES.HAND_PLAYED instead of G.STATE == G.STATES.HAND_PLAYED

fading rivet
#

ahh lol

daring fern
daring heron
#

how would i make a malverk texture pack?

#

should just only replace the sun

wintry solar
# daring heron how would i make a malverk texture pack?

AltTexture{ -- Aure Spectral
    key = 'aure', -- alt_tex key
    set = 'Spectral', -- set to act upon
    path = 'aure_spectral.png', -- path of sprites
    keys = { -- keys of objects to change
        'c_aura'
    },
    soul_keys = { -- keys of objects to add floating sprites to
        'c_aura'
    },
    localization = { -- keys of objects with new localizations
        'c_aura'
    }
}

TexturePack{ -- Aure
    key = 'aure', -- texpack key
    textures = { -- keys of AltTextures in this TexturePack
        'aure_spec_aure'
    }
}

Example of single card replacement here

daring heron
#

Found it out dw

cloud wraith
#

How do I add a new card enhancement

solemn wharf
#

is there a context for checking if the card is debuffed during calculate?

red flower
solemn wharf
#

so how can i check if a playing card is debuffed in scoring?

frosty rampart
#

you can check if a card is currently debuffed with card.debuff

solemn wharf
#

so if context.cardarea == G.play and card.debuff?

red flower
#

what do you want to do

#

like, the effect

faint yacht
#

That depends on what source is checking for it - a Joker, an enhancement...

solemn wharf
#

i want to make a joker that gives mult for every debuffed card played

faint yacht
#

context.joker_main, iterate over played cards and add up mult per debuffed card played.

red flower
#

debuffed cards are not iterated on like other cards are

#

so you need to do what ali said

solemn wharf
#

im sorry im still really new to modding

red flower
#

(for the entire played hand it's context.full_hand)

cinder elk
#

what do yall think would be a good. number of jokers for a first release of a mod. like 30?

red flower
#

playing_card.debuff
it's not a function

#

also if you return it will only count the first one

#

you need to return after you count them

solemn wharf
maiden phoenix
red flower
solemn wharf
solemn wharf
#

i mean where does the return go?

red flower
#

in the loop you need to count the cards, after the loop you return mult * count

solemn wharf
#

and do i count them with local card_count = #G.playing_cards?

cinder elk
white zinc
#

if add_to_deck() is how you add a new playing card to the deck, i'd assume remove_from_deck() would remove a card from the deck, right?

red flower
white zinc
#

i'm trying my hand at making a custom deck, and i only want certain cards to appear

red flower
#

then you need to destroy it not remove it

white zinc
#

ah ok

red flower
#

card:remove()

white zinc
#

how does that differ from SMODS.destroy_cards?

red flower
#

destroy_cards does an animation and it counts it for playing_card_destroyed
if you are setting up the starting deck you likely don't want those to happen

white zinc
#

i see ok

#

cool

red flower
#

i dont remember the name

faint yacht
#

initial_deck in SMODS.Back allows you to set what ranks and/or suits you start with.

viscid talon
#
-- Roulette
SMODS.Joker {
    key = "roulette",
    config = { extra = { dollars = 8 } },
    pos = { x = 3, y = 2 },
    cost = 7,
    rarity = 2,
    blueprint_compat = true,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        local suit = (G.GAME.current_round.vremade_castle_card or {}).suit or 'Spades'
        return { vars = { card.ability.extra.dollars, localize(suit, 'suits_singular'), colours = { G.C.SUITS[suit] } } }
    end,

    calculate = function(self, card, context)
        if context.before and not context.blueprint and next(context.poker_hands['Flush']) and
        not context.other_card.debuff and context.other_card:is_suit(G.GAME.current_round.vremade_castle_card.suit) then
            return {
                dollars = card.ability.extra.dollars,
                remove = true,
                delay = 0.45
            }
        end
    end
}```
#

the code here is a little rough - it seems to not know what the "other_card" thing is

#

how can i fix it

wintry solar
#

Context before doesn’t have other card

viscid talon
#

o oops

#

lemme try context.joker_main

wintry solar
#

That also doesn’t

viscid talon
#

gulp

#

yeah

wintry solar
#

What is your effect?

viscid talon
#

give $8 if played hand contains a flush of (suit)

#

(suit changes per round)

wintry solar
#

Why do you need other card for this

viscid talon
#

i dont know 😭

#

i just took the code from castle 😭 😭 🥺

#

idk what im doing

white zinc
red flower
#

you can't copy a card by adding it twice to deck

white zinc
red flower
#

and the game is stuck?

white zinc
viscid talon
white zinc
red flower
#

return true makes the event stop

#

if you don't return that it will keep going

white zinc
#

ah ok

red flower
viscid talon
#

ah okay, so similar to what i did for seven sisters then

white zinc
#
        G.E_MANAGER:add_event(Event({
            func = function()
                for k, v in pairs(G.playing_cards) do
                    local rank_number = v:get_id()
                    if rank_number <= 8 then
                        v:remove()
                    elseif rank_number >= 9 then
                        local suit = v.base.suit
                        local copy_card = {rank_number, suit}
                        copy_card:add_to_deck()
                    end
                end
                return true
            end
        }))
    end```

would something like this be better?
solemn wharf
#

i will try it later

#

thank you so much really

red flower
#

im sorry it's very funny to declare a card like that

white zinc
#

it's the idea that counts lol

red flower
#

i would look into SMODS.add_card and the vanillaremade jokers that add playing cards

white zinc
#

i'm using dna as a reference

red flower
#

that works

#

but copying is a little bit complicated at the moment which might get better in the next smods

fading rivet
viscid talon
#
-- Roulette
SMODS.Joker {
    key = "roulette",
    config = { extra = { dollars = 8 } },
    pos = { x = 3, y = 2 },
    cost = 7,
    rarity = 2,
    blueprint_compat = true,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        local suit = (G.GAME.current_round.vremade_roulette_card or {}).suit or 'Spades'
        return { vars = { card.ability.extra.dollars, localize(suit, 'suits_singular'), colours = { G.C.SUITS[suit] } } }
    end,

    calculate = function(self, card, context)
        if context.joker_main and not context.blueprint and next(context.poker_hands['Flush']) then
            local passed = true
            for k, v in pairs(context.full_hand) do
                if v:is_suit() ~= G.GAME.current_round.vremade_roulette_card.suit then
                    passed = false
                end
            end
            if passed then
            return {
                dollars = card.ability.extra.dollars,
                delay = 0.45
            }
        end
    end
end
}

-- Roulette Functions

local function reset_vremade_roulette_card()
    G.GAME.current_round.vremade_roulette_card = { suit = 'Spades' }
    local valid_roulette_cards = {}
    for _, playing_card in ipairs(G.playing_cards) do
        if not SMODS.has_no_suit(playing_card) then
            valid_roulette_cards[#valid_roulette_cards + 1] = playing_card
        end
    end
    local roulette_card = pseudorandom_element(valid_roulette_cards,
        'j_hatch_roulette' .. G.GAME.round_resets.ante)
    if roulette_card then
        G.GAME.current_round.vremade_roulette_card.suit = roulette_card.base.suit
    end
end

function SMODS.current_mod.reset_game_globals(run_start)
    reset_vremade_roulette_card()
end
#

would this work

red flower
red flower
fading rivet
#

since v still exists after calling v:remove()

red flower
#

no idea

#

it seems to be only deleting every two so it might work

viscid talon
#

oke thabnkies

fading rivet
#

but due to how remove work, the card still exists

#

just the UI is gone and card.REMOVED is true

viscid talon
#

anyways it works

#

yippee

white zinc
#

i'm just so confused 💀

red flower
#

it adds to hand by default

white zinc
#

SMODS.add_card{ set = "Base", rank = "14", suit = "S", area = "G.deck" }

red flower
#

without the quotes

white zinc
#

oh yeah

red flower
#

rank = "Ace" or rank = 14

white zinc
#

string moment

red flower
#

or rank = "A"

red flower
#

yeah

fading rivet
#

ive always used Spades

fading rivet
red flower
#

because im smart and cool and added all the ways

white zinc
#

i searched smods.add_card in the discord server and just inspected how other people used it

fading rivet
#

suit = "♤"

red flower
#

there are like a million examples in vremade

#

and the vremade wiki

white zinc
white zinc
#

but it's all on different pages

fading rivet
red flower
#

that's why vremade wiki is all 1 page

white zinc
#

my code is so broken i've accidentally remade erratic deck 💀

white zinc
#
        G.E_MANAGER:add_event(Event({
            func = function()
                for k, v in pairs(G.playing_cards) do
                    local rank_number = v:get_id()
                    if rank_number <= 8 then
                        v:remove()
                    elseif rank_number >= 9 then
                        SMODS.add_card{ set = "Base", rank = 14 , suit = "S", area = G.deck }
                    end
                end
                return true
            end
        }))
    end```

what this code should do is go through all the playing cards in the deck and remove all the cards of rank 8 or below and then add in an extra ace of spades for every card of rank 9 or above. this is not what's happening in the slightest though
#

we're just doing whatever ig lmao

fading rivet
white zinc
#

nope

#

now it's a different assortment of cards

fading rivet
#

try rank = "Ace", suit = "Spades"

white zinc
#

is it because i'm adding cards while looping through the deck? is that the problem?

fading rivet
#

oh wait

#

yeah

#

not good idea

red flower
#

also you should loop with ipairs

fading rivet
#

do uh

#

uh does for i = 1, #something update something or no

red flower
#

thats the problem

fading rivet
#

like will for i = 1, #t do t[#t + 1] = 1 end be infinite

red flower
#

and for some reason the suit is not being respected, that seems like an smods bug

fading rivet
slate turtle
white zinc
#

i removed the part of the code that adds cards, and so it should just remove the 8 or below cards. i guess odd numbers are exempt from that

red flower
#

try iterating backwards

#

it's not good practice to remove things in a table as youre iterating

#

forwards at least

fading rivet
#
        G.E_MANAGER:add_event(Event({
            func = function()
                for i = #G.playing_cards, 1, -1 do
                    local v = G.playing_cards[i]
                    local rank_number = v:get_id()
                    if rank_number <= 8 then
                        v:remove()
                    elseif rank_number >= 9 then
                        SMODS.add_card{ set = "Base", rank = "Ace" , suit = "Spades", area = G.deck }
                    end
                end
                return true
            end
        }))
    end```
slate turtle
white zinc
fading rivet
white zinc
#

now, can you explain to me why that works?

#

i see we're creating a new variable that's just a copy of the deck

fading rivet
red flower
#

when you remove something from a table you're making it smaller so it keeps skipping steps basically

white zinc
#

ahhh

fading rivet
#

when you destroy the 2 of hearts

#

the 3 goes into the spot

#

tland then you go to the next spot

white zinc
#

that does make sense

fading rivet
#

and instead of being a 3 like expected

#

its a 4

red flower
#

now let me fix the smods bug lol

fading rivet
#

also if you ever getting random suits and ranks out of create card it means the rank or suit key is wrong

red flower
#

yeah that shouldnt happen

#

it should respect the correct one at least

fading rivet
#

yeah it does

red flower
#

it doesnt

fading rivet
#

it has for me

red flower
#

this is giving me random cards

#

without the rank it works

fading rivet
#

its an alias

red flower
#

are you listening to me

#

if one is wrong it should respect the other one

red flower
#

rank is wrong but doesnt respect the suit

fading rivet
#

misunderstood you

red flower
#

also i think that 14 should work but im not adding that lol

#

10 works as well as "10"

viscid talon
#
-- Fireworks
SMODS.Joker {
    key = "fireworks",
    config = { extra = { xmult = 3, type = 'Straight' } },
    pos = { x = 5, y = 2 },
    cost = 9,
    rarity = 3,
    blueprint_compat = true,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.xmult, card.ability.extra.type } }
    end,

    calculate = function(self, card, context)
        local activation = false
        if context.pre_discard and next(context.poker_hands['Straight']) then
            activation = true
                return {
                    message = localize('k_active_ex'),
                    colour = G.C.MULT
                }
        else
            activation = false
        end
        if context.joker_main and activation == true then
            return {
                xmult = card.ability.extra.xmult
            }
        end
    end
}```
#

how do i make this work

#

im guessing i need to have it so the discarded hand is recognised as a straight

red flower
#

what do

viscid talon
#

if discarded hand contains a straight, this joker will give X3 mult upon use

#

it'll say "active" then do the thing

#

im wondering if i have to use G.hand.highlighted

red flower
#

yeah you need to evaluate the poker hand with the function
context.full_hand will work instead of highlighted too

fading rivet
red flower
#

it's Ace or A

fading rivet
#

didnt know about 10 though that's a new one

#

I always converted mine to strings

red flower
#

yeah i did those

#

i just forgot i didnt end up converting the ids

viscid talon
#

yeah im taking a look at burnt joker specifically

fading rivet
viscid talon
#

no

fading rivet
#

you should reword that then lmao

viscid talon
#

oe

#
-- Fireworks
SMODS.Joker {
    key = "fireworks",
    config = { extra = { xmult = 3, type = 'Straight' } },
    pos = { x = 5, y = 2 },
    cost = 9,
    rarity = 3,
    blueprint_compat = true,
    eternal_compat = true,
    perishable_compat = true,
    unlocked = true,
    discovered = false,
    atlas = 'HatchetJokers',

    loc_vars = function(self, info_queue, card)
        return { vars = { card.ability.extra.xmult, card.ability.extra.type, 'poker_hands' } }
    end,

    calculate = function(self, card, context)
        local passed = true
        if context.pre_discard then
            for k, v in pairs(context.full_hand) do
                if v:next(context.poker_hands[card.ability.extra.type]) then
                    passed = false
                end
            end
            if passed == true then
            local eval = function() return context.end_of_round and not G.RESET_JIGGLES end
            juice_card_until(card, eval, true)
                return {
                    localize('k_active_ex')
                }
            end
        end
        if passed == true and context.joker_main then
            return {
                mult = card.ability.extra.mult
            }
        end
    end
}