converting hex to sting question

Programming related discussions related to game research
happydance
Posts: 81
Joined: Sun Jul 10, 2016 11:07 am

converting hex to sting question

Post by happydance »

just a quick and noob question.

when I write the code like this which just gets the hex number of files and put it on a memory file to be made as text I always get a 0x0 at the end of the converted decimal number.

Image

Code: Select all

log MEMORY_FILE 0 0
get FILENUM long
put FILENUM string MEMORY_FILE
get SIZE ASIZE MEMORY_FILE2
log test.txt 0 SIZE MEMORY_FILE2



I plan on getting the value of the number of files, the value of dialog id convert it to decimal and also rip some text strings to the output file.


I'm trying to do something like this as the output file

10 <--- file number
01 Hello there. <--- dialog ID and text
02 I'm a noob\natdoing this thing. <--- dialog ID and text
03 thanks for the help.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: converting hex to sting question

Post by aluigi »

I think you want to use "line" instead of "string".

put FILENUM line MEMORY_FILE

While for the strings try:

string TMP p "%02d %s" ID STRING
put TMP line MEMORY_FILE
happydance
Posts: 81
Joined: Sun Jul 10, 2016 11:07 am

Re: converting hex to sting question

Post by happydance »

thanks!

put FILENUM line MEMORY_FILE

works great!