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 


How do you suppress errors given by Lua Engine Window?

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

Joined: 09 Jun 2015
Posts: 77

PostPosted: Tue Mar 13, 2018 6:08 pm    Post subject: How do you suppress errors given by Lua Engine Window? Reply with quote

So, one of the trainers I made constantly writes values to certain memory addresses. After the game closes out, the trainer spits out a long list of errors because its writing to memory addresses that no longer exist for the game. I think it looks unprofessional. Is there anyway to suppress the Lua Engine window in a Cheat Trainer .exe? I'm working with Cheat Engine 6.5.1 by the way (mainly because I'm used to the current syntax and don't want to relearn bits of it for 6.7)
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Mar 13, 2018 6:36 pm    Post subject: Reply with quote

If that exe trainer made by you then I believe you kept source code for that exe trainer, then just edit source code which are contain error.
Or just reverse that exe trainer to CT file and edit it.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Mar 13, 2018 6:40 pm    Post subject: Reply with quote

Or Lua Engine form -> "View" -> uncheck "Show on Print".
_________________
Back to top
View user's profile Send private message Visit poster's website
Reclaimer Shawn
Advanced Cheater
Reputation: 0

Joined: 09 Jun 2015
Posts: 77

PostPosted: Wed Mar 14, 2018 8:35 pm    Post subject: Reply with quote

TheyCallMeTim13 wrote:
Or Lua Engine form -> "View" -> uncheck "Show on Print".


That works just nicely. Is there any script/way to do this via the source code of my tool so a person who uses my tool never runs into this problem?
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Wed Mar 14, 2018 9:26 pm    Post subject: Reply with quote

There may be a setting that I don't know about, but I don't know of any easy why (mostly I'm thinking get the forms menu and check/activate that menu item).

But I like to add a logger to my stuff, this way you just set "DEBUG = true" or the logger level to what ever you need.
Code:
--------
-------- Logger
--------
local Logger = { ClassName = 'I2Logger', Name = 'I2CET_Logger' }
Logger.LEVELS = { OFF = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4 }
Logger.Level = Logger.LEVELS.WARN
if DEBUG then Logger.Level = Logger.LEVELS.DEBUG end
Logger.print = print
function Logger.logEvent(level, msg, ex)
   if Logger.Level >= level then
      Logger.print(msg)
      if ex then Logger.print('Exception: ' .. tostring(ex)) end
   end
end
for k,v in pairs(Logger.LEVELS) do
   if v > 0 then
      Logger[k:lower()] = function(msg, ex) return Logger.logEvent(v, msg, ex) end
      Logger[k:lower() .. 'f'] = function(msg, ... ) return Logger.logEvent(v, string.format(msg, ... )) end
   end
end

This is a template from my Lua templates extension.

Then just write to it like this:
Code:
Logger.error('This is a error message')

Code:
Logger.warn('This is a warning message')

Code:
Logger.info('This is an information message')

Code:
Logger.debug('This is a debug message')

And all of them have a format method ("*f"):
Code:
Logger.debugf('writeToCoords: writing:  ' .. pointerFtmStr .. ' :  %f9', base + I2CETeleporter.Xoffset, x)

_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Mar 14, 2018 10:07 pm    Post subject: Reply with quote

or (place this code at beginning of script)

Code:
getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()

--Alternative

getLuaEngine().OnShow = function (sender) return sender.hide(); end

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Wed Mar 14, 2018 11:13 pm    Post subject: Reply with quote

Corroder wrote:
or (place this code at beginning of script)

Code:
getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()

--Alternative

getLuaEngine().OnShow = function (sender) return sender.hide(); end


I was thinking there was an easy way, just couldn't find it quickly and I didn't want to speak on some thing I don't use/know. Thanks Corroder, it's best to have all the relevant info.

_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Mar 15, 2018 3:47 am    Post subject: Reply with quote

Your welcome ..@Tim.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Reclaimer Shawn
Advanced Cheater
Reputation: 0

Joined: 09 Jun 2015
Posts: 77

PostPosted: Thu Mar 15, 2018 5:26 pm    Post subject: Reply with quote

Corroder wrote:
or (place this code at beginning of script)

Code:
getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()

--Alternative

getLuaEngine().OnShow = function (sender) return sender.hide(); end


This works perfectly! I need no further assistance from here. Thanks!
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