SphereCommunity
What's wrong with this IF? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: What's wrong with this IF? (/Thread-What-s-wrong-with-this-IF)



What's wrong with this IF? - Baeguth - 08-13-2017 10:28 PM

HellO!

PHP Code:
ON=@GETHIT
    
//---------------------PARRY CHECK---------------------------//
    
I.SAY @22 <I.HASPARRIED>
    IF ( <
I.HASPARRIED> > 33 )  
        
//Parrying successful 
        
I.MESSAGE @030 You parried <SRC.NAMEblow
        
ARGN1 //SET DAMAGE TO 1
        
I.EFFECT 3,i_fx_glow,10,16
    
ENDIF 


This is my trigger.
The say is just for debug. It correctly returns the value 33 or 66, depends on what inside the functions.

Here is the function:

PHP Code:
[FUNCTION HASPARRIED]
    IF (<
FINDLAYER.layer_hand2.ISARMOR>)   //check (again) if there is a shield equipped
        
LOCAL.PARRY = <getPercentage <EVAL <PARRYING>> <DEF0.S_MAXPARRYCHANCE>>> //get the parry chance
        
LOCAL.RAND = <R1,100>
        IF (<
TAG0.ISJAGGERNAUT>)
            
LOCAL.PARRY = <DLOCAL.PARRY> + <DEF0.JAGGERNAUTBONUS>
        ENDIF
            
//---------------------PARRY CHECK---------------------------//
        
IF (<EVAL <LOCAL.RAND>> <= <EVAL <LOCAL.PARRY>>)  
            RETURN 
66
        
ELSE
            RETURN 
33
        
ENDIF
    ENDIF 


the error is:

PHP Code:
14:25:ERROR:(BasePlayerEvent.scp,64)Undefined symbol '' ['> 33 )'


help! This is driving me crazy!


RE: What's wrong with this IF? - Baeguth - 08-13-2017 11:28 PM

Fixed by putting a var:

LOCAL.PARRYCHANCE = <I.HASPARRIED>


So sphere doesnt want functions in IF statements?


RE: What's wrong with this IF? - Ben - 08-14-2017 02:35 AM

Not tested, but there is an error in this line
LOCAL.PARRY = <getPercentage <EVAL <PARRYING>> <DEF0.S_MAXPARRYCHANCE>>> //get the parry chance
There is 1 > too much at the end.


RE: What's wrong with this IF? - Baeguth - 08-14-2017 05:27 PM

(08-14-2017 02:35 AM)Ben Wrote:  Not tested, but there is an error in this line
LOCAL.PARRY = <getPercentage <EVAL <PARRYING>> <DEF0.S_MAXPARRYCHANCE>>> //get the parry chance
There is 1 > too much at the end.

Thank you!