MDon How do I cheat?
  Reputation: 0
  Joined: 20 Dec 2024 Posts: 4
 
  | 
		
			
				 Posted: Fri Dec 20, 2024 11:35 pm    Post subject: Draw a line between two points on the screen [Solved] | 
				       | 
			 
			
				
  | 
			 
			
				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()
 
 
 | 	  
 | 
			 
		  |