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 


Draw a line between two points on the screen [Solved]

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

Joined: 20 Dec 2024
Posts: 4

PostPosted: Fri Dec 20, 2024 11:35 pm    Post subject: Draw a line between two points on the screen [Solved] Reply with quote

Hello Cheat Engine community, meow~

May I ask how to draw a line on the screen using Lua? I plan to create a script for seeing all the small monsters in the game, and I will figure out the algorithm myself. But before that, I need to know how to draw a line between two points. Thank you, meow~
(Oh, by the way, I can use assembly scripts to get all the coordinates I want and list them as an array, so don't worry about me wasting your response.)

---------------

This was something♡ I originally wanted to ask, but I found the solution on the forum. The♡ modification isn't ♡perfect, but I'm sharing it here with everyone. As long as it can help more ♡people in need like me, it's fine... haha♡. I also hope some experts can help ♡simplify it. meow..~♡

Code:


{$lua}

if syntaxcheck then return end

[ENABLE]

if Line then Line.Destroy() end
if ESP then ESP.Destroy() end

Line = createForm()
Line.Color = 0x000000
Line.Width=getScreenWidth()
Line.Height=getScreenHeight()
Line.FormStyle = 'fsSystemStayOnTop'
Line.Position = 'poDesktopCenter'
Line.BorderStyle='bsNone'
Line.setLayeredAttributes(0,0,LWA_COLORKEY)

local x1, y1 = Line.Width/2, Line.Height/2

function OnPaint(sender, x1_, y1_, x2_, y2_)
  sender.repaint()
  sender.Canvas.Pen.Color = 0xFFFFFF
  sender.Canvas.Pen.Width = 2
  sender.Canvas.Brush.Color = 0xff
  sender.Canvas.Brush.Style = 1
  sender.Canvas.line(x1_, y1_, x2_, y2_)
end


ESP = createTimer()
ESP.Interval = 10
ESP.OnTimer = function()

  x2,y2 = getMousePos()
  x2,y2 = x2-5, y2-5
  OnPaint(Line, x1, y1, x2, y2)

end

[DISABLE]

Line.Destroy()
ESP.destroy()

Back to top
View user's profile Send private message Send e-mail
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