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 


Enable speedhack while key is down

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
Dark Byte
Site Admin
Reputation: 332

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

PostPosted: Thu Jun 16, 2011 5:53 am    Post subject: Enable speedhack while key is down Reply with quote

The following script will set the speedhack speed to 10 as long as the A key is pressed, else to 1

This implementation only supports 1 such hotkey at a time (guess why)
Code:

lastSpeed=1;

function checkKeys(timer)
  if (isKeyPressed(VK_A)) then
    if lastspeed ~= 10 then
      speedhack_setSpeed(10)
      lastSpeed=10
    end
  else
    if lastspeed ~= 1 then
      speedhack_setSpeed(1)
      lastSpeed=1
    end
  end

end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)


when you want it disabled, just destroy or disable timer f

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 145
Location: Russia

PostPosted: Sun Jun 19, 2011 11:29 pm    Post subject: Reply with quote

I would recommend this example:
Code:

speed = 1.0

function IncSpeed(hotkey)
   speed = speed + 1
   speedhack_setSpeed(speed)
end
 
function DecSpeed(hotkey)
   speed = speed - 1
   speedhack_setSpeed(speed) 
end

function ResetSpeed(hotkey)
   speed = 1.0
   speedhack_setSpeed(1.0)
end


function SetHotKey(func, hotkey)
   local objectHotKey =  createHotkey(func, hotkey)
   generichotkey_setKeys(objectHotKey, hotkey)
   generichotkey_onHotkey(objectHotKey, func)
end

 
function onOpenProcess(processid)
   SetHotKey(IncSpeed, VK_F2)
   SetHotKey(DecSpeed, VK_F3)
   SetHotKey(ResetSpeed, VK_F4)
end
 
local aalist = getAutoAttachList()
stringlist_add(aalist, "UT3.exe")
Back to top
View user's profile Send private message
paupav
Master Cheater
Reputation: 13

Joined: 15 Apr 2011
Posts: 313
Location: P. Sherman 42, Wallaby Way, Sydney

PostPosted: Sun Jul 17, 2011 1:35 pm    Post subject: Reply with quote

I have to put it in script engine?
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 108

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Wed Jul 20, 2011 6:43 pm    Post subject: Reply with quote

Yes, in the lua script engine.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
jimmy666
How do I cheat?
Reputation: 0

Joined: 09 Jun 2012
Posts: 5

PostPosted: Sun Jun 10, 2012 5:06 am    Post subject: Reply with quote

GH*master wrote:
I would recommend this example:
Code:

speed = 1.0

function IncSpeed(hotkey)
   speed = speed + 1
   speedhack_setSpeed(speed)
end
 
function DecSpeed(hotkey)
   speed = speed - 1
   speedhack_setSpeed(speed) 
end

function ResetSpeed(hotkey)
   speed = 1.0
   speedhack_setSpeed(1.0)
end


function SetHotKey(func, hotkey)
   local objectHotKey =  createHotkey(func, hotkey)
   generichotkey_setKeys(objectHotKey, hotkey)
   generichotkey_onHotkey(objectHotKey, func)
end

 
function onOpenProcess(processid)
   SetHotKey(IncSpeed, VK_F2)
   SetHotKey(DecSpeed, VK_F3)
   SetHotKey(ResetSpeed, VK_F4)
end
 
local aalist = getAutoAttachList()
stringlist_add(aalist, "UT3.exe")


where to paste this code in CE . i know nothing about LUA .
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 332

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

PostPosted: Sun Jun 10, 2012 10:05 am    Post subject: Reply with quote

when the process is open press ctrl+alt+l (or go to memoryview ->tools->lua engine)
and paste the script in there and click execute

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
tukey
How do I cheat?
Reputation: 0

Joined: 15 Sep 2012
Posts: 6

PostPosted: Fri Sep 21, 2012 3:58 am    Post subject: Reply with quote

Can you tell me How to directly generate a trainer with the code by GH*master?
Back to top
View user's profile Send private message
CodeKiller
Advanced Cheater
Reputation: 0

Joined: 30 Jun 2009
Posts: 72

PostPosted: Thu Sep 27, 2012 12:39 am    Post subject: Reply with quote

It's not design for that...
Back to top
View user's profile Send private message
Truglio
How do I cheat?
Reputation: 0

Joined: 28 Aug 2015
Posts: 1

PostPosted: Fri Aug 28, 2015 7:34 pm    Post subject: speedhack Reply with quote

HELP!!!!!!!! I need serious help with the speedhack! I'm not sure how to use it and I put the code in the LUA and hit Execute Script and it didn't work! Please someone help me... All I'm trying to do is to get a certain wait time on a game to take shorter! And it always says that the brackets and things are wrong.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 119

Joined: 09 Jun 2013
Posts: 3210

PostPosted: Fri Aug 28, 2015 9:47 pm    Post subject: Reply with quote

A thread from 2011. Well, thumbs up for at least trying to use the search feature.
Did you attach Cheat Engine to the game?
Why not paste the actual error here.
Otherwise, my help is "copy and paste better next time."
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 29

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Aug 29, 2015 2:41 am    Post subject: Re: speedhack Reply with quote

Truglio wrote:
HELP!!!!!!!! I need serious help with the speedhack! I'm not sure how to use it and I put the code in the LUA and hit Execute Script and it didn't work! Please someone help me... All I'm trying to do is to get a certain wait time on a game to take shorter! And it always says that the brackets and things are wrong.
Does the existing speedhack option in Cheat Engine work? The one on the main window.
_________________
Back to top
View user's profile Send private message
Xionanx
Newbie cheater
Reputation: 0

Joined: 28 Feb 2013
Posts: 22

PostPosted: Sat Oct 17, 2015 1:39 pm    Post subject: Take it a step further? Reply with quote

Question: Is it possible to set up speed hack so that it turns on/off automatically based on the game state? (no key press)

Example: In "The Last Remnant" the battles are "slow", so, I want to make a script that detects when a battle starts and then enables the speedhack, when the battle is over, speedhack turns off.

In my mind it sounds like it should be simple enough, but I don't mess with cheat engine often enough to know the ins and outs of everything the tool can do. :p

EDIT: Also fully aware of "Necro" but I think its preferable to having 10 threads on the same subject.

EDIT2: I think I may have figured out how to do this on my own, now its just a matter of finding a good address to use as reference for the battle state.
Back to top
View user's profile Send private message
Xionanx
Newbie cheater
Reputation: 0

Joined: 28 Feb 2013
Posts: 22

PostPosted: Sun Oct 18, 2015 3:27 am    Post subject: OK, got it "Working" but think it may be a tad bit Reply with quote

So after a day of digging around the forums and discovering how to use pointers in the LUA on 64bit.. and etc etc.. I came up with this:
Code:
lastSpeed=1;
total=0;

function checkBattle(timer)
local BA  // Will be the base address
local EG1  // Will be enemy group 1 address
local EG2  // group 2
local EG3  // etc
local EG4
local EG5
local EG6
local EG7
local EG1hp  // Enemy group 1 HP's
local EG2hp  // Etc...
local EG3hp
local EG4hp
local EG5hp
local EG6hp
local EG7hp
BA=readPointer("TLR.exe+01DCFAA0")+0x90
BA=readPointer(BA)+0x3C
BA=readPointer(BA)+0x301C
EG1=readPointer(BA)+0x1700
EG2=readPointer(BA)+0x19bc
EG3=readPointer(BA)+0x1C78
EG4=readPointer(BA)+0x1F34
EG5=readPointer(BA)+0x21F0
EG6=readPointer(BA)+0x24AC
EG7=readPointer(BA)+0x2768
EG1hp=readInteger(EG1)
EG2hp=readInteger(EG2)
EG3hp=readInteger(EG3)
EG4hp=readInteger(EG4)
EG5hp=readInteger(EG5)
EG6hp=readInteger(EG6)
EG7hp=readInteger(EG7)
total=EG1hp+EG2hp+EG3hp+EG4hp+EG5hp+EG6hp+EG7hp    //  Add HP for all groups together.
  if total ~= 0 then  //  if ANY enemy is still alive, then you are in battle, if they are all dead then HP will = 0
    if lastspeed ~= 4 then
      speedhack_setSpeed(4)
      lastSpeed=4
    end
  else
    if lastspeed ~= 1 then
      speedhack_setSpeed(1)
      lastSpeed=1
    end
  end
end

function writeif255(sender)
  print(total)
end

t=createTimer(nil, false)
timer_setInterval(t, 100)
timer_onTimer(t, writeif255)
timer_onTimer(t, checkBattle)

createHotkey(function () timer_setEnabled(t,true) end, VK_F3)
createHotkey(function () timer_setEnabled(t,false) end, VK_F4)


Now, feel free to give me hints on how to make this less cumbersome looking. I also freely admit to copy/pasting code from others.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 332

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

PostPosted: Sun Oct 18, 2015 3:43 am    Post subject: Reply with quote

Code:

EG1hp=getAddress("[[[TLR.exe+01DCFAA0]+3c]+301c]+1700")
EG2hp=EG1hp+(1*0x2bc)
EG3hp=EG1hp+(2*0x2bc)
EG4hp=EG1hp+(3*0x2bc)
EG5hp=EG1hp+(4*0x2bc)
EG6hp=EG1hp+(5*0x2bc)
EG7hp=EG1hp+(6*0x2bc)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Xionanx
Newbie cheater
Reputation: 0

Joined: 28 Feb 2013
Posts: 22

PostPosted: Sun Oct 18, 2015 2:31 pm    Post subject: Reply with quote

I take it that means I don't need the readInteger or pointer portion of the code? I only "skimmed" the main.lua file for about 15 minutes.. and I know just enough lua programming to cobble makeshift junk code together.

I felt like there may be a redundant step or two in there. :p

EDIT: Just tested it on CE 6.4 WIN10 64 BIT.

I get an error message saying: "Error:Failure determining what [[[TLR.exe+01DCFAA0]+3c]+301c]+1700 means"

Which I should have guessed was going to happen since I tried using brackets yesterday and kept getting a "Deprecated" error.. Sad
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 Tutorials -> LUA Tutorials 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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites