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 change this scripts "direction"

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
0Bx
How do I cheat?
Reputation: 0

Joined: 01 Jun 2021
Posts: 5

PostPosted: Sun Mar 27, 2022 11:35 am    Post subject: How to change this scripts "direction" Reply with quote

In this scrip I have a panel going right. I want to flip it so it goes left?
Code:

         local e = Main.CEPanel1
         e.Left = e.Left + 1
         if e.Left > (Main.Width + e.Width) then
         e.Left = 0 - e.Width
         end


So the panel is supposed to come back in from the opposite side
but I dont know how to achieve it.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Sun Mar 27, 2022 1:14 pm    Post subject: Re: How to change this scripts "direction" Reply with quote

You will never learn how to code by asking something this simple without first trying to understand it at all. I strongly encourage you to experiment and google if you want to get better.

There are literally THREE lines of logic in this code.
One, two, three.

Changing one thing at a time produces drastically different results and teaches you how it works by observation.

Ask yourself:
What does e.Left represent?
Why did the original programmer need a Main.Width and e.Width?
What is accomplished through the compare and set of e.Left?
How can I accomplish the inverse of these?

Experiment:
What happens if I change a 1 to a 2 or 5?
What happens if I change a (+) to a (-)?

I have never done anything with CEPanels before, so no guarantees:

Code:

         local e = Main.CEPanel1
         e.Left = e.Left - 1
         if e.Left < 0 - e.Width then
         e.Left = (Main.Width + e.Width)
         end
Back to top
View user's profile Send private message
0Bx
How do I cheat?
Reputation: 0

Joined: 01 Jun 2021
Posts: 5

PostPosted: Sun Mar 27, 2022 6:20 pm    Post subject: Re: How to change this scripts "direction" Reply with quote

cooleko wrote:
You will never learn how to code by asking something this simple without first trying to understand it at all. I strongly encourage you to experiment and google if you want to get better.

There are literally THREE lines of logic in this code.
One, two, three.

Changing one thing at a time produces drastically different results and teaches you how it works by observation.

Ask yourself:
What does e.Left represent?
Why did the original programmer need a Main.Width and e.Width?
What is accomplished through the compare and set of e.Left?
How can I accomplish the inverse of these?

Experiment:
What happens if I change a 1 to a 2 or 5?
What happens if I change a (+) to a (-)?

I have never done anything with CEPanels before, so no guarantees:

Code:

         local e = Main.CEPanel1
         e.Left = e.Left - 1
         if e.Left < 0 - e.Width then
         e.Left = (Main.Width + e.Width)
         end


Sorry and thank you
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 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