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 


Creating a chart

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

Joined: 29 Mar 2021
Posts: 64

PostPosted: Fri Mar 31, 2023 8:45 am    Post subject: Creating a chart Reply with quote

How can i create a chart [ TChart ] in CE Lua?? Or something so i can graph values...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Mar 31, 2023 12:54 pm    Post subject: Reply with quote

look up the diagram class


https://github.com/cheat-engine/cheat-engine/blob/13100745bdacb555033d1b051fd8158fdcfd0809/Cheat%20Engine/bin/celua.txt#L3759

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

Joined: 29 Mar 2021
Posts: 64

PostPosted: Fri Mar 31, 2023 10:48 pm    Post subject: Reply with quote

How can i make a line series with this? I want to make something like this

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

Joined: 02 Sep 2011
Posts: 1051
Location: 0x90

PostPosted: Sun Apr 02, 2023 7:40 am    Post subject: Reply with quote

HexaG0n wrote:
How can i make a line series with this? I want to make something like this



Using the information DB linked you can do it. Create a diagram, a table of blocks which include the data of each block like X,Y, width, height etc... then link the blocks together using addConnection(source, destination).
Back to top
View user's profile Send private message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Sun Apr 02, 2023 8:52 am    Post subject: Reply with quote

what about the grid at the background? i also want it to be zoomable, etc. and can display values.
making something whole with that diagram class is pretty time staking... is there really no TChart in CE?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1227

PostPosted: Sun Apr 02, 2023 12:07 pm    Post subject: Reply with quote

Do this in C++ or #C and if you want to use it in (Visual Studio) CE use the form parent in the CE Form window.

( As : https://forum.cheatengine.org/viewtopic.php?p=5758399#5758399 )

Code:
f1 = createForm()
f1.setSize(640,500)
f1.Caption = 'Test Apps Inside The Boundaries'

b1 = createButton(f1)
b1.setPosition(570,460)
b1.setSize(60,30)
b1.Caption = 'Launch'

function SetParent(hWndChild, hWndNewParent)
  return executeCodeLocalEx('user32.SetParent', hWndChild, hWndNewParent)
end

function SetWindowPos(hwnd, hWndInsertAfter, x, y, cx, cy, wFlags)
  return executeCodeLocalEx('user32.SetWindowPos', hwnd, hWndInsertAfter, x, y, cx, cy, wFlags)
end

function MoveWindow(hwnd, x, y, cx, cy, repaint)
  local rp
  if repaint then
    rp=1
  else
    rp=0
  end
  return executeCodeLocalEx('user32.MoveWindow', hwnd, x, y, cx, cy, rp)
end


function launch()
 ps1 = 'start notepad.exe'
 p1 = os.execute(ps1)
 sleep(1000)
 openProcess('notepad.exe')
 w=getWindow(getForegroundWindow(), GW_HWNDFIRST)
 pid=getOpenedProcessID()
   while w and (w~=0) do
     if (getWindowProcessID(w)==pid) and (executeCodeLocal("IsWindowVisible",w)~=0) then
       --print(w..' - '..getWindowCaption(w)..'('..getWindowClassName(w)..')')
     SetParent(w, f1.handle)
     MoveWindow(w, 10, 20, 400, f1.Height-100, 1)
     end
     w=getWindow(w, GW_HWNDNEXT)
   end
end

b1.OnClick = launch


But it can be difficult to pass the return values to CE as I don't know what to associate it with. So the return values should appear in the form you made in VS.


Or, while preparing the VS form, you can save the return values in a folder (Temp >> example.txt) and read and print them with the CE form.


Edit:
As different.
A CE Form start to your project;

Code:
f1 = createForm()
f1.setSize(500,500)
f1.Caption = 'Test'

local tbl1 = {}

tbl1.pnl1 = createPanel(f1)
tbl1.pnl1.Height = f1.Height - 60
tbl1.pnl1.Width = f1.Width - 60
tbl1.pnl1.Left = 30
tbl1.pnl1.Top = 30

tbl1.pnl2 = createPanel(tbl1.pnl1)
tbl1.pnl2.Height = tbl1.pnl1.Height - 45
tbl1.pnl2.Width = tbl1.pnl1.Width - 45
tbl1.pnl2.Left = 22
tbl1.pnl2.Top = 22

function onLineLeft(p1,p2,space)
local nTop = space - 12
local space1 = math.floor(p2.Width / tonumber(space))
--print(space1)
local rep1 = tonumber(p2.Width) / 3
local cpt1 = string.rep(". ",math.floor(rep1))
local line1 = math.floor(space1 - 1) * 10
--print(line1)

  for i=1, space1 do
   tbl1["dlbl"..i] = createLabel(p1)
   tbl1["dlbl"..i].Left=5
   tbl1["dlbl"..i].Top=tonumber(nTop) + 27
   tbl1["dlbl"..i].Caption=line1

   tbl1["elbl"..i] = createLabel(p2)
   tbl1["elbl"..i].Left=0
   tbl1["elbl"..i].Top=tonumber(nTop)
   tbl1["elbl"..i].Caption=cpt1
   tbl1["elbl"..i].Font.Size=12
   tbl1["elbl"..i].Font.Color=0xff

   tbl1["flbl"..i] = createLabel(p1)
   tbl1["flbl"..i].Left=p2.Width + p2.Top + 4
   tbl1["flbl"..i].Top=tonumber(nTop) + 27
   tbl1["flbl"..i].Caption=line1
   line1 = tonumber(line1) - 10
   nTop=tonumber(nTop) + tonumber(space)
  end
end

function onLineTop(p1,p2,space)
local nLeft = space
local space1 = p2.Width / tonumber(space)
local rep1 = tonumber(p2.Height)
local cpt1 = string.rep(":\n",math.floor(rep1))
local line1 = 0

  for i=1, space1 do
   tbl1["albl"..i] = createLabel(p1)
   tbl1["albl"..i].Left=tonumber(nLeft) + 21
   tbl1["albl"..i].Top=5
   tbl1["albl"..i].Caption=line1

   tbl1["blbl"..i] = createLabel(p2)
   tbl1["blbl"..i].Left=tonumber(nLeft)
   tbl1["blbl"..i].Top=0
   tbl1["blbl"..i].Caption=cpt1
   tbl1["blbl"..i].Font.Size=10
   tbl1["blbl"..i].Font.Color=0xff
   tbl1["blbl"..i].Font.Style="fsBold"

   tbl1["clbl"..i] = createLabel(p1)
   tbl1["clbl"..i].Left=tonumber(nLeft) + 21
   tbl1["clbl"..i].Top=p2.Height + p2.Top + 3
   tbl1["clbl"..i].Caption=line1
   line1 = i*2
   nLeft=tonumber(nLeft) + tonumber(space)
  end
end

onLineLeft(tbl1.pnl1,tbl1.pnl2,50)
onLineTop(tbl1.pnl1,tbl1.pnl2,50)


You can add or change things.



ek1.PNG
 Description:
 Filesize:  9.94 KB
 Viewed:  1629 Time(s)

ek1.PNG



_________________
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: 1667

PostPosted: Thu Apr 06, 2023 1:44 am    Post subject: Reply with quote

Dark Byte wrote:
look up the diagram class


https://github.com/cheat-engine/cheat-engine/blob/13100745bdacb555033d1b051fd8158fdcfd0809/Cheat%20Engine/bin/celua.txt#L3759


DB, I think
Code:
createBlock()
not register yet on CE Lua define.
It's return error "attempt to call a nil value global 'createBlock()"

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Thu Apr 06, 2023 1:47 am    Post subject: Reply with quote

it's a method of the diagram class, you call it using a diagram object

e.g
Code:

d=createDiagram(someform)
d.align=alClient
b=d.createBlock()

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

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Apr 06, 2023 5:46 am    Post subject: Reply with quote

Dark Byte wrote:
it's a method of the diagram class, you call it using a diagram object

e.g
Code:

d=createDiagram(someform)
d.align=alClient
b=d.createBlock()


I see, so this
Code:
b=d.createBlock()



not

Code:
b=createBlock(d)



Thanks DB

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Thu Apr 06, 2023 5:58 am    Post subject: Reply with quote

you can see an example of it in use in autorun\pseudocodediagram.lua

( https://github.com/cheat-engine/cheat-engine/blob/master/Cheat%20Engine/bin/autorun/pseudocodediagram.lua )

_________________
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
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