Help with Badge

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

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Help with Badge

Postby camelino » Thu Aug 23, 2012 9:24 am

Hi

I want to emulate a badge from Notecaddyedge. It should work like this:

Conditions:
Opponent is in the BB
Opponent was faced with minimum 10 steal attempts from SB
Opponent folds 80% or more

Display:
if all conditions are met: 'vB'
if not: ''

So I just copied the existing foldBBvsSB stat and altered it to:

if((cnt_p_bb_v_sb_fold+cnt_p_bb_v_sb_call+cnt_p_bb_v_sb_3bet)<10,'',if(( cnt_p_bb_v_sb_fold / (cnt_p_bb_v_sb_fold+cnt_p_bb_v_sb_call+cnt_p_bb_v_sb_3bet) ) * 100)>80,'vB','')

I validated it in both value expression and format type, and it was said to be correct.

When I put it in my HUD I get an error:
Error: Expression: Invalid number of arguments passed to function 'if' (Expecting 3, Received 1)

That leaves me clueless. Please help me.
camelino
 
Posts: 75
Joined: Wed Oct 01, 2008 8:37 am

Re: Help with Badge

Postby kraada » Thu Aug 23, 2012 10:54 am

Try this instead:

if((cnt_p_bb_v_sb_fold+cnt_p_bb_v_sb_call+cnt_p_bb_v_sb_3bet)<10, '', if( (( cnt_p_bb_v_sb_fold / (cnt_p_bb_v_sb_fold+cnt_p_bb_v_sb_call+cnt_p_bb_v_sb_3bet) ) * 100)>80,'vB',''))

You were missing the bolded parentheses - the first one being missing meant that the if() statement was closed after 'vB', '') - and thus only one expression was being passed. The last one closes the very first if() statement which otherwise wasn't closed once the missing ( was added.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Help with Badge

Postby camelino » Thu Aug 23, 2012 4:21 pm

awesome thanks.

this is difficult for me. Is there a more elegant way than these if(if(if...))) constructions to check several conditions?

I have plenty of other badges I wanna do and they all involve 3 or more conditions to be met.
camelino
 
Posts: 75
Joined: Wed Oct 01, 2008 8:37 am

Re: Help with Badge

Postby kraada » Thu Aug 23, 2012 6:08 pm

Unfortunately there isn't any other method at this time. You'll get used to it - one thing that can help is using something like notepad and putting different levels of things on different lines - then you can more easily match up parentheses.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Help with Badge

Postby pasita » Thu Aug 23, 2012 11:45 pm

Getting Notepad++ or any other editor that shows matching braces will be very helpful.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: Help with Badge

Postby camelino » Fri Aug 24, 2012 4:59 am

thx guys. very kind, will check it out.
camelino
 
Posts: 75
Joined: Wed Oct 01, 2008 8:37 am


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 24 guests