wc3edit.net

United Warcraft 3 map hacking!
It is currently April 19th, 2024, 4:23 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: RAW to STR and stuff? xD
PostPosted: June 8th, 2011, 12:18 pm 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
mmk.....soooo i was looking through JJ's raw and str handling stuffs....and i got confused o.o

on this site, in: http://forum.wc3edit.net/deprotection-cheating-f64/how-to-insert-a-cheatpack-by-jj2197-t2913.html
it is:
Spoiler:
function s2i takes string s2s returns integer
return s2s
call DoNothing()
return 0
endfunction
function InitS2RAW takes nothing returns nothing
set S2RAW[s2i("0")]=48
set S2RAW[s2i("1")]=49
set S2RAW[s2i("2")]=50
set S2RAW[s2i("3")]=51

and
Spoiler:
function Str2RAW takes string s2s returns integer
return S2RAW[s2i(SubString(s2s,0,1))]*0x1000000+S2RAW[s2i(SubString(s2s,1,2))]*0x10000+S2RAW[s2i(SubString(s2s,2,3))]*0x100+S2RAW[s2i(SubString(s2s,3,4))]
endfunction
function RAW2Str takes integer I2I,player p2p returns nothing
local string s2s
set s2s=S2RAWa[I2I/0x1000000]+S2RAWa[(I2I-0x1000000*(I2I/0x1000000))/0x10000]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))-0x100*(((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100)]
call DisplayTextToPlayer(p2p,0,0,s2s)
endfunction


on the one i have (and kyro....i checked one of his cheated maps: http://forum.wc3edit.net/fulfilled-requests-f75/the-cursed-heroes-orpg-08f-t20872.html)
its this:
Spoiler:
function s2i takes string s2s returns integer
local integer ii2ii=48
loop
exitwhen ii2ii>122
if(S2RAWa[ii2ii]==s2s)then
return ii2ii
endif
set ii2ii=ii2ii+1
endloop
return 0
endfunction
function InitS2RAW takes nothing returns nothing
set S2RAW[s2i("0")]=48
set S2RAW[s2i("1")]=49
set S2RAW[s2i("2")]=50
set S2RAW[s2i("3")]=51

and
Spoiler:
function Str2RAW takes string s2s returns integer
return s2i(SubString(s2s,0,1))*0x1000000+s2i(SubString(s2s,1,2))*0x10000+s2i(SubString(s2s,2,3))*0x100+s2i(SubString(s2s,3,4))
endfunction
function RAW2Str takes integer I2I,player p2p returns nothing
local string s2s
set s2s=S2RAWa[I2I/0x1000000]+S2RAWa[(I2I-0x1000000*(I2I/0x1000000))/0x10000]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))-0x100*(((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100)]
call DisplayTextToPlayer(p2p,0,0,s2s)
endfunction


i assumed they were doing the same thing o.o was i right? xD

And....>.>....In the RAW2Str function.....there's that really long set....which seems redundant....
reproduced:
Spoiler:
S2RAWa[I2I/0x1000000]+S2RAWa[(I2I-0x1000000*(I2I/0x1000000))/0x10000]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100]+S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))-0x100*(((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100)]


It doesn't make sense to me o.o
like...the second thing you add is S2RAWa[(I2I-0x1000000*(I2I/0x1000000))/0x10000]
I2I is just another variable (like x) and is an integer and the 0x makes the number after it go from hex to dec
so (I2I-16777216*(I2I/16777216))/65536
following pemdas (order of operations), you divide I2I by 16777216 then multiply that by 16777216....
then you SHOULD get I2I o.o so I2I-I2I=0...and 0 divided by anything is 0....so its 0?

the third thing is
S2RAWa[((I2I-0x1000000*(I2I/0x1000000))-0x10000*((I2I-0x1000000*(I2I/0x1000000))/0x10000))/0x100]
in dec it is...
((I2I-16777216*(I2I/16777216))-65536*((I2I-16777216*(I2I/16777216))/65536))/256
PEMDAS:
((I2I-I2I)-65536*(I2I-I2I)/65536)/256 reduced the 16777216
((I2I-I2I)-(I2I-I2I))/256 reduced the 65526
(0-0)/256 subtracted....and got
0

am i missing something? O.o


Top
 Profile  
 
PostPosted: June 8th, 2011, 12:40 pm 
Offline
Forum Staff

Joined: October 27th, 2009, 12:18 pm
Posts: 1108
Location: Australia, GMT+8
the first one's probably jj's original cp, the 2nd one is probably fatherspace's 1.24+ jjcp as for the rest i havent actually read what your asking

_________________
If you have any questions drop in by chat sometime, chances are there'll be someone who can help you that's afking there, so the next best thing is to click the link on UndeadxAssassin's Sig and ask your question there.


Top
 Profile  
 
PostPosted: June 8th, 2011, 3:22 pm 
Offline
Grammar King
User avatar

Joined: June 22nd, 2008, 10:11 pm
Posts: 2410
Location: Mostly USEast
Title: Worst human for 4eva
That's the formula to switch from RAWCode to item id, basically. WC3 engine has a 10 number code for every item/unit id. That formula switches it to the four number/letter combo that you know as RAWCodes.

_________________
Quote:
(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.


Quote:
(23:44:12) Bartimaeus: I was in pubic school until middle school...


Learn how to extract and read RAW Codes here!

Need help? Click here and ask your question!


Top
 Profile  
 
PostPosted: June 9th, 2011, 2:01 am 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
lol I'm saying mathematically, it all cancels out to 0


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)