Math A = 1
Open FDSE "prova.txt" 100 # an external .txt file with strings: _1_ , _2_ ...
goto 0x0 100
String VAR P "_%A%_" # String to search as VAR
findloc OFFSET string VAR 100 "" # VAR is not read in v.0.12.0
print "VAR found at %OFFSET|x%"
Last edited by zgoro on Mon Dec 12, 2022 9:18 am, edited 2 times in total.
@zgoro: I suppose that's how quickbms print works now in latest version (it's adding \n to the end of output, like actual print command). Anyway, it's better to use usual printf like this: [string VAR p "_%d_" A] to avoid possible issues.
Make sure you are using it correctly, as p and P are different operators and also %d is different from %02d or %04d and should be adjusted accordingly in case of changes in txt pattern, etc.
Math A = 1
Open FDSE "prova.txt" 100 # an external .txt file with strings: _1_ , _2_ ...
goto 0x0 100
string VAR p "_%d_" A # String to search
print "%VAR%"
findloc OFFSET string VAR 100 "" 0 # VAR is not read
print "VAR found at %OFFSET|x%"
@zgoro: This is expected, because 0 at the end of findloc means you're limiting offset range to 0-0 here (unless you'll do goto to the end of file and search backwards). If you'll remove that 0 from findloc, it will work properly (and you don't have it in the original version of the script).