Jump to content

PHP to AutoIt


Recommended Posts

Hey all, I found this PHP code, and want to convert it to autoit. I tried my best using Richard Robertson's and my own limited knowledge of PHP and PHP.net reference but unfortunately, the code doesnt work.

PHP code

As you can see, the code generates 14 characters separated by a hyphen.

My Code:

#include <string.au3>

$Title = "Dawn of the Deadv5.2 Code Generator"
$UN = InputBox($Title, "Input Your Username", "impic")
$EXP = InputBox($Title, "Input Your Desired XP", 999999)
$Code = GetCode($UN, $EXP)
MsgBox(0, "Result", "Username: " & $UN & @CRLF & "XP: " & $EXP & @CRLF & "Code: " & @CRLF & $Code)
ClipPut("-load " & $Code)


Func SubStringBJ($str, $from, $to)
    $from -= 1
    $to -= 1
    Return substring($str, $from, ($to - $from) + 1)
EndFunc   ;==>SubStringBJ

Func substring($str, $start, $count)
    If $start < 0 Then
        $start = abs($start)
        $str = _StringReverse($str)
        Return StringMid($str, $start, $count)
    Else
        Return StringMid($str, $start, $count)
    EndIf
EndFunc

Func GetCode($myname, $myxp)
    Dim $Codesets[10], $Codesets2[10], $CodesetToUse[3]
    $Constent = "x"
    $OriginalSet = "3khyirlv8nbd6efm5g902c1as7xjz4uqpowt`~!@#$^&*()-_=+"
    $NumberSet1 = "qdrbyujhpl"
    $NumberSet2 = "9213568740"
    $Codesets[0] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[1] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets[2] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[3] = "hy9asolwf5gk0tmj14i8nbd6xp7vecuqr2z3`~!@#$^&*()-_=+"
    $Codesets[4] = "mgfy7kwcn8xupo0e9sjib2z3h15qr4davtl6`~!@#$^&*()-_=+"
    $Codesets[5] = "7vogm1zsdxw59ykhn4ec2jtf3u8pqra06bil`~!@#$^&*()-_=+"
    $Codesets[6] = "0uh9wir4fz3kpcbyd2a1lt6jnqmge85svox7`~!@#$^&*()-_=+"
    $Codesets[7] = "w3kjaq5ve19ulopcbhyr2dgxfm0s8n7i4t6z`~!@#$^&*()-_=+"
    $Codesets[8] = "ebjoq0zkx2g5sih8a9d31c6ylwpm4fun7tvr`~!@#$^&*()-_=+"
    $Codesets[9] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets2[0] = "qwe4rtysuiotpashdfgphjk7lzx5cvbbnmq6werutyufiopjasd8fghrjklwzxcgvbnimqwdertyyuioopaasdfkghjvklz2xcvxbnm1qwe0rtymuiozpasndfg9hjkelzxlcvbqnmqcwer3123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[1] = "asdffgh0jklmzxcovbn3mqwqerteyuivoparsdf6ghj2klzjxcvbbnm4qwecrtyauiotpasidfg9hjkllzx8cvbznmq5werptyuxiopkasdyfghhjkluzxcwvbn1mqwsertnyuidoh6g0737123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[2] = "rbhwyuzxsde7rgyuujb84rf5hy8i90peola923v4bn6geftnyhxcefcothplokl1ijnv34vjqw3redbq76hmplmkiwffgty36yhsfg4a3fg0yu9ypoxpxcvb34gz445667d2as2dlokh086t123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[3] = "mnb5vcxnzlkijhgqfdszapo7iuyptre2wqmknbv3cxz8lkjfhgfcdsaepoi1uytbrewlqmnwbvcgxzl0kjh6gfdssapdoiuvytryewq4mnb9vcxozlkujhgxfdsrapojiuyttremwqmhnbva123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[4] = "lkjohgf3dsarpoi9uytfrewmqmnebvcdxzlqkjhvgfdwsapgoiu5ytriewqxmnbnvcxlzlkyjhg2fdshaposiuyatrezwqm0nbv8cxz1lkj4hgf7dsatpoiuuytcrewbqmnpbvcjxzpkoiu6123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[5] = "jfrnugc7nhgwerirbhf9qwx523gbj6s2df06k7vk2dam12sicvuxherztyxdkoglqwdvytbyvdc8gftujygjdawartyhpolgjgxpswzqqwefhye4asdtvfz1aejckiyoajs0e56365ge3jbs123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[6] = "qazjwsx5edc0rfvhtgbqyhnrujm2ikm3olp6qaz4ploiokmvijnkuhb8ygvdtfcardx9esznwaqgqwesfgheyjc1fgel45gwhjbmsdfz3fdbd78o834c6bdf23v7g34ubhjtlo8x5fsydb4p123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[7] = "3gbgj8gd9lorlol754dnf74t2bgijk8zik4e1sdb3buy6yh23fgc7yhj7dhh9ok0pl8q3d2m12csgby6ttfwdvhotyb9upzxsdfuthq4w4tk67yp9gd16gh31avlb74f37la07387jb557hv123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[8] = "uhf434cj156f856720410983036q75161509159p685i021z21gtgt5vdeyotlmxopqczxfyghtwyuz5xgj81230tyhuqazrujmetfcgtgb2tgvmedchfrsldp8b783n146d85ka869kdt0s123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[9] = "qwejrtybuio9pas5mnb0vcxhzlkqjhg1fdsvapo7iuymtgbpef4e845w3602025l790x568r128i1203568sthb812s4vghapoqggytzhmntiozofgyuefckthqfwec6tghcyujyaz3d456n123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"

    $EXP = ""
    $CodesetToUse[1] = ""
    $CodesetToUse[2] = ""
    $RawCode = ""
    $CodesetToUse[1] = Random(0, 9, 1)
    $CodesetToUse[2] = Random(0, 9, 1)
    $RawCode &= $Constent
    $RawCode &= SubStringBJ($myname, 1, 2)
    $RawCode &= SubStringBJ($myname, StringLen($myname), StringLen($myname))
    $RawCode &= StringLen($myxp)
    $RawCode &= "-"
    $EXP = $myxp
    $AIndex = 1
    $AIndexEnd = 6 - StringLen($myxp)
    While $AIndex <= $AIndexEnd
        $TempRandom = Random(1, 36, 1)
        $EXP = SubStringBJ($OriginalSet, $TempRandom, $TempRandom) & $EXP
        $AIndex += 1
    WEnd
    $RawCode &= $EXP
    $RawCode &= $Constent
    ;$RawCode=StringCase($RawCode,false)
    $RawCode = StringUpper($RawCode)
    $CompletedCode = ""
    $AIndex = 1
    $AIndexEnd = StringLen($RawCode)
    While $AIndex <= $AIndexEnd
        $BIndex = 1
        $BIndexEnd = 51
        While $BIndex <= $BIndexEnd
            If SubStringBJ($RawCode, $AIndex, $AIndex) == SubStringBJ($OriginalSet, $BIndex, $BIndex) Then
                $TempLetter = SubStringBJ($Codesets2[$CodesetToUse[2]], $BIndex * 4, $BIndex * 4)
                $For1 = 1
                While $For1 <= 51
                    If $TempLetter == SubStringBJ($OriginalSet, $For1, $For1) Then $CompletedCode &= SubStringBJ($Codesets[$CodesetToUse[1]], $For1, $For1)
                    $For1 += 1
                WEnd
            EndIf
            $BIndex += 1
        WEnd
        $AIndex += 1
    WEnd
    $AIndex = 1
    $AIndexEnd = 10
    While $AIndex <= $AIndexEnd
        If SubStringBJ($CodesetToUse[1], 1, 1) == SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[1] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        If SubStringBJ($CodesetToUse[2], 1, 1) == SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[2] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        $AIndex += 1
    WEnd
    $CompletedCode = ($CodesetToUse[1] & $CodesetToUse[2] & $CompletedCode)
    Return $CompletedCode
EndFunc   ;==>GetCode

This only generates 9 digits... :)

Someone please shed light on mah problem!

Edited by Paulie
Link to comment
Share on other sites

I don't even know where to begin. Tha PHP code is a pile of shit. Your translation was spot on, but jesus christ. I went through it line by line but still don't have a clue what the output means.

I marked my changes with arrows.

#include <string.au3>

$Title = "Dawn of the Deadv5.2 Code Generator"
$UN = InputBox($Title, "Input Your Username", "impic")
$EXP = InputBox($Title, "Input Your Desired XP", 999999)
$Code = GetCode($UN, $EXP)
MsgBox(0, "Result", "Username: " & $UN & @CRLF & "XP: " & $EXP & @CRLF & "Code: " & @CRLF & $Code)
ClipPut("-load " & $Code)


Func SubStringBJ($str, $from, $to)
    $from -= 1
    $to -= 1
    Return StringMid($str, $from, ($to - $from) + 1)
EndFunc   ;==>SubStringBJ


Func GetCode($myname, $myxp)
    Dim $Codesets[10], $Codesets2[10], $CodesetToUse[3]
    $Constent = "x"
    $OriginalSet = "3khyirlv8nbd6efm5g902c1as7xjz4uqpowt`~!@#$^&*()-_=+"
    $NumberSet1 = "qdrbyujhpl"
    $NumberSet2 = "9213568740"
    $Codesets[0] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[1] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets[2] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[3] = "hy9asolwf5gk0tmj14i8nbd6xp7vecuqr2z3`~!@#$^&*()-_=+"
    $Codesets[4] = "mgfy7kwcn8xupo0e9sjib2z3h15qr4davtl6`~!@#$^&*()-_=+"
    $Codesets[5] = "7vogm1zsdxw59ykhn4ec2jtf3u8pqra06bil`~!@#$^&*()-_=+"
    $Codesets[6] = "0uh9wir4fz3kpcbyd2a1lt6jnqmge85svox7`~!@#$^&*()-_=+"
    $Codesets[7] = "w3kjaq5ve19ulopcbhyr2dgxfm0s8n7i4t6z`~!@#$^&*()-_=+"
    $Codesets[8] = "ebjoq0zkx2g5sih8a9d31c6ylwpm4fun7tvr`~!@#$^&*()-_=+"
    $Codesets[9] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets2[0] = "qwe4rtysuiotpashdfgphjk7lzx5cvbbnmq6werutyufiopjasd8fghrjklwzxcgvbnimqwdertyyuioopaasdfkghjvklz
2xcvxbnm1qwe0rtymuiozpasndfg9hjkelzxlcvbqnmqcwer3123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[1] = "asdffgh0jklmzxcovbn3mqwqerteyuivoparsdf6ghj2klzjxcvbbnm4qwecrtyauiotpasidfg9hjkllzx8cvbznmq5wer
ptyuxiopkasdyfghhjkluzxcwvbn1mqwsertnyuidoh6g0737123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[2] = "rbhwyuzxsde7rgyuujb84rf5hy8i90peola923v4bn6geftnyhxcefcothplokl1ijnv34vjqw3redbq76hmplmkiwffgty
36yhsfg4a3fg0yu9ypoxpxcvb34gz445667d2as2dlokh086t123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[3] = "mnb5vcxnzlkijhgqfdszapo7iuyptre2wqmknbv3cxz8lkjfhgfcdsaepoi1uytbrewlqmnwbvcgxzl0kjh6gfdssapdoiu
vytryewq4mnb9vcxozlkujhgxfdsrapojiuyttremwqmhnbva123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[4] = "lkjohgf3dsarpoi9uytfrewmqmnebvcdxzlqkjhvgfdwsapgoiu5ytriewqxmnbnvcxlzlkyjhg2fdshaposiuyatrezwqm
0nbv8cxz1lkj4hgf7dsatpoiuuytcrewbqmnpbvcjxzpkoiu6123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[5] = "jfrnugc7nhgwerirbhf9qwx523gbj6s2df06k7vk2dam12sicvuxherztyxdkoglqwdvytbyvdc8gftujygjdawartyhpol
gjgxpswzqqwefhye4asdtvfz1aejckiyoajs0e56365ge3jbs123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[6] = "qazjwsx5edc0rfvhtgbqyhnrujm2ikm3olp6qaz4ploiokmvijnkuhb8ygvdtfcardx9esznwaqgqwesfgheyjc1fgel45g
whjbmsdfz3fdbd78o834c6bdf23v7g34ubhjtlo8x5fsydb4p123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[7] = "3gbgj8gd9lorlol754dnf74t2bgijk8zik4e1sdb3buy6yh23fgc7yhj7dhh9ok0pl8q3d2m12csgby6ttfwdvhotyb9upz
xsdfuthq4w4tk67yp9gd16gh31avlb74f37la07387jb557hv123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[8] = "uhf434cj156f856720410983036q75161509159p685i021z21gtgt5vdeyotlmxopqczxfyghtwyuz5xgj81230tyhuqaz
rujmetfcgtgb2tgvmedchfrsldp8b783n146d85ka869kdt0s123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[9] = "qwejrtybuio9pas5mnb0vcxhzlkqjhg1fdsvapo7iuymtgbpef4e845w3602025l790x568r128i1203568sthb812s4vgh
apoqggytzhmntiozofgyuefckthqfwec6tghcyujyaz3d456n123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"

    $EXP = ""
    $CodesetToUse[1] = ""
    $CodesetToUse[2] = ""
    $RawCode = ""
    $CodesetToUse[1] = Random(0, 9, 1)
    $CodesetToUse[2] = Random(0, 9, 1)
    $RawCode &= $Constent
    $RawCode &= SubStringBJ($myname, 1, 2)
    $RawCode &= SubStringBJ($myname, StringLen($myname), StringLen($myname))
    $RawCode &= StringLen($myxp)
    $RawCode &= "-"
    $EXP = $myxp
    $AIndex = 1
    $AIndexEnd = 6 - StringLen($myxp)
    While NOT ($AIndex > $AIndexEnd) ;<<<<<<<<<<<<<<<<<<<<<
        $TempRandom = Random(1, 36, 1)
        $EXP = SubStringBJ($OriginalSet, $TempRandom, $TempRandom) & $EXP
        $AIndex += 1
    WEnd
    $RawCode &= $EXP
    $RawCode &= $Constent
    ;$RawCode=StringCase($RawCode,false)
    $RawCode = StringLower($RawCode);<<<<<<<<<<<<<<<<<<<<<
    $CompletedCode = ""
    $AIndex = 1
    $AIndexEnd = StringLen($RawCode) 
    While NOT ($AIndex > $AIndexEnd) ;<<<<<<<<<<<<<<<<<<<<<
        $BIndex = 1
        $BIndexEnd = 51
        While NOT ($BIndex > $BIndexEnd) ;<<<<<<<<<<<<<<<<<<<<<
            If SubStringBJ($RawCode, $AIndex, $AIndex) = SubStringBJ($OriginalSet, $BIndex, $BIndex) Then ;<<<<<<<<<<<<<<<<<<<<<
                $TempLetter = SubStringBJ($Codesets2[$CodesetToUse[2]], ($BIndex * 3)+$BIndex, ($BIndex * 3) + $BIndex) ;<<<<<<<<<<<<<<<<<<<<<
                $For1 = 1
                While NOT ($For1>51);<<<<<<<<<<<<<<<<<<<<<
                    If $TempLetter = SubStringBJ($OriginalSet, $For1, $For1) Then $CompletedCode &= SubStringBJ($Codesets[$CodesetToUse[1]], $For1, $For1)
                    $For1 += 1
                WEnd
            EndIf
            $BIndex += 1
        WEnd
        $AIndex += 1
    WEnd
    $AIndex = 1
    $AIndexEnd = 10
    While NOT ($AIndex > $AIndexEnd) ;<<<<<<<<<<<<<<<<<<<<<
        If SubStringBJ($CodesetToUse[1], 1, 1) = SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[1] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        If SubStringBJ($CodesetToUse[2], 1, 1) = SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[2] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        $AIndex += 1
    WEnd
    $CompletedCode = ($CodesetToUse[1] & $CodesetToUse[2] & $CompletedCode)
    
    Return $CompletedCode
EndFunc   ;==>GetCode
Edited by weaponx
Link to comment
Share on other sites

Hey all, I found this PHP code, and want to convert it to autoit. I tried my best using my limited knowledge of PHP and PHP.net reference but unfortunately, the code doesnt work.

PHP code

As you can see, the code generates 14 characters separated by a hyphen.

My Code:

#include <string.au3>

$Title = "Dawn of the Deadv5.2 Code Generator"
$UN = InputBox($Title, "Input Your Username", "impic")
$EXP = InputBox($Title, "Input Your Desired XP", 999999)
$Code = GetCode($UN, $EXP)
MsgBox(0, "Result", "Username: " & $UN & @CRLF & "XP: " & $EXP & @CRLF & "Code: " & @CRLF & $Code)
ClipPut("-load " & $Code)


Func SubStringBJ($str, $from, $to)
    $from -= 1
    $to -= 1
    Return substring($str, $from, ($to - $from) + 1)
EndFunc   ;==>SubStringBJ

Func substring($str, $start, $count)
    If $start < 0 Then
        $start = abs($start)
        $str = _StringReverse($str)
        Return StringMid($str, $start, $count)
    Else
        Return StringMid($str, $start, $count)
    EndIf
EndFunc

Func GetCode($myname, $myxp)
    Dim $Codesets[10], $Codesets2[10], $CodesetToUse[3]
    $Constent = "x"
    $OriginalSet = "3khyirlv8nbd6efm5g902c1as7xjz4uqpowt`~!@#$^&*()-_=+"
    $NumberSet1 = "qdrbyujhpl"
    $NumberSet2 = "9213568740"
    $Codesets[0] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[1] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets[2] = "osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+"
    $Codesets[3] = "hy9asolwf5gk0tmj14i8nbd6xp7vecuqr2z3`~!@#$^&*()-_=+"
    $Codesets[4] = "mgfy7kwcn8xupo0e9sjib2z3h15qr4davtl6`~!@#$^&*()-_=+"
    $Codesets[5] = "7vogm1zsdxw59ykhn4ec2jtf3u8pqra06bil`~!@#$^&*()-_=+"
    $Codesets[6] = "0uh9wir4fz3kpcbyd2a1lt6jnqmge85svox7`~!@#$^&*()-_=+"
    $Codesets[7] = "w3kjaq5ve19ulopcbhyr2dgxfm0s8n7i4t6z`~!@#$^&*()-_=+"
    $Codesets[8] = "ebjoq0zkx2g5sih8a9d31c6ylwpm4fun7tvr`~!@#$^&*()-_=+"
    $Codesets[9] = "fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+"
    $Codesets2[0] = "qwe4rtysuiotpashdfgphjk7lzx5cvbbnmq6werutyufiopjasd8fghrjklwzxcgvbnimqwdertyyuioopaasdfkghjvklz2xcvxbnm1qwe0rtymuiozpasndfg9hjkelzxlcvbqnmqcwer3123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[1] = "asdffgh0jklmzxcovbn3mqwqerteyuivoparsdf6ghj2klzjxcvbbnm4qwecrtyauiotpasidfg9hjkllzx8cvbznmq5werptyuxiopkasdyfghhjkluzxcwvbn1mqwsertnyuidoh6g0737123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[2] = "rbhwyuzxsde7rgyuujb84rf5hy8i90peola923v4bn6geftnyhxcefcothplokl1ijnv34vjqw3redbq76hmplmkiwffgty36yhsfg4a3fg0yu9ypoxpxcvb34gz445667d2as2dlokh086t123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[3] = "mnb5vcxnzlkijhgqfdszapo7iuyptre2wqmknbv3cxz8lkjfhgfcdsaepoi1uytbrewlqmnwbvcgxzl0kjh6gfdssapdoiuvytryewq4mnb9vcxozlkujhgxfdsrapojiuyttremwqmhnbva123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[4] = "lkjohgf3dsarpoi9uytfrewmqmnebvcdxzlqkjhvgfdwsapgoiu5ytriewqxmnbnvcxlzlkyjhg2fdshaposiuyatrezwqm0nbv8cxz1lkj4hgf7dsatpoiuuytcrewbqmnpbvcjxzpkoiu6123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[5] = "jfrnugc7nhgwerirbhf9qwx523gbj6s2df06k7vk2dam12sicvuxherztyxdkoglqwdvytbyvdc8gftujygjdawartyhpolgjgxpswzqqwefhye4asdtvfz1aejckiyoajs0e56365ge3jbs123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[6] = "qazjwsx5edc0rfvhtgbqyhnrujm2ikm3olp6qaz4ploiokmvijnkuhb8ygvdtfcardx9esznwaqgqwesfgheyjc1fgel45gwhjbmsdfz3fdbd78o834c6bdf23v7g34ubhjtlo8x5fsydb4p123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[7] = "3gbgj8gd9lorlol754dnf74t2bgijk8zik4e1sdb3buy6yh23fgc7yhj7dhh9ok0pl8q3d2m12csgby6ttfwdvhotyb9upzxsdfuthq4w4tk67yp9gd16gh31avlb74f37la07387jb557hv123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[8] = "uhf434cj156f856720410983036q75161509159p685i021z21gtgt5vdeyotlmxopqczxfyghtwyuz5xgj81230tyhuqazrujmetfcgtgb2tgvmedchfrsldp8b783n146d85ka869kdt0s123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"
    $Codesets2[9] = "qwejrtybuio9pas5mnb0vcxhzlkqjhg1fdsvapo7iuymtgbpef4e845w3602025l790x568r128i1203568sthb812s4vghapoqggytzhmntiozofgyuefckthqfwec6tghcyujyaz3d456n123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+"

    $EXP = ""
    $CodesetToUse[1] = ""
    $CodesetToUse[2] = ""
    $RawCode = ""
    $CodesetToUse[1] = Random(0, 9, 1)
    $CodesetToUse[2] = Random(0, 9, 1)
    $RawCode &= $Constent
    $RawCode &= SubStringBJ($myname, 1, 2)
    $RawCode &= SubStringBJ($myname, StringLen($myname), StringLen($myname))
    $RawCode &= StringLen($myxp)
    $RawCode &= "-"
    $EXP = $myxp
    $AIndex = 1
    $AIndexEnd = 6 - StringLen($myxp)
    While $AIndex <= $AIndexEnd
        $TempRandom = Random(1, 36, 1)
        $EXP = SubStringBJ($OriginalSet, $TempRandom, $TempRandom) & $EXP
        $AIndex += 1
    WEnd
    $RawCode &= $EXP
    $RawCode &= $Constent
    ;$RawCode=StringCase($RawCode,false)
    $RawCode = StringUpper($RawCode)
    $CompletedCode = ""
    $AIndex = 1
    $AIndexEnd = StringLen($RawCode)
    While $AIndex <= $AIndexEnd
        $BIndex = 1
        $BIndexEnd = 51
        While $BIndex <= $BIndexEnd
            If SubStringBJ($RawCode, $AIndex, $AIndex) == SubStringBJ($OriginalSet, $BIndex, $BIndex) Then
                $TempLetter = SubStringBJ($Codesets2[$CodesetToUse[2]], $BIndex * 4, $BIndex * 4)
                $For1 = 1
                While $For1 <= 51
                    If $TempLetter == SubStringBJ($OriginalSet, $For1, $For1) Then $CompletedCode &= SubStringBJ($Codesets[$CodesetToUse[1]], $For1, $For1)
                    $For1 += 1
                WEnd
            EndIf
            $BIndex += 1
        WEnd
        $AIndex += 1
    WEnd
    $AIndex = 1
    $AIndexEnd = 10
    While $AIndex <= $AIndexEnd
        If SubStringBJ($CodesetToUse[1], 1, 1) == SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[1] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        If SubStringBJ($CodesetToUse[2], 1, 1) == SubStringBJ($NumberSet2, $AIndex, $AIndex) Then $CodesetToUse[2] = SubStringBJ($NumberSet1, $AIndex, $AIndex)
        $AIndex += 1
    WEnd
    $CompletedCode = ($CodesetToUse[1] & $CodesetToUse[2] & $CompletedCode)
    Return $CompletedCode
EndFunc   ;==>GetCode

This only generates 9 digits... :)

Someone please shed light on mah problem!

Still digging through the comparison between original PHP and converted AutoIt code, but the first variation that stands out is that your StringUpper() should be a StringLower() if I'm reading the source correctly. That being said, that only sets the string length at 11 characters, still 3 shy (not to mention still no hyphen).

And for the sake of testing result lengths, just a suggestion to change your MsgBox() code to:

MsgBox(0, "Result", "Username: " & $UN & @CRLF & "XP: " & $EXP & @CRLF & "Code: " & @CRLF & $Code &@CRLF &"(" &StringLen($Code) &" chars)")
to avoid the tedium of counting manually :(

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Tha PHP code is a pile of shit.

Yes, It appears to do MANY very redundant things.

For Instance:

($BIndex * 3)+$BIndex; How is this not = $BIndex * 4? 3x+x = 4x? no?oÝ÷ Ø    l£Z¶Ì"¶X§Øb²«¨µ+JÚâIªê-éܶ*'nën²)ඬjg¯j[±ú+¶¥jËv¥ªÚë^®Á1jjey«­¢+ÙMÕMÑÉ¥¹    ( ÀÌØíIÝ
½°ÀÌØí%¹à°ÀÌØí%¹à

Redundant isn't it? If hes only gonna call it with the same last two params, who not just eliminate the last param and make it = 1?

Yet, despite this roundaboutness, his code works and mine doesnt.... I can't figure it out... :)

Edited by Paulie
Link to comment
Share on other sites

I did a 1-1 translation without any optimizations and it still only returns 11 characters, without a dash. Whoever wrote this php code should be shot.

Dim $udg_Codesets[10], $udg_Codesets2[10], $udg_CodesetToUse[3]

    $myxp = "impic"
    $myname = "999999"
    
    $udg_Constent="x";
    $udg_OriginalSet="3khyirlv8nbd6efm5g902c1as7xjz4uqpowt`~!@#$^&*()-_=+";
    $udg_NumberSet1="qdrbyujhpl";
    $udg_NumberSet2="9213568740";
    $udg_Codesets[0]="osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+";
    $udg_Codesets[1]="fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+";
    $udg_Codesets[2]="osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+";
    $udg_Codesets[3]="hy9asolwf5gk0tmj14i8nbd6xp7vecuqr2z3`~!@#$^&*()-_=+";
    $udg_Codesets[4]="mgfy7kwcn8xupo0e9sjib2z3h15qr4davtl6`~!@#$^&*()-_=+";
    $udg_Codesets[5]="7vogm1zsdxw59ykhn4ec2jtf3u8pqra06bil`~!@#$^&*()-_=+";
    $udg_Codesets[6]="0uh9wir4fz3kpcbyd2a1lt6jnqmge85svox7`~!@#$^&*()-_=+";
    $udg_Codesets[7]="w3kjaq5ve19ulopcbhyr2dgxfm0s8n7i4t6z`~!@#$^&*()-_=+";
    $udg_Codesets[8]="ebjoq0zkx2g5sih8a9d31c6ylwpm4fun7tvr`~!@#$^&*()-_=+";
    $udg_Codesets[9]="fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+";
    $udg_Codesets2[0]="qwe4rtysuiotpashdfgphjk7lzx5cvbbnmq6werutyufiopjasd8fghrjklwzxcgvbnimqwdertyyuioopaasdfkghjvklz
2xcvxbnm1qwe0rtymuiozpasndfg9hjkelzxlcvbqnmqcwer3123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[1]="asdffgh0jklmzxcovbn3mqwqerteyuivoparsdf6ghj2klzjxcvbbnm4qwecrtyauiotpasidfg9hjkllzx8cvbznmq5wer
ptyuxiopkasdyfghhjkluzxcwvbn1mqwsertnyuidoh6g0737123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[2]="rbhwyuzxsde7rgyuujb84rf5hy8i90peola923v4bn6geftnyhxcefcothplokl1ijnv34vjqw3redbq76hmplmkiwffgty
36yhsfg4a3fg0yu9ypoxpxcvb34gz445667d2as2dlokh086t123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[3]="mnb5vcxnzlkijhgqfdszapo7iuyptre2wqmknbv3cxz8lkjfhgfcdsaepoi1uytbrewlqmnwbvcgxzl0kjh6gfdssapdoiu
vytryewq4mnb9vcxozlkujhgxfdsrapojiuyttremwqmhnbva123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[4]="lkjohgf3dsarpoi9uytfrewmqmnebvcdxzlqkjhvgfdwsapgoiu5ytriewqxmnbnvcxlzlkyjhg2fdshaposiuyatrezwqm
0nbv8cxz1lkj4hgf7dsatpoiuuytcrewbqmnpbvcjxzpkoiu6123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[5]="jfrnugc7nhgwerirbhf9qwx523gbj6s2df06k7vk2dam12sicvuxherztyxdkoglqwdvytbyvdc8gftujygjdawartyhpol
gjgxpswzqqwefhye4asdtvfz1aejckiyoajs0e56365ge3jbs123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[6]="qazjwsx5edc0rfvhtgbqyhnrujm2ikm3olp6qaz4ploiokmvijnkuhb8ygvdtfcardx9esznwaqgqwesfgheyjc1fgel45g
whjbmsdfz3fdbd78o834c6bdf23v7g34ubhjtlo8x5fsydb4p123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[7]="3gbgj8gd9lorlol754dnf74t2bgijk8zik4e1sdb3buy6yh23fgc7yhj7dhh9ok0pl8q3d2m12csgby6ttfwdvhotyb9upz
xsdfuthq4w4tk67yp9gd16gh31avlb74f37la07387jb557hv123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[8]="uhf434cj156f856720410983036q75161509159p685i021z21gtgt5vdeyotlmxopqczxfyghtwyuz5xgj81230tyhuqaz
rujmetfcgtgb2tgvmedchfrsldp8b783n146d85ka869kdt0s123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[9]="qwejrtybuio9pas5mnb0vcxhzlkqjhg1fdsvapo7iuymtgbpef4e845w3602025l790x568r128i1203568sthb812s4vgh
apoqggytzhmntiozofgyuefckthqfwec6tghcyujyaz3d456n123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    
    Func SubStringBJ($str, $from, $to)

        $from-=1;
        $to-=1;
        return StringMid($str, $from, ($to - $from) + 1);
    EndFunc

    $udg_EXP="";
  $udg_CodesetToUse[1]="";
  $udg_CodesetToUse[2]="";
  $udg_RawCode="";
  $udg_CodesetToUse[1]=(random(0,9,1));
  $udg_CodesetToUse[2]=(random(0,9,1));
  $udg_RawCode=($udg_RawCode & $udg_Constent);
  $udg_RawCode=($udg_RawCode & SubStringBJ($myname,1,2));
  $udg_RawCode=($udg_RawCode & SubStringBJ($myname,stringlen($myname),stringlen($myname)));
  $udg_RawCode=($udg_RawCode & stringlen($myxp));
  $udg_RawCode=($udg_RawCode & "-");
  $udg_EXP=$myxp;
  $bj_forwhileAIndex=1;
  $bj_forwhileAIndexEnd=(6-stringlen($myxp));
    while (NOT($bj_forwhileAIndex>$bj_forwhileAIndexEnd))

      $udg_TempRandom=random(1,36,1);
      $udg_EXP=(SubStringBJ($udg_OriginalSet,$udg_TempRandom,$udg_TempRandom) & $udg_EXP);
      $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $udg_RawCode=($udg_RawCode & $udg_EXP);
  $udg_RawCode=($udg_RawCode & $udg_Constent);
  ;$udg_RawCode=StringCase($udg_RawCode,false);
  $udg_RawCode=stringlower($udg_RawCode);
  $udg_CompletedCode="";
  $bj_forwhileAIndex=1;
  $bj_forwhileAIndexEnd=stringlen($udg_RawCode);
    while (NOT($bj_forwhileAIndex>$bj_forwhileAIndexEnd))

      $bj_forwhileBIndex=1;
      $bj_forwhileBIndexEnd=51;
        while (NOT($bj_forwhileBIndex>$bj_forwhileBIndexEnd))

            if(SubStringBJ($udg_RawCode,$bj_forwhileAIndex,$bj_forwhileAIndex)=SubStringBJ($udg_OriginalSet,$bj_forwhileBIndex,$bj_forwhileBIndex)) Then

              $udg_TempLetter=SubStringBJ($udg_Codesets2[$udg_CodesetToUse[2]],(($bj_forwhileBIndex*3)+$bj_forwhileBIndex),(($bj_forwhileBIndex*3)+$bj_forwhileBIndex));
              $udg_For1=1;
                while (NOT($udg_For1>51))

                    If($udg_TempLetter=SubStringBJ($udg_OriginalSet,$udg_For1,$udg_For1)) Then
                      $udg_CompletedCode=($udg_CompletedCode & SubStringBJ($udg_Codesets[$udg_CodesetToUse[1]],$udg_For1,$udg_For1));
                    EndIf
                  $udg_For1=$udg_For1+1;
                WEnd
            EndIf
          $bj_forwhileBIndex=$bj_forwhileBIndex+1;
        WEnd
      $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $bj_forwhileAIndex=1;
  $bj_forwhileAIndexEnd=10;
    while (NOT($bj_forwhileAIndex>$bj_forwhileAIndexEnd))

        If(SubStringBJ($udg_CodesetToUse[1],1,1)=SubStringBJ($udg_NumberSet2,$bj_forwhileAIndex,$bj_forwhileAIndex)) Then
          $udg_CodesetToUse[1]=SubStringBJ($udg_NumberSet1,$bj_forwhileAIndex,$bj_forwhileAIndex);
        EndIf
        If(SubStringBJ($udg_CodesetToUse[2],1,1)=SubStringBJ($udg_NumberSet2,$bj_forwhileAIndex,$bj_forwhileAIndex)) Then
          $udg_CodesetToUse[2]=SubStringBJ($udg_NumberSet1,$bj_forwhileAIndex,$bj_forwhileAIndex);
        EndIf
        $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $udg_CompletedCode=($udg_CodesetToUse[1] & ($udg_CodesetToUse[2] & $udg_CompletedCode));
  
  ConsoleWrite( 'Nick: ' & $myname & '<br />XP: ' & $myxp & '<br />Code: ' & $udg_CompletedCode & '<br /><br />Source: <br />');
Edited by weaponx
Link to comment
Share on other sites

  • Moderators

I'm curious on what relevance this piece of (going to refrain from weaponx's choice of words and use the word "code" :) ) code has to anything.

It seems to me that potentially the very same (correct) output could be achieved with just a few lines of code.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I converted it from new, and now it works. I think it was mainly the SubstringBJ that was wrong.

Local $myname =     "impic"
Local $myxp = 999999
MsgBox(0,"", 'Nick: ' & $myname & @CRLF & 'XP: ' & $myxp & @CRLF & 'Code: ' & _UDG_CODE($myxp,$myname)) 

; THE Converted code

Opt("MustDeclareVars",1)
Func _UDG_CODE($myxp,  $myname)
    Local $udg_CompletedCode, $udg_TempRandom,$udg_For1,$bj_forwhileBIndex,$bj_forwhileBIndexEnd
    Local $udg_Constent="x";
    Local $udg_OriginalSet="3khyirlv8nbd6efm5g902c1as7xjz4uqpowt`~!@#$^&*()-_=+";
    Local $udg_NumberSet1="qdrbyujhpl";
    Local $udg_NumberSet2="9213568740";
    Local $udg_Codesets[10],$udg_Codesets2[10]
    $udg_Codesets[0]="osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+";
    $udg_Codesets[1]="fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+";
    $udg_Codesets[2]="osi40hnlx1ctbmap5e8zguj279f3yd6wrkqv`~!@#$^&*()-_=+";
    $udg_Codesets[3]="hy9asolwf5gk0tmj14i8nbd6xp7vecuqr2z3`~!@#$^&*()-_=+";
    $udg_Codesets[4]="mgfy7kwcn8xupo0e9sjib2z3h15qr4davtl6`~!@#$^&*()-_=+";
    $udg_Codesets[5]="7vogm1zsdxw59ykhn4ec2jtf3u8pqra06bil`~!@#$^&*()-_=+";
    $udg_Codesets[6]="0uh9wir4fz3kpcbyd2a1lt6jnqmge85svox7`~!@#$^&*()-_=+";
    $udg_Codesets[7]="w3kjaq5ve19ulopcbhyr2dgxfm0s8n7i4t6z`~!@#$^&*()-_=+";
    $udg_Codesets[8]="ebjoq0zkx2g5sih8a9d31c6ylwpm4fun7tvr`~!@#$^&*()-_=+";
    $udg_Codesets[9]="fx4cqbpyudrj7ktlmoie13w6gz05v29s8nah`~!@#$^&*()-_=+";
    $udg_Codesets2[0]="qwe4rtysuiotpashdfgphjk7lzx5cvbbnmq6werutyufiopjasd8fghrjklwzxcgvbnimqwdertyyuioopaasdfkghjvklz2xcvxbnm1qwe0rtymuiozpasndfg9hjkelzxlcvbqnmqcwer3123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[1]="asdffgh0jklmzxcovbn3mqwqerteyuivoparsdf6ghj2klzjxcvbbnm4qwecrtyauiotpasidfg9hjkllzx8cvbznmq5werptyuxiopkasdyfghhjkluzxcwvbn1mqwsertnyuidoh6g0737123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[2]="rbhwyuzxsde7rgyuujb84rf5hy8i90peola923v4bn6geftnyhxcefcothplokl1ijnv34vjqw3redbq76hmplmkiwffgty36yhsfg4a3fg0yu9ypoxpxcvb34gz445667d2as2dlokh086t123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[3]="mnb5vcxnzlkijhgqfdszapo7iuyptre2wqmknbv3cxz8lkjfhgfcdsaepoi1uytbrewlqmnwbvcgxzl0kjh6gfdssapdoiuvytryewq4mnb9vcxozlkujhgxfdsrapojiuyttremwqmhnbva123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[4]="lkjohgf3dsarpoi9uytfrewmqmnebvcdxzlqkjhvgfdwsapgoiu5ytriewqxmnbnvcxlzlkyjhg2fdshaposiuyatrezwqm0nbv8cxz1lkj4hgf7dsatpoiuuytcrewbqmnpbvcjxzpkoiu6123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[5]="jfrnugc7nhgwerirbhf9qwx523gbj6s2df06k7vk2dam12sicvuxherztyxdkoglqwdvytbyvdc8gftujygjdawartyhpolgjgxpswzqqwefhye4asdtvfz1aejckiyoajs0e56365ge3jbs123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[6]="qazjwsx5edc0rfvhtgbqyhnrujm2ikm3olp6qaz4ploiokmvijnkuhb8ygvdtfcardx9esznwaqgqwesfgheyjc1fgel45gwhjbmsdfz3fdbd78o834c6bdf23v7g34ubhjtlo8x5fsydb4p123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[7]="3gbgj8gd9lorlol754dnf74t2bgijk8zik4e1sdb3buy6yh23fgc7yhj7dhh9ok0pl8q3d2m12csgby6ttfwdvhotyb9upzxsdfuthq4w4tk67yp9gd16gh31avlb74f37la07387jb557hv123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[8]="uhf434cj156f856720410983036q75161509159p685i021z21gtgt5vdeyotlmxopqczxfyghtwyuz5xgj81230tyhuqazrujmetfcgtgb2tgvmedchfrsldp8b783n146d85ka869kdt0s123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    $udg_Codesets2[9]="qwejrtybuio9pas5mnb0vcxhzlkqjhg1fdsvapo7iuymtgbpef4e845w3602025l790x568r128i1203568sthb812s4vghapoqggytzhmntiozofgyuefckthqfwec6tghcyujyaz3d456n123`456~789!012@345#678$234^567&890*123(456)789-012_345=678+";
    


    Local $udg_EXP="";
    Local $udg_CodesetToUse[3]
  $udg_CodesetToUse[1]="";
  $udg_CodesetToUse[2]="";
  Local $udg_RawCode="";
  $udg_CodesetToUse[1]=(Random(0,9,1));
  $udg_CodesetToUse[2]=(Random(0,9,1));
  $udg_RawCode=($udg_RawCode&$udg_Constent);
  $udg_RawCode=($udg_RawCode & SubStringBJ($myname,1,2));
  $udg_RawCode=($udg_RawCode & SubStringBJ($myname,stringlen($myname),stringlen($myname)));
  $udg_RawCode=($udg_RawCode  & stringlen($myxp));
  $udg_RawCode=($udg_RawCode & "-");
  $udg_EXP=$myxp;
  Local $bj_forwhileAIndex=1;
  Local $bj_forwhileAIndexEnd=(6-stringlen($myxp));
    while (Not ($bj_forwhileAIndex > $bj_forwhileAIndexEnd))
    
      $udg_TempRandom=Random(1,36,1);
      $udg_EXP=(SubStringBJ($udg_OriginalSet,$udg_TempRandom,$udg_TempRandom) & $udg_EXP);
      $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $udg_RawCode=($udg_RawCode & $udg_EXP);
  $udg_RawCode=($udg_RawCode & $udg_Constent);
;~   //$udg_RawCode=StringCase($udg_RawCode,false);
  $udg_RawCode=stringlower($udg_RawCode);
  Local $udg_CompletedCode="";
  Local $bj_forwhileAIndex=1;
  Local $bj_forwhileAIndexEnd=stringlen($udg_RawCode);
    while (Not ($bj_forwhileAIndex > $bj_forwhileAIndexEnd))
    
      $bj_forwhileBIndex=1;
      $bj_forwhileBIndexEnd=51;
        while ( not ($bj_forwhileBIndex>$bj_forwhileBIndexEnd))
        
            if (SubStringBJ($udg_RawCode,$bj_forwhileAIndex,$bj_forwhileAIndex)==SubStringBJ($udg_OriginalSet,$bj_forwhileBIndex,$bj_forwhileBIndex)) Then
            
              Local $udg_TempLetter=SubStringBJ($udg_Codesets2[$udg_CodesetToUse[2]],(($bj_forwhileBIndex*3)+$bj_forwhileBIndex),(($bj_forwhileBIndex*3)+$bj_forwhileBIndex));
              $udg_For1=1;
                while (NOt ($udg_For1 > 51))
                
                    if($udg_TempLetter==SubStringBJ($udg_OriginalSet,$udg_For1,$udg_For1)) Then _
                      $udg_CompletedCode=($udg_CompletedCode & SubStringBJ($udg_Codesets[$udg_CodesetToUse[1]],$udg_For1,$udg_For1));
                  $udg_For1=$udg_For1+1;
                WEnd
            EndIf
          $bj_forwhileBIndex=$bj_forwhileBIndex+1;
        WEnd
      $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $bj_forwhileAIndex=1;
  $bj_forwhileAIndexEnd=10;
    while ( Not ($bj_forwhileAIndex > $bj_forwhileAIndexEnd))
    
        if(SubStringBJ($udg_CodesetToUse[1],1,1)==SubStringBJ($udg_NumberSet2,$bj_forwhileAIndex,$bj_forwhileAIndex)) Then _
          $udg_CodesetToUse[1]=SubStringBJ($udg_NumberSet1,$bj_forwhileAIndex,$bj_forwhileAIndex);
        if(SubStringBJ($udg_CodesetToUse[2],1,1)==SubStringBJ($udg_NumberSet2,$bj_forwhileAIndex,$bj_forwhileAIndex)) Then _
          $udg_CodesetToUse[2]=SubStringBJ($udg_NumberSet1,$bj_forwhileAIndex,$bj_forwhileAIndex);
        $bj_forwhileAIndex=$bj_forwhileAIndex+1;
    WEnd
  $udg_CompletedCode=($udg_CodesetToUse[1] & ($udg_CodesetToUse[2] & $udg_CompletedCode));
  Return $udg_CompletedCode
  EndFunc
    
func SubStringBJ($str, $from, $to)
    
;~         $from-=1;
;~         $to-=1;
;~         return substr($str, $from, ($to - $from) + 1);
        Return StringMid($str, $from, $to-$from+1)
EndFunc

//Edit: Yes this has many redundant parts. But this is a Code generator, so it should look coplicated :)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

OOps, forgot to look at the homeoage.... The link to this Script is called

Dawn Of The Dead 5 (WC III Map) Codegen

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Okay, you caught me :(

Basically, me and my friend were trying to rig the save/load codes for a game we play (Dawn of the Dead) that is a survival-based RPG custom game in Warcraft III.

It's just player-vs-computer, so no one is being taken advantage of by hacking it.

Originally, me and my friend were trying to find the algorithms for code generation by trial and error :):D basically changing our usernames and EXP amounts and seeing where they synced up in the codes. It worked sorta, but it was a pain in the ass to do for each name :D

So we finally got the bright idea to open the game file itself, and sure enough we found the script that generates the code, but it was written in Warcraft III's own, JASS language, so we were googling function names, and i stumbled upon this site that had the PHP code :cheer: (You will see it is like the 3rd result when you google "SubStringBJ")

But thanks, everyone, for the help!

Edited by Paulie
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...