converting values to string in quickbms

Programming related discussions related to game research
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

converting values to string in quickbms

Post by Shokoniraya »

i want to know how can i convert a string to value (hex-decimal)
for example: i read a number in a xml file (this is the xml part: <width="20">)
i read 20 with getdstring, but how can i convert to decimal? (decimal, i mean \x14)

and how can i convert a decimal to string for output to file? (convert \x14 to 20 for output file)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: converting values to string in quickbms

Post by aluigi »

Strings and numbers are quite abstract in quickbms.
Your variable can be already used as a number but if you want to be 100% sure try the following:
math VAR = VAR
or
set VAR long VAR # not suggested as far as I remember
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: converting values to string in quickbms

Post by aluigi »

When working with output filenames I suggest to use the Printf operator of String:
string NAME p "%d" VAR