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 


Lua Math

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 18, 2022 12:19 pm    Post subject: Lua Math Reply with quote

Is it possible to make a math.random in writebytes?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Apr 18, 2022 12:21 pm    Post subject: Reply with quote

if you describe better what you want perhaps
_________________
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
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 18, 2022 12:25 pm    Post subject: Lua Math Reply with quote

So I want to make a randomizer in an address which contains a group of 8 FF'S but without certain values so everytime I hit the script I would like to randomize those 8 bytes with random values without certain values because the game would not load certain values for example 1C or 2A so basically a range without those two possible values
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Apr 18, 2022 12:40 pm    Post subject: Reply with quote

Code:

b={}

for i=1,8 do
  repeat
    b[i]=math.random(255)
  until not ((b[i]==0x1c) or (b[i]==0x2a))
end

writeBytes(address,b)

_________________
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
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 18, 2022 1:09 pm    Post subject: Lua Math Reply with quote

Thanks,but what if it's more than two values?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Apr 18, 2022 1:27 pm    Post subject: Reply with quote

Code:

until not ((b[i]==0x1c) or (b[i]==0x2a) or (b[i]==0x2b) or (b[i]==0x2c) or (b[i]==0x2d) or (b[i]==0x2e))


etc...

you can also use a table with invalid values and compare against that if you like

_________________
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
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 18, 2022 4:00 pm    Post subject: Lua Math Reply with quote

For some reason it still puts those values
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Apr 18, 2022 4:41 pm    Post subject: Reply with quote

are you sure there's no other code that writes those values ?

you can of course do a :
Code:

for i=1,8 do
  if (b[i]==0x1c) or (b[i]==0x2a) then
    print("it's in!!!")
  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
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 18, 2022 5:07 pm    Post subject: Lua Math Reply with quote

Ok I solved it
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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