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 


Is this possible?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Sat Nov 19, 2016 12:28 pm    Post subject: Is this possible? Reply with quote

Is it possible to make a value be constantly updated on a label?

Not the best question but what I mean is.. lets say that this instruction holds your characters x position
Code:

mov ecx,[rsi+00000094]

and this one the y position
Code:

mov ecx,[rsi+00000098]

now from this if I make the script something like this (just so I see my position)
Code:

[ENABLE]
aobscan(XandY,8B ?? ?? ?? 00 00 00)
alloc(Mem,16)
globalalloc(XYPos,4)

Mem:

reader:
  mov [XYPos],rsi
  mov ecx,[rsi+00000094]

jmp return

return:
  jmp Mem
registersymbol(XandY)

[DISABLE]

XandY:
  db 8B 2C 94 00 00 00 00
unregistersymbol(XandY)


and then make pointers "XYPos+94" and "XYPos+98" I will see my position after activating the above script.

But from here what I would like is so the number which is being held in [XYPos+94] and [XYPos+98] will be displayed in Label1 and Label2 on my form so it would look something like this.

    ---------------------------------------------------
    Game Trainer V0.1 - - - - - - - - [-] - [=] - [x]
    ---------------------------------------------------
    Players Position
    X: -21.33245 Y: 0.47932321

    F1 Unlimited HP
    F2 Unlimited MP
    F3 Max Ability






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


is this possible?

hope fully I was able to explain everything....

This might make it a little bit more understandable...

So you can do this:
Code:

function Checkbox1Change(sender)
if(checkbox_getState(Form1.Checkbox1) == 1) then
Form1.Label1.Caption = "Hello World!"
else
Form1.Label1.Caption = "Bye World!"
end
end


I want it the same way but something like
Code:

function Checkbox1Change(sender)
if(checkbox_getState(Form1.Checkbox1) == 1) then
autoAssemble([[
aobscan(XandY,8B ?? ?? ?? 00 00 00)
alloc(Mem,16)
globalalloc(XYPos,4)

Mem:

reader:
  mov [XYPos],rsi
  mov ecx,[rsi+00000094]

jmp return

return:
  jmp Mem
registersymbol(XandY)
]])
Form1.Label1.Caption="[XYPos+94]" <<<<< this is what I want somehow.
Form1.Label2.Caption="[XYPos+98]"
else
autoAssemble([[
XandY:
  db 8B 2C 94 00 00 00 00
unregistersymbol(XandY)
]])
end
end
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sat Nov 19, 2016 12:56 pm    Post subject: Reply with quote

Make a timer to update the Label Caption with reading from the addresses?
eg.(not test)
Code:

local lbl = YourForm.YourLabelName
if lbl.ComponentCount==0 then -- timer not attached yet
  local tm = createTimer(lbl)
  tm.Interval = 1000
  tm.OnTimer = function(tm)
    local fmt,X,Y = string.format
    if Form1.Checkbox1==nil or Form1.Checkbox1.Checked then
      X,Y = readFloat"[XYPos]+94",readFloat"[XYPos]+98"
    end
    X = X and fmt("%7.2f",X) or '??'
    Y = Y and fmt("%7.2f",Y) or '??'
    tm.Owner.Caption = fmt("X:%7s , Y:%7s",X,Y)
  end
end

-- to toggle the timer
local lbl = YourForm.YourLabelName
local tm = lbl.ComponentCount>0 and lbl.Component[0]
if tm and tm.ClassName == 'TTimer' then
  tm.Enabled = not tm.Enabled
end

-- to set a fixed size font for the label display string
local lbl = YourForm.YourLabelName
lbl.Font.Name = 'Courier New'


bye~

UPDATE:
fix address, thx mgr.inz.Player's~

_________________
- Retarded.


Last edited by panraven on Sat Nov 19, 2016 1:33 pm; edited 4 times in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Nov 19, 2016 12:59 pm    Post subject: Reply with quote

Code:
local X,Y = readFloat"[XYPos]+94",readFloat"[XYPos]+98"




I also created example code:
Code:
autoAssemble([[your script here]])

function Checkbox1Change(sender)
  if sender.Checked then
    PositionTimer.Enabled = true
  else
    PositionTimer.Enabled = false
  end
end

function GUI_playerPosition()
  local text = string.format("Player position: X=%10.2f, Y=%10.2f",readFloat("[XYPos]+94") or 0,readFloat("[XYPos]+98") or 0)
  Form1.Label1.Caption = text
end

if PositionTimer~=nil then PositionTimer.destroy() PositionTimer=nil end

PositionTimer = createTimer(Form1,false)
PositionTimer.Interval = 100
PositionTimer.OnTimer = GUI_playerPosition

_________________
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