Page 1 of 1

Help with Badge

PostPosted: Thu Aug 23, 2012 9:24 am
by camelino
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.

Re: Help with Badge

PostPosted: Thu Aug 23, 2012 10:54 am
by kraada
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.

Re: Help with Badge

PostPosted: Thu Aug 23, 2012 4:21 pm
by camelino
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.

Re: Help with Badge

PostPosted: Thu Aug 23, 2012 6:08 pm
by kraada
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.

Re: Help with Badge

PostPosted: Thu Aug 23, 2012 11:45 pm
by pasita
Getting Notepad++ or any other editor that shows matching braces will be very helpful.

Re: Help with Badge

PostPosted: Fri Aug 24, 2012 4:59 am
by camelino
thx guys. very kind, will check it out.