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 


Print varable in Hud

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

Joined: 05 Sep 2013
Posts: 6

PostPosted: Thu Sep 05, 2013 4:09 pm    Post subject: Print varable in Hud Reply with quote

First day coding and I am trying to print or at least get a visual on what my random timer variable has been set to

Code:


---Set random time between two ranges
timer = math.random (175, 210)

-- Message on screen what the random time event was set to\
if managers.hud then
   managers.hud:show_hint( { text = "Timer has been set to " .. timer } )
end




Any help on this would be great
Very Happy
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Sep 05, 2013 5:42 pm    Post subject: Reply with quote

Here some examples, if I understood correctly what you're trying to do.
Code:
timer = math.random(175,210);
print("Timer has been set to " .. timer);


Code:
timer = math.random(175,210);
showMessage("Timer has been set to " .. timer);


Code:
f = { "Hud", "Nil", "Random..", math.random(175,210)};
f.form = createForm();
f.form.Width = 100;
f.form.Height = 30;
f.label = createLabel(f.form);
f.button = createButton(f.form);

f.form.Caption = f[1];
f.label.Caption = f[2];
f.button.Caption = f[3];

f.label.Top = 10;
f.label.Left = 5;
f.button.Top = 5;
f.button.Left = 30;
f.button.Width = 55;

f.button.OnClick = function () f.label.caption = f[4] end;

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
LisaBall
How do I cheat?
Reputation: 0

Joined: 05 Sep 2013
Posts: 6

PostPosted: Thu Sep 05, 2013 6:17 pm    Post subject: Reply with quote

Thank you for the reply DaSpamer,

As you can see I am setting a random number to the timer , this is used else where in the script , but as the number is going to be random I would like to get a visual view of what it has been set to. This was the reason I was trying to write a line in to the managers.hud.

This is what I am trying now

Code:


---Set random time between two ranges
timer = math.random (175, 210)


function show_hint( msg )
   if managers.hud then
      managers.hud:show_hint( { text = msg } )
   end
end

function show_mid_text( msg, msg_title, show_secs )
   if managers.hud then
      managers.hud:present_mid_text( { text = msg, title = msg_title, time = show_secs } )
   end
end

show_mid_text( "Timer has been set to " .. timer .. " seconds", 2 );



As this is for a set game would you recommend I post it there as its using set functions of that game
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Sep 05, 2013 8:02 pm    Post subject: Reply with quote

I though you were using your own functions, and didn't knew the C.E Lua features.

And yes, the game functions could help.

Also, doesn't the game has console? (where it can print stuff for debugging..)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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: Fri Sep 06, 2013 10:27 am    Post subject: Reply with quote

CheatEngine has it's own Lua, game has it's own Lua.
They are separate. You can not use game's Lua functions inside CheatEngine's Lua, and you can not use CheatEngine's Lua functions inside game's Lua.
Yes, a bit confusing...



So, you can not do it the easy way...
If you want to print something on game's hud with game's Lua functions (managers.hud:show_hint) you have to "hijack" game's Lua.



This might help (or not. Because there is code injection, some manual searching, etc)
http://forum.cheatengine.org/viewtopic.php?t=564665


Which game you are trying?


 

_________________
Back to top
View user's profile Send private message MSN Messenger
LisaBall
How do I cheat?
Reputation: 0

Joined: 05 Sep 2013
Posts: 6

PostPosted: Fri Sep 06, 2013 7:52 pm    Post subject: Reply with quote

Thank you both for your help , mgr.inz.Player This is for the game payday2
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