 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Thu Feb 25, 2016 2:05 pm Post subject: How to shuffle a string value |
|
|
hi...
my scripting and programming is very rusted...but...would still like to give it a go...
script functions...:
get a user text input
take the given text as a string...test if its devideable without res by a number "x"
...miror it<take string chars re organize them back to front>
...take the new string...break it into "x" parts///thus x strings where string1 +string2....+string x will make original reversed string
take each string segment and mirror//reverse it...
add the new mirrored segments together to make a new string
put the new string in a messege output
thats the encrypt function...once i git it going i would do a decrypt azswell to undo all those to be able to getr a matched version of the original first string that was user input...
here is my code so-far
Code: |
function trainerinput()
local original = '';
local newstr = '';
local newstra = '';
local newstrb = '';
local newstrc = '';
local r_newstra = '';
local r_newstrb = '';
local r_newstrc = '';
local j = 0;
local k = 0;
local l = 0;
local a = 0;
local b = 0;
local c = 0;
local x = 3;
local test1 = 0;
local t1 = 0;
local t2 = ''
local test2 = 0;
original = inputQuery("Input string: ", " ", nil)
repeat
test1 = string.len(original)
t1 = string.len(original)
test2 = string.len(original)
test1 =math.floor(test1/3/x)
test2 =math.ceil(test2/3/x)
if test1 ~= test2
then
if string.sub(original,t1,t1)==" "
then
original = original .."?? "
else
original = original .." ?? "
end
showMessage("The original string is 1: "..original)
end
until test1 == test2
showMessage("The original string is 2: "..original)
test1 = string.len(original)
test1 = test1 +1
k= string.len(original)
repeat
newstr =newstr .. string.sub(original,k,k)
k=k-1
l=l+1
until l == test1
showMessage("The original string is3: "..original.." reversed "..newstr)
k=0;
l=string.len(original) ;
l=(l)/x
a=l
b=a+l
c=b+l
j=0
showMessage("l"..l.."a"..a.."b"..b.."c"..c.."j"..j)
repeat
k=k+1
if j <= c and j>b then
repeat
newstrc = newstrc .. string.sub(newstr,j,j)
j=j+1
until j==c+2
showMessage("The original string is: 4 "..original.." reversed "..newstr.." part3
"..newstrc)
end
if j <= b and j>a then
repeat
newstrb = newstrb .. string.sub(newstr,j,j)
j=j+1
until j==b+1
showMessage("The original string is: 4 "..original.." reversed "..newstr.." part2
"..newstrb)
end
if j <= a then
repeat
newstra = newstra .. string.sub(newstr,j,j)
j=j+1
until j==a+1
showMessage("The original string is: 4 "..original.." reversed "..newstr.." part1
"..newstra)
end
showMessage("The original string is:7 "..k.." "..original)
until k == x
showMessage("The original string is: 8"..original)
k=1
l=string.len(newstra)
j=l
repeat
if (string.sub(newstra,l,l) ~= " ") and (k<j)
then
r_newstra=r_newstra .. string.sub(newstra,l-2,l-2)
r_newstra=r_newstra .. string.sub(newstra,l-1,l-1)
r_newstra=r_newstra .. string.sub(newstra,l,l)
end
r_newstra=r_newstra .. " "
l=l-3
k=k+3
until k>=j
showMessage("The original string is: 9 "..original)
k=1
l=string.len(newstrb)
j=l
repeat
showMessage("The strung part b "..newstrb.. " reverse " .. r_newstrb)
if (string.sub(newstrb,l,l) ~= " ") and (k<j)
then
r_newstrb=r_newstrb .. string.sub(newstrb,l-2,l-2)
r_newstrb=r_newstrb .. string.sub(newstrb,l-1,l-1)
r_newstrb=r_newstrb .. string.sub(newstrb,l,l)
end
r_newstrb=r_newstrb .. " "
l=l-3
k=k+3
until k>=j
showMessage("The original string is 10: "..original)
k=1
l=string.len(newstrc)
j=l
repeat
showMessage("The strung part c "..newstrc.. " reverse " .. r_newstrc)
if (string.sub(newstrc,l,l) ~= " ") and (k<j)
then
r_newstrc=r_newstrc .. string.sub(newstrc,l-2,l-2)
r_newstrc=r_newstrc .. string.sub(newstrc,l-1,l-1)
r_newstrc=r_newstrc .. string.sub(newstrc,l,l)
end
r_newstrc=r_newstrc .. " "
l=l-3
k=k+3
until k>=j
showMessage("The strung part b "..newstrb.. " reverse " .. r_newstrb)
showMessage("The strung part c "..newstrc.. " reverse " .. r_newstrc)
newstr = r_newstra .. r_newstrb .. r_newstrc
showMessage("The original string is : "..original.."The shuffled string is: "..newstr)
end
-------Main---
trainerinput(); |
im fisrtly unable to get a popup which enables the user to input a string...
edit...thnx a lot to Zanzer for inputQuery
got it sorted...
now i get lua errors, on original.len()...i would like to get the lenght of the string var original...do a calculation with it...etc...
and 2ndly...how to add 2 sor more strings together...like... newstr =newstr + original[k]
where [k] is the number k charcacter of the original string...and add that to a new string im creating...
any help for the noob will b greatly apreciated...
Last edited by Ludwig on Fri Feb 26, 2016 2:31 pm; edited 2 times in total |
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Feb 25, 2016 2:16 pm Post subject: |
|
|
Code: | inputQuery("Message Monster", "Feed me some text:", nil) |
|
|
Back to top |
|
 |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Thu Feb 25, 2016 3:04 pm Post subject: |
|
|
Zanzer wrote: | Code: | inputQuery("Message Monster", "Feed me some text:", nil) |
|
thnx...
pacal would hv been readln...
|
|
Back to top |
|
 |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Fri Feb 26, 2016 2:32 pm Post subject: |
|
|
got it sorted... ...though there might b much shorter ways to do it...
nxt is the reverse of it...plan to use it for aob's...
reverse also done...
can anyone point me to how i can save variable''s into an txt file on my pc?
|
|
Back to top |
|
 |
|
|
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 vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|