Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


why does this stop at 99 ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Sat Jul 30, 2022 6:42 pm    Post subject: why does this stop at 99 ? Reply with quote

mTbl = {"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
}

nTbl = {"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
}

function generate(atbl,btbl,loop,rst)
res = ""
s = #atbl
if rst==2 then
for i,k in pairs(btbl) do
res = res .. k .. "" .. atbl[loop] .. "\n"
end
end
if rst==3 then
for i,k in pairs(btbl) do
--if i~=loop then s = atbl[loop] end
res = res .. btbl[i] .. "" .. btbl[s] .. "" .. atbl[loop] .. "\n"
s = tonumber(s) - 1
--print(res)
end
end
s = tonumber(s) - 1
return res
end

-- 2 tbl
YHUK = generate(nTbl,mTbl,1,3) --3 tbl
HMUK = generate(nTbl,mTbl,2,3) --3 tbl
GMUK = generate(nTbl,mTbl,3,3) --3 tbl
LVUK = generate(nTbl,mTbl,4,3) --3 tbl
YHUS = generate(nTbl,mTbl,5,3) --3 tbl
HMUS = generate(nTbl,mTbl,6,3) --3 tbl
GMUS = generate(nTbl,mTbl,7,3) --3 tbl

COLLECTIVE = ((YHUK) .. (HMUK) .. (GMUK) .. (LVUK) .. (YHUS) .. (HMUS) .. (GMUS))

amt = 1
function createfor(sender)
YHUK = generate(nTbl,mTbl,(amt),3)
if amt ~="99" then
print(a)
amt = amt + 1
createfor()
end
end

createfor()

_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jul 30, 2022 8:16 pm    Post subject: Reply with quote

Because this counter :

Code:
if amt ~="99" then
print(a)
..
..


The counter allow the function to print 'amt' as long as the counter not equal to 99.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Jul 31, 2022 3:36 am    Post subject: Reply with quote

Code:
mTbl = {"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
}

nTbl = {"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
}

function generate(atbl,btbl,loop,rst)
res = ""
s = #atbl
if rst==2 then
for i,k in pairs(btbl) do
res = res .. k .. "" .. atbl[loop] .. "\n"
end
end
if rst==3 then
for i,k in pairs(btbl) do
res = res .. btbl[i] .. "" .. btbl[s] .. "" .. atbl[loop] .. "\n"
s = tonumber(s) - 1
--print(res)
end
end
s = tonumber(s) - 1
return res
end

--"amt" must be equal to the current table length.
--"amt" must be a number (99), not a string ("99").
--Use below code to avoid infinite loop and loop 99.

amt = 1
Loop = 0
findLoop = 0

function createfor(sender)
YHUK = generate(nTbl,mTbl,(amt),3)
if Loop ~= findLoop then
 print(YHUK) -- a ?
 amt = tonumber(amt) + 1
 --check amt = #nTbl then ..
 ftbl = #nTbl + 1
 if amt==ftbl then amt = 1 end
 Loop = tonumber(Loop) + 1
 createfor()
 else
 print("finish loop: "..Loop)
end
end

findLoop = 17 -- or 25 .. or 99 .. Or "Not Responding" :) ..
createfor()


It will give you the same output again in loops after the table length.
So don't give the loop more than the table length.

findLoop = 9

or

findLoop = #nTbl

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Sun Jul 31, 2022 4:45 am    Post subject: Reply with quote

Thank you, this is what I needed. I did not know about tonumber and loop function
_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites