OpenBullet - Nested IF Statement (TXT Utility)



  • Hello, so I am trying to make a nested IF statement to write to multiple txt files based on Greaterthan and Lessthan ... it does work for a short time, however, comes up script error a lot...

    Is there something I am doing wrong?

    Thanks in advance to anyone that can help!


    Code:

    IF "<Balance>" Greaterthan "99.99"
    IF "<Balance>" Lessthan "199.99"
    
    UTILITY File "Hits\\Account\\100+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "199.99"
    IF "<Balance>" Lessthan "299.99"
    
    UTILITY File "Hits\\Account\\200+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "299.99"
    IF "<Balance>" Lessthan "499.99"
    
    UTILITY File "Hits\\Account\\300+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "499.99"
    IF "<Balance>" Lessthan "699.99"
    
    UTILITY File "Hits\\Account\\500+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "699.99"
    IF "<Balance>" Lessthan "899.99"
    
    UTILITY File "Hits\\Account\\700+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "899.99"
    IF "<Balance>" Lessthan "999.99"
    
    UTILITY File "Hits\\Account\\900+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "999.99"
    IF "<Balance>" Lessthan "1499.99"
    
    UTILITY File "Hits\\Account\\1000+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    IF "<Balance>" Greaterthan "1499.99"
    
    UTILITY File "Hits\\Account\\1500+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>" 
    
    ENDIF
    

  • Donator

    for every IF you also need a ENDIF



  • @Itamai

    Adding the extra ENDIF still results in SCRIPT ERROR at times, so weird... hoping there is a fix!

    IF "<Balance>" Greaterthan "99.99"
    IF "<Balance>" Lessthan "199.99"
    
    UTILITY File "Hits\Account\100+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>"
    
    ENDIF
    ENDIF
    IF "<Balance>" Greaterthan "199.99"
    IF "<Balance>" Lessthan "299.99"
    
    UTILITY File "Hits\Account\200+.txt" AppendLines "Email: <USER> - Password: <PASS> - Balance: £<Balance>"
    
    ENDIF
    ENDIF
    

  • Donator

    it worked for me
    i removed the utility block and as you can see in the debugger i used once the value 200 and once 150. it cycles through the code correctly. used print to see if it works
    94465a80-7b81-4f8b-8845-61a7f15b00c3-image.png


  • Donator

    which error do you get?


  • Admin

    There is literally a guide I made on this forum https://forum.openbullet.dev/topic/87/nested-ifs-and-operators



  • FUNCTION Constant "1500" -> VAR "Balance" 
    
    IF "<Balance>" Greaterthan "99.99"
    IF "<Balance>" Lessthan "199.99"
    
    PRINT SUCCESS
    
    ELSE
    
    IF "<Balance>" Greaterthan "199.99"
    IF "<Balance>" Lessthan "299.99"
    
    PRINT SUCCESS2
    
    ELSE
    
    IF "<Balance>" Greaterthan "299.99"
    IF "<Balance>" Lessthan "499.99"
    
    PRINT SUCCESS3
    
    ELSE
    
    IF "<Balance>" Greaterthan "499.99"
    IF "<Balance>" Lessthan "699.99"
    
    PRINT SUCCESS4
    
    ELSE
    
    IF "<Balance>" Greaterthan "699.99"
    IF "<Balance>" Lessthan "899.99"
    
    PRINT SUCCESS5
    
    ELSE
    
    IF "<Balance>" Greaterthan "899.99"
    IF "<Balance>" Lessthan "999.99"
    
    PRINT SUCCESS6
    
    ELSE
    
    IF "<Balance>" Greaterthan "999.99"
    IF "<Balance>" Lessthan "1499.99"
    
    PRINT SUCCESS7
    
    ELSE
    
    IF "<Balance>" Greaterthan "1499.99"
    
    PRINT SUCCESS8
    
    ENDIF
    

Log in to reply