Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's wrong with this IF?
Author Message
Baeguth
Apprentice
*

Posts: 12
Likes Given: 4
Likes Received: 0 in 0 posts
Joined: Aug 2017
Reputation: 0



Post: #1
What's wrong with this IF?
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!
08-13-2017 10:28 PM
Find all posts by this user Like Post Quote this message in a reply
Baeguth
Apprentice
*

Posts: 12
Likes Given: 4
Likes Received: 0 in 0 posts
Joined: Aug 2017
Reputation: 0



Post: #2
RE: What's wrong with this IF?
Fixed by putting a var:

LOCAL.PARRYCHANCE = <I.HASPARRIED>


So sphere doesnt want functions in IF statements?
08-13-2017 11:28 PM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #3
RE: What's wrong with this IF?
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.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
08-14-2017 02:35 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Ben's post
Baeguth
Apprentice
*

Posts: 12
Likes Given: 4
Likes Received: 0 in 0 posts
Joined: Aug 2017
Reputation: 0



Post: #4
RE: What's wrong with this IF?
(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!
08-14-2017 05:27 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)