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 


Very Huge CPU Usage [90%]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Matt GT
Newbie cheater
Reputation: 0

Joined: 21 Dec 2017
Posts: 14

PostPosted: Sat Jan 20, 2018 1:33 am    Post subject: Very Huge CPU Usage [90%] Reply with quote

Why everytime i use this script:



Code:
function reopenProcessThreadFunc(thread,processName)
  thread.name = '"reopenProcessThread"'

  while true do
    if readInteger(processName)== nil then
      if openProcess(processName) then
      autoAssemble([[
        "Growtopia.exe"+123A4F:
        db 90 90
      ]])
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Running' end)
      else
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Not Running' end)
   end
end
end
end

createNativeThread(reopenProcessThreadFunc,"Growtopia.exe")


it consumes like 90% of my cpu but when im not using it, its not consuming
a big amount of cpu usage

_________________
im a n00v at cheat engine
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sat Jan 20, 2018 2:04 am    Post subject: Reply with quote

May add
Code:

sleep(1000)

within the eternal while loop so the thread will not continuously run non stop, ie. sleep pause the thread execution once a while.

_________________
- Retarded.
Back to top
View user's profile Send private message
Matt GT
Newbie cheater
Reputation: 0

Joined: 21 Dec 2017
Posts: 14

PostPosted: Sat Jan 20, 2018 2:43 am    Post subject: Reply with quote

panraven wrote:
May add
Code:

sleep(1000)

within the eternal while loop so the thread will not continuously run non stop, ie. sleep pause the thread execution once a while.


where should i add it

_________________
im a n00v at cheat engine
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jan 20, 2018 4:28 am    Post subject: Reply with quote

Quote:
May add
Code:

sleep(1000)

within the eternal while loop


The "loop" start here :

Code:
while true do
...

-- until close by end
end


so you can try to add sleep(1000)

Code:
 while true do
    if readInteger(processName)== nil then
      if openProcess(processName) then
      autoAssemble([[
        "Growtopia.exe"+123A4F:
        db 90 90
      ]])
     sleep(1000)   ---- here
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Running' end)
     sleep(1000)  ----- or here
      else
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Not Running' end)
     sleep(1000)  ----- or here
   end
end
sleep(1000)  ----- or here
end


just try

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Jan 20, 2018 10:35 am    Post subject: Reply with quote

because it's repeatedly doing it as fast as possible, and there's no reason for it to, as mentioned you can use sleep to let the processor do other work for awhile instead.

Alternatively you can use a timer rather than createThread

Code:
local t = createTimer()
t.OnTimer = function(timer)
  local processName = 'Growtopia.exe'
  if readInteger(processName) == nil then
    if openProcess(processName) then
      autoAssemble([["Growtopia.exe"+123A4F:
            db 90 90]])
      -- why is this in synchronize?
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Running' end)
    else
      -- why is this in synchronize?
      synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Not Running' end)
    end
  end
end
t.Interval = 1000 -- run once every 1000 milliseconds / 1 second


if you don't want to have to change the function every time because you're creating a library or something like that then you could still use a timer via closures (though createNativeThread may be the simpler option)

Code:
-- library function
function getReopenProcessFunc(processName, success, failure)
  -- return function with access to the values given
  return function(timer)
    if readInteger(processName) == nil then
      if openProcess(processName) then
        if type(success) == 'function' then return success(processName) end
      else
        if type(failure) == 'function' then return failure(processName) end
      end
    end
  end
end

-- an unnecessary wrapper to avoid user needing to timer lol
function setReopenProcessFunc(processName, success, failure)
  local t = createTimer()
  t.OnTimer = getReopenProcessFunc('Growtopia.exe', success, fail)
  t.Interval = 1000 -- run once every 1000 milliseconds / 1 second
  return t
end

-- user code
local success = function(processName)
  local bypassScript = [["Growtopia.exe"+123A4F:
  db 90 90]]
  autoAssemble(script)
  -- why is this in synchronize?
  synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Running' end)
end
local fail = function(processName)
  -- why is this in synchronize?
  synchronize(function () UDF1.BanBypass.Caption ='Ban Bypass : Not Running' end)
end
local reopenProcessTimer = setReopenProcessFunc('Growtopia.exe', success, fail)
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 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