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 


[HELP] Rollover image

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Sat Jul 11, 2020 10:14 pm    Post subject: [HELP] Rollover image Reply with quote

I've tried the following but it doesn't work
I'm creating a rollover image button using two different images

On mouse enter and Mouse leave


Normal state:


Rollover state:




Code:
function launcherGUI_btnActivateNormalMouseEnter(sender)
launcherGUI.btnActivateRollover.visable = true;
launcherGUI.btnActivateNormal.visable = false;
print "Mouse Enter";
end

function launcherGUI_btnActivateNormalMouseLeave(sender)
launcherGUI.btnActivateRollover.visable = false;
launcherGUI.btnActivateNormal.visable = true;
print "Mouse Leave";
end


Last edited by ZxPwds on Sun Jul 12, 2020 11:36 am; edited 2 times in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Jul 12, 2020 1:14 am    Post subject: Reply with quote

You need more specific. What is 'rollover image' means or actions?
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Sun Jul 12, 2020 11:32 am    Post subject: Reply with quote

Well I mean it's exactly what it is, I did use the correct term. Basically I'm I want to create an image button. So that when my mouse hovers over the image it will show a second image. It's pretty simple stuff in any programming language but I've tried with cheat engines lua im just unsuccessful.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sun Jul 12, 2020 11:35 am    Post subject: Reply with quote

it's visible not visable
_________________
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
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Sun Jul 12, 2020 11:38 am    Post subject: Reply with quote

Dark Byte wrote:
it's visible not visable


Wow Dark Byte, I actually feel pretty dumb right now. I apologize about that. I cannot believe miss spelled visible.

However it has worked. But I was wondering if there was a different way of doing this without having to put the two images in the same position. In visual basic we would do this




otherwise from what I just saw it glitches a lot
as you can see below the image gitters a lot because it doesn't allow me the
change to let my mouse leave the image before it trys to make the other
image visible = false
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sun Jul 12, 2020 1:48 pm    Post subject: Reply with quote

Is btnActivateRollover a button or an image
If image you can also just change Picture property of the control instead (make sure to have a copy of BOTH active and inactive invisible somewhere else you will overwrite the picture of the original)


Anyhow, the flashing is because btnActivateNormal OnExit triggers because it's invisible now
The restoring code should be under the exit of btnActivateRollover

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

Joined: 27 Oct 2015
Posts: 59

PostPosted: Sun Jul 12, 2020 9:40 pm    Post subject: Reply with quote

Yes they are both images, I will provide the CT so you can visually see it.

I'm not understanding too much what you mean by this
Quote:
If image you can also just change Picture property of the control instead (make sure to have a copy of BOTH active and inactive invisible somewhere else you will overwrite the picture of the original)


would you show an example with my CT if possible?

File Attachment is 8MB so i had to upload to a filehost

My .CT download is here
https://gofile.io/d/pdZUhF





EDITED AND
_______________________________________________
-- RESOLVED
------------------------------------------------------------------


I was able to get the effect I been trying to obtain with the following
code:
Code:
function launcherGUI_btnActivateNormalMouseEnter(sender)
--real pos: left: 520 top: 226
launcherGUI.btnActivateNormal.left = 804;
launcherGUI.btnActivateRollover.left = 520;
end
function launcherGUI_btnActivateRolloverMouseLeave(sender)
launcherGUI.btnActivateNormal.left = 520;
launcherGUI.btnActivateRollover.left = 804;
end
function launcherGUI_btnActivateRolloverMouseDown(sender, button, x, y)
launcherGUI.btnActivateNormal.left = 804;
launcherGUI.btnActivateRollover.left = 804;
launcherGUI.btnActivateDown.left = 520;
end
function launcherGUI_btnActivateRolloverMouseUp(sender, button, x, y)
launcherGUI.btnActivateNormal.left = 804;
launcherGUI.btnActivateRollover.left = 520;
launcherGUI.btnActivateDown.left = 1022;
end



Results:

Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1535

PostPosted: Mon Jul 13, 2020 3:45 am    Post subject: Reply with quote

I believe that he could not solve the "Visible" issue.
There is an example below.
Note: In case of a change of function code, open and close "Form Designer" once.

Code:
launcherGUI.btnActivateNormal.OnClick=function()
launcherGUI.btnActivateNormal.visible = false;
launcherGUI.btnActivateRollover.visible = true;
print "Normal Enter";
end

--launcherGUI.btnActivateNormal.OnMouseLeave=function()
--launcherGUI.btnActivateRollover.visible = false;
--launcherGUI.btnActivateNormal.visible = true;
--print "Mouse Leave";
--end

launcherGUI.btnActivateRollover.OnClick=function()
launcherGUI.btnActivateNormal.visible = true;
launcherGUI.btnActivateRollover.visible = false;
print "Rollover Enter";
end

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Jul 13, 2020 5:49 am    Post subject: Reply with quote

Another alternative:

Code:
if fm then fm.Destroy() fm = nil end

fm = createForm()

b1 = createImage(fm)
b1.setSize(200,40)
b1.setPosition(60,80)
b1.Stretch = true
-- The picture is load from your CT and add to this CT table file
-- and I give name as btn1.png
b1.Picture.loadFromStream(findTableFile('btn1.png').Stream)
b1.Visible = true

b2 = createImage(fm)
b2.setSize(200,40)
b2.setPosition(60,80)
b2.Stretch = true
-- The picture is load from your CT and add to this CT table file
-- and I give name as btn2.png
b2.Picture.loadFromStream(findTableFile('btn2.png').Stream)
b2.Visible = false

function ro()
  if b1.Visible == true then
     b1.Visible = false
     b2.Top = b2.Top - 5
     b2.Left = b2.Left - 5
     b2.Width = b2.Width + 10
     b2.Height = b2.Height + 10
     b2.Visible = true
  else
     b1.Visible = true
     b2.Top = b2.Top + 5
     b2.Left = b2.Left + 5
     b2.Width = b2.Width - 10
     b2.Height = b2.Height - 10
     b2.Visible = false
  end
end


b1.OnMouseEnter = ro
b2.OnMouseEnter = ro
b1.OnMouseLeave = ro
b2.OnMouseLeave = ro

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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