Page 1 of 1

Quickbms Hex string?

Posted: Tue May 14, 2013 10:26 pm
by fatduck
I know I can convert a decimal value as string like:

Code: Select all

get value long               #50000163
string stgvalue = value
string stgvalue += ".dat"    #become 50000163.dat
Is there a way to convert it as as hex string?
eg: output as "02FAF123.dat" string

Thanks in advance.

Re: Quickbms Hex string?

Posted: Wed May 15, 2013 10:13 pm
by fatduck
Since I need a converter badly, I wrote a stupid function to do this work!
Hope this help some people out here as well.

Code: Select all

#Quick and dirty  DEC to HEX  function by Fatduck
StartFunction DEC2HEX_OUTPUT
   set STG ""
   math VALUE = YOUR_INPUT_VALUE     #change this  YOUR_INPUT_VALUE  to your variable
   for kk = 1 to 8
      math VALUE l= 4
      math TMP = VALUE
      math TMP &= 0xF   
      if TMP == 15
         string STG += "F"
      elif TMP == 14
         string STG += "E"
      elif TMP == 13
         string STG += "D"
      elif TMP == 12
         string STG += "C"
      elif TMP == 11
         string STG += "B"
      elif TMP == 10
         string STG += "A"
      else
         string STG += TMP
      endif
   next kk
   #print "%STG%"
EndFunction

Re: Quickbms Hex string?

Posted: Tue May 21, 2013 8:01 pm
by aluigi
do you mean something like the following?

Code: Select all

string NAME p= "%08x.dat" VALUE