jeudi 18 janvier 2018

How to check if a variable exists in a file for Sadscripting

A buddy and I are at a roadblock on a little project. We're trying to check if a variable exists in a file, and if it doesn't, write it to the file.

Now we already know that

Call PutVar("accounts\extra\" & GetPlayerLogin(index) & ".ini", "VARIABLES", "test", CInt(0))

Will write to the file:

\accounts\extra\username.ini

[VARIABLES]

test=0

However, what were trying to figure out is if the variable already exists in the file accounts\extra then not to write it, an example would be something like:

If GetVar("accounts\extra\" & GetPlayerLogin(index) & ".ini", "VARIABLES", "test") = Doesn't Exist Then
   Call PutVar("accounts\extra\" & GetPlayerLogin(index) & ".ini", "VARIABLES", "test", CInt(0))
 Else
   Do something else  
End If

However "Exists" isn't a recognized term, its more or less just english. If anyone has any advice on something to at least try to get it working, I'd appreciate it alot.

Thanks!

Aucun commentaire:

Enregistrer un commentaire