Help with If statements



  • So pretty much I am trying to use an if statement to check if a certain key response comes back from a site. In this case a 204 no Content response. But I'm not sure how to go about it exactly and how to set it up right.

    KEYCHECK BanOnToCheck=FALSE 
     KEYCHAIN Success OR 
       KEY "204 No Content" 
    
    IF "<KEY>" Contains "204 No Content"
     SET VAR "Present" "true"
    ENDIF
    

    If anyone can help me out and make this work it would be much appreciated.



  • response code or source ?
    If response code:

    IF "<RESPONSECODE>" Contains "204"
    
    SET VAR "Present" "true"
    
    ENDIF
    

    If source:

    IF "<SOURCE>" Contains "204"
    
    SET VAR "Present" "true"
    
    ENDIF
    


  • @thanhlouis Okay thanks and I also am wondering how to make it show in data if it was a capture or not, current edited code is here:

    VAR "Present" 
    
    IF "<RESPONSECODE>" Contains "204"
    
     SET CAP "Present" "true"
    
    ENDIF
    

  • Admin

    You cannot indent anything in LoliScript! Indentation is read as a continuation of the previous line, so right now the parser is reading

    VAR "Present" 
    IF "<RESPONSECODE>" Contains "204" SET CAP "Present" "true"
    ENDIF
    

    and the parser will stop reading the second line after the "204". You should remove the indentation before the SET CAP command!


Log in to reply