Help with custom stat definition error (if/else statement)

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Help with custom stat definition error (if/else statement)

Postby rowhousepd » Tue Sep 19, 2023 3:08 am

I'm completely new to building custom stats, and I have a feeling I'm just messing up the if/else syntax for the definition I want to create. Essentially, I'm trying to create a fairly simple stat to label 5 different player types based on just two criteria: VPIP and PFR/VPIP ratio. It only assigns a label for players with 100+ hands. The way this system would work is as follows:

Maniac: VPIP >= 40%, PFR/VPIP ratio >=50%.
Whale: VPIP >= 40%, PFR/VPIP ratio <50%.
Tag: VPIP 20-40%, PFR/VPIP ratio >=75%.
Fish: VPIP 20-40%, PFR/VPIP ratio <75%.
Nit: VPIP <20%.

I've read through the tutorial on custom stats, and I think I'm close, but I'm just not quite sure how the syntax and punctuation works. (I'm definitely a newbie when it comes to programming!) I keep getting an error saying there's an "invalid number of arguments." Can you help? Here's what I've got so far. Thanks!

Code: Select all
if (cnt_hands > 100,
    if ((cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 40,
      if (((cnt_pfr / cnt_pfr_opp) * 100) / ((cnt_vpip / (cnt_hands - cnt_walks)) * 100) >= 0.5, format('Maniac'),
         format('Whale')),
            if ((cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 20 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 < 40,
               if (((cnt_pfr / cnt_pfr_opp) * 100) / ((cnt_vpip / (cnt_hands - cnt_walks)) * 100) >= 0.75, format('Tag'),
                  format('Fish'))),                  
                     format('Nit')),
format('n/a'))
rowhousepd
 
Posts: 329
Joined: Sun Mar 22, 2009 4:00 am
Location: Philadelphia, PA

Re: Help with custom stat definition error (if/else statemen

Postby Flag_Hippo » Tue Sep 19, 2023 5:50 am

Test for everything within each nested IF. For example:

Code: Select all
if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 40 and ((cnt_pfr / cnt_pfr_opp) * 100 / (cnt_vpip / (cnt_hands - cnt_walks))) * 100 >= 50, format('Maniac'), format('N/A'))
Flag_Hippo
Moderator
 
Posts: 17062
Joined: Tue Jan 31, 2012 7:50 am

Re: Help with custom stat definition error (if/else statemen

Postby rowhousepd » Wed Sep 20, 2023 12:38 am

Flag_Hippo wrote:Test for everything within each nested IF.

Hmmm. Right, I get that ... in theory. I'm sorry, but I'm not quite seeing where I was messing up. :?

I've actually re-written the first version below (I'm excluding the hand count requirement for the moment), yet I'm still getting an error -- this time saying there's an "invalid operation specified." Arg! I have a feeling the problem is in the way I'm writing that second VPIP tier (line #4 below), and I'm sure it's something really minor. Could you have a look and tell me what I'm overlooking? :oops: Thank you in advance!

Code: Select all
if ((cnt_vpip / (cnt_hands - cnt_walks)) * 100 => 40,
   if (((cnt_pfr / cnt_pfr_opp) * 100) / ((cnt_vpip / (cnt_hands - cnt_walks)) * 100) => 0.50, format('Maniac'),
      format('Whale')),
   if ((cnt_vpip / (cnt_hands - cnt_walks)) * 100 => 20,      
      if (((cnt_pfr / cnt_pfr_opp) * 100) / ((cnt_vpip / (cnt_hands - cnt_walks)) * 100) => 0.75, format('TAG'),
         format('Fish'))),
format('Nit'))
rowhousepd
 
Posts: 329
Joined: Sun Mar 22, 2009 4:00 am
Location: Philadelphia, PA

Re: Help with custom stat definition error (if/else statemen

Postby Flag_Hippo » Wed Sep 20, 2023 12:17 pm

Code: Select all
if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 40 and ((cnt_pfr / cnt_pfr_opp) * 100 / (cnt_vpip / (cnt_hands - cnt_walks))) * 100 >= 50, format('Maniac'), if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 40 and ((cnt_pfr / cnt_pfr_opp) * 100 / (cnt_vpip / (cnt_hands - cnt_walks))) * 100 < 50, format('Whale'), if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 20 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 <= 40 and ((cnt_pfr / cnt_pfr_opp) * 100 / (cnt_vpip / (cnt_hands - cnt_walks))) * 100 >= 75, format('Tag'), if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 >= 20 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 <= 40 and ((cnt_pfr / cnt_pfr_opp) * 100 / (cnt_vpip / (cnt_hands - cnt_walks))) * 100 < 75, format('Fish'), if (cnt_hands > 100 and (cnt_vpip / (cnt_hands - cnt_walks)) * 100 < 20, format('Nit'), format('N/A'))))))
Flag_Hippo
Moderator
 
Posts: 17062
Joined: Tue Jan 31, 2012 7:50 am

Re: Help with custom stat definition error (if/else statemen

Postby rowhousepd » Wed Sep 20, 2023 10:24 pm

Ooooooooh, I see it now. I didn't realize you were suggesting to have every line be a complete IF statement. Duh. Thank you, Flag_Hippo! I'm going to tinker around with this a bit more and add a couple of other criteria, but I think I get the idea. Cheers! :)
rowhousepd
 
Posts: 329
Joined: Sun Mar 22, 2009 4:00 am
Location: Philadelphia, PA


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 16 guests