Jump to content

Recommended Posts

Posted

Right now I have a line in my script that says "If $text="DPF" or $text="DOM" then" and goes on to tell it what to do. Instead of writing "If $text=" each specific symbol, is there a way to just reference a text file with DPF DOM and all other symbols in it, so I don't have to write "If $text" for every single symbol. Thanks.

Hunter

Posted (edited)

You could read a text file and StringSplit it. Then use the output array in a loop to check against.

Edit:

I had time to waste :)

If check_symbol() = True Then
    msgBox(48, "Yay", "It's true!")
EndIf

Func check_symbol($input)
    If $input = "" Then Return False ; simple error check
    $outcome = ""
    $symbol_file = ;<open text file with read access here>
    $symbols = StringSplit($symbol_file, ",")
    For $i = 1 To $symbols[0] ; or add +1 after [0] of count isn't correct
        If $input = $symbols[$i] Then Return True
    Next
    FileClose($symbol_file) ;<close text file read access>
    If $outcome = "" Return False
EndFunc

Didn't run it because it's NOT complete! May contain some errors, this is just a little something to help.

Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...