#SMODS.Suit help

1 messages · Page 1 of 1 (latest)

young silo
#

Self explanatory, but lemme elaborate

I made a new suit, but selecting any card just.. Crashes the game? It flashes the error screen then closes.
If it helps, here is the suit code.

My atlases do work, too

   key = "stars_suit",
   card_key = "S",
   pos = {y = 0},
   ui_pos = {x=0, y=0},
   lc_atlas = "extra-suits",
   lc_ui_atlas = "extra-suits-ui",
   --Note: make High Contrast Later
   hc_atlas = "extra-suits",
   hc_ui_atlas = "extra-suits-ui",
   in_pool = true
}```
young silo
#

^ As for selecting a card, it's not just any card from the suit, it's all suits

fringe cape
#

off the top of my head, card_key = "S" won't really work because spades already use "S" for that. i dunno if that's what's causing the crash exactly but it's definitely An issue
the card_key isn't restricted to a single letter, it can be any string

young silo
#

Ahh

#

Lemme see if that fixed it,,,

#

Nope.

#

Do you uhhhh

Need the assets themselves to try & fix it?

fringe cape
#

first, do you have localization for the suit set up?

young silo
#

Yes, suits_plural & singular.

#

Everything works except selecting a card.

fringe cape
#

hm, yea i'm not really sure then

young silo
#

Sigh

#

i should just reference mods that add suits

fringe cape
#

my only other idea is that in_pool might have to be a function that returns true, and you can't just set it equal to true directly
(i'm referencing a working suit mod rn, nothing seems glaringly out of order apart from that)

young silo
#

Ah

#

whats the function?

fringe cape
#
in_pool = function(self, args)
  return true
end
young silo
#

Gonna test that rn

#

Nope.

#

Can I get the mod?

fringe cape
young silo
#

Ah, maybe that's the issue

#

I just put it all in the main Mod.lua

fringe cape
#

nah it shouldn't be

#

depending on how much content you're adding it's certainly a good idea to set up a multi-file system, but it's not ever a requirement afaik

young silo
#

Hm..

#

How weird...

#

Here,

#

See if it works for you

fringe cape
#

I'm eating dinner rn, I'll give it a try in a bit

young silo
fringe cape
#

@young silo working fine on my end, which means my next guess is some sort of crossmod issue

young silo
#

I have Cryptid, Steammodded, and Talisman installed

fringe cape
#

which version of cryptid

young silo
#

Most recent i believe

#

0.5.5b

fringe cape
#

gotcha, grabbing that now

young silo
#

I think thats the issue.,,,,,

fringe cape
#

nope, still working for me,,,
maybe if you record the crash happening, i can see what the crash log says

young silo
#

It's like a 5 frame crash 💀

#

Flashes the screen then CLOSES

fringe cape
#

yea but if you can record it i can pause the video

young silo
#

Ya, one sec

#

i did also reinstall Cryptid in case im just nuts
-# same thing happens

#

What the shit

#

theres NO error

#

Okay i

#

fixed it.

#

SOMEHOW.

#

I had to reinstall Steammodded.

fringe cape
#

huh
well if it works it works lmao

young silo
#

🔥

#

Ty Meta

young silo
#

@fringe cape Sorry to bother

Any way to make a new rank appear for only one suit?

fringe cape
#

hm, that's interesting
what's the use case exactly?

young silo
#

I'm trying to make a suit that can have its own Ranks.

#

Well

#

I have the suit, but I also want to give that said suit specifically its own ranks, i.e 3.5, 1, Wild stuffs

fringe cape
#

can the suit also have the regular ranks?

young silo
#

No.

#

Oh wait-

#

Yes

fringe cape
#

ok, that makes things simpler. When exactly do you want these weirder ranks to appear (i.e. in standard packs, in the deck when you start a game, from incantation, from custom jokers, etc)?

young silo
#

In the deck when you start

fringe cape
#

ok i thought i could put it together pretty quickly but it is apparent that i don't really understand in_pool lmao
it has something to do with that, but that's about all i've figured out so far

young silo
#

Dang

fringe cape
#

oh shit nvm i figured it out

in_pool = function(self, args)
  if args.initial_deck and args.suit == 'wst_stars_suit' then
    return true
  else
    return false
  end
end

use that as the in_pool for each custom rank you're adding. tldr the game literally just passes each suit in the args table to a rank's in_pool function, so if you return true only for the relevant suit it should only create the rank for that suit

#

and now that i know how to check the args table i am filled with a dire need to document it everywhere in_pool is called

young silo
#

Oo

#

One sec

#

YOOOOO TY

young silo
fringe cape
#

also, because there are so many ranks you'll be taking ownership of, you might want to do some sort of iteration instead of just copy-pasting 14 ownership calls

young silo
#

could i do
for card = {2, 3, 4...} do in_pool = ...

fringe cape
#

more like

ranks = {'2', '3', '4', ..., 'King', 'Ace'}
for v in ranks do
  SMODS.Rank:take_ownership(v,
    {
      in_pool = function(self, card, context)
        ...
      end
    }, true
  )
end

(the true at the very end makes it so that your mod badge doesn't appear on like every playing card, but it's optional)

young silo
#

I see,,,

young silo
#

what would context be?

fringe cape
#

sorry i glanced at the wrong text file on accident lol. the line should read in_pool = function(self, args) like the last time you were working with in_pool

young silo
#

ahhh

#

so i use if args.initial_deck and args.suit == "..."

fringe cape
#

yea

young silo
#

Doesn't seem to work.
Would I paste the ranks = ... and for v in ranks into the Suit code?

fringe cape
#

tbh now that i think about it, if just this one suit is special, it might be better to do all the work in the suit's in_pool instead. a suit's in_pool gets args.rank, just like a rank's in_pool gets args.suit
so scrap all the take_ownership stuff and do this instead, in the stars suit in_pool

in_pool = function(self, args)
  local weird_ranks = { 'wst_3.5', 'wst_1', ...} -- whatever your custom rank keys are, with the mod prefix
  for r in weird_ranks do
    if r == args.rank return true end
  end
  return false
end
young silo
#

I see

#

Well, it removed the suit altogether.
(i wrote for r in ipairs({weird_ranks})

#

and writing r in weird_ranks pulls up an error, attempt to call a table value when i hit play.

fringe cape
#

ah my bad, went into python mode
you'll want to do for _, r in ipairs(weird_ranks) (ipairs always gives you two values, the first one is just the index and not the value itself. since the index is a number and args.rank is always a string, r == args.rank ended up always being false)

young silo
#

and I can keep the return false?

#

OOP, works!!!

young silo
#

Can I use a calculate function in the SMODS.Rank?

fringe cape
#

no, what are you trying to do

young silo
#

Have a card clone itself afrer scoring

#

I asked in modding dev, think SMODS.calculate_context should do it

young silo
#

Hey uh @fringe cape

Can i send you my mod (updated) to get some help on a poker hand

#

I have a Flush Five made with just icards, i name it "Why."

But, doing the hand, It doesn't show that and inatead is just flush five

#

Changing to a higher chip/mult value & even ordering it higher doesn't work either

fringe cape
#

yea go for it

young silo
#

Bleh

#

Last two SMODS in the main mod.lua are the poker hand code

fringe cape
#
  1. right now your "whypart" pokerhandpart is just any flush
  2. in the pokerhand itself, if the hand contains any flush, then it won't return a "why" poker hand.
young silo
#

Ah

#

How would I go about checking if the cards are the specific one?

fringe cape
#

the "hand" variable you get in the evaluate function, and therefor the one you pass to the pokerhandpart, is a table of all the cards in the played hand. iterate over it in a for loop, and check each card's base.value, which will be wst_square_i if it's an icard
you'll also probably want to check if SMODS.has_no_rank( [the card] ) is false, because if it's true then it's something like Stone or Abstract and shouldn't count for the hand

young silo
#

So i can do
for _,card in ipairs(G.hand) do if card.base.value == 'wst_square_i' then return SMODS.merge_lists(parts.wst_whypart, other hands) end end

#

or smth like that?

fringe cape
#

no
the loop goes in the pokerhandpart, and you only want the part to return true if all 5 cards in the hand are icards
so you'd probably want to start by setting a local variable to true before the loop, and then if one of the cards isn't an icard, set that variable to false. then after the loop, return the value of that local variable

young silo
#

Ahh

fringe cape
#

and then you can just simplify the pokerhand's evaluate function to if next(parts.wst_whypart) then return { parts.wst_whypart } end

young silo
#

I check the hand cards by using G.hand?

fringe cape
#

no, the function gets a value called "hand" passed to it, you just need to use "hand"

young silo
#

ahh

young silo
#

Ah wait nvm

#

Not sure if i did this right

func = function(hand) local check = true for _,card in ipairs(hand) do if card.base.value == "wst_square_i" then check = true else check = false end end return {hand,check} end

fringe cape
#

no
i actually just thought up a simpler solution, you don't need the check variable at all

func = function(hand)
  for _,card in ipairs(hand) do
    if card.base.value ~= "wst_square_i" then
      return {}
    end
  end
  return hand
end

if any one of the cards aren't an icard, you want to return an empty table. you don't want to re-set it to true just because a later card is an icard, because then you let one that isn't an icard slip through
and the hand
and the pokerhandpart's function is supposed to return the part of the hand that contains that poker hand part. in your case it's either all 5 cards (so just return hand) or none of the cards match (so return the empty table)

young silo
#

I see

#

Well, hand works...
But it shows even when one icard is highlighted.

#

Would it work if i add and #card < 5 in the if?

fringe cape
#

yea that'd work fine (or, not and). i would put that check before the for loop entirely tho, because otherwise you're checking it 5 times in a row sometimes

young silo
#

I see

#

Still shows Flush Five.

   local check
      if #hand < 5 then
         check = false
      end
...```

then added `or check ~= true` to the if part.
fringe cape
#

you need to set check to true initially

#

just declaring it leaves it as nil I think (which is false)

young silo
#

Ah

#

WORKS

#

Tysm WHYYYYYY