RAW to STR and stuff? xD

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

RAW to STR and stuff? xD

Post by naturesfury »

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
Kyoshiro
Forum Staff
Posts: 762
Joined: October 27th, 2009, 12:18 pm
Location: Australia, GMT+8

Re: RAW to STR and stuff? xD

Post by Kyoshiro »

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.
User avatar
UndeadxAssassin
Grammar King
Posts: 2115
Joined: June 22nd, 2008, 10:11 pm
Title: Worst human for 4eva
Location: Mostly USEast

Re: RAW to STR and stuff? xD

Post by UndeadxAssassin »

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.
(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.


(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!
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: RAW to STR and stuff? xD

Post by naturesfury »

lol I'm saying mathematically, it all cancels out to 0