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 


How to get the result 1,2,4,5,7,8,10, three times?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Sat Jun 02, 2018 2:44 am    Post subject: How to get the result 1,2,4,5,7,8,10, three times? Reply with quote

How to get the result 1,2,4,5,7,8,10, three times in the next code? From 1 to 10, but without 3,6,9. How do I need to change formula?
Code:
for x = 1, 21 do
local offset = 0x3*((x-1) // 2) + ((x-1) % 2) + 1
print (offset)
end

In result must be: 1,2,4,5,7,8,10, 1,2,4,5,7,8,10, 1,2,4,5,7,8,10.

or How to get the result 0,1,3,4,6,7,9, three times? From 0 to 9, but without 2,5,8.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Jun 02, 2018 3:08 am    Post subject: Reply with quote

I don't have the context in where you need it, or if you actually want to use that formula or not, or if 'if' is allowed, but this does return the result you describe
Code:

for x=1,32 do
  local offset=x%11
  if (offset % 3)>0 then
    print(offset)
  end
end


as for 0,1,3,4,6,7,9 , have you tried:
Code:

print(0)
print(1)
print(3)
print(4)
print(6)
print(7)
print(9)

lol jk

but perhaps
Code:

for x=0,29 do
  local offset=x%10
  if (offset+1)%3~=0 then print(offset) end
end

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Sat Jun 02, 2018 3:33 am    Post subject: Reply with quote

I'm using the following code:
Code:
for x = 1, 21 do
local offset1 = 0x84*((x-1) // 7)
a = bAnd(0xFFFF, readInteger(0x009E8646+offset1))
local bitss = ((x-1) % 7) + 1
local bit = ((a >> (bitss-1))  & 0x01)
if bit == 1 then
UDF1["CECheckbox"..x].Checked = true
elseif bit == 0 then
UDF1["CECheckbox"..x].Checked = false
end
end


I need for CECheckbox1 to have x=1 (I mean: bitss = 1)
for CECheckbox2 to have x=2 (bitss = 2)
for CECheckbox3 to have x=4 (bitss = 4)
for CECheckbox4 to have x=5
for CECheckbox5 to have x=7
for CECheckbox6 to have x=8
for CECheckbox7 to have x=10
then
for CECheckbox8 to have x=1
for CECheckbox9 to have x=2
for CECheckbox10 to have x=4 and so on.

or
I need for CECheckbox1 to have x=0 (I mean: bitss = 0)
for CECheckbox2 to have x=1 (bitss = 1)
for CECheckbox3 to have x=3 (bitss = 3)
for CECheckbox4 to have x=4
for CECheckbox5 to have x=6
for CECheckbox6 to have x=7
for CECheckbox7 to have x=9
then
for CECheckbox8 to have x=0
for CECheckbox9 to have x=1
for CECheckbox10 to have x=3 and so on.
I need exactly 21 in the code: for x = 1, 21 do
and the result must be 1,2,4,5,7,8,10, three times. I do not know if it possible.
Back to top
View user's profile Send private message
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