Jump to content
Sign in to follow this  

Referencing text files

Recommended Posts


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.


Share this post

Link to post
Share on other sites

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


I had time to waste :)

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

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
    FileClose($symbol_file) ;<close text file read access>
    If $outcome = "" Return False

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)

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.