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 


Need help making a trainer with hotkeys and writeInteger

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

Joined: 25 Jan 2011
Posts: 3
Location: ARGENTINA

PostPosted: Mon Dec 17, 2012 12:34 am    Post subject: Need help making a trainer with hotkeys and writeInteger Reply with quote

Hello and first of all thanks!

This is my first attempt of making a trainer so I'm a newbie here.

Code:
function CEButton1Click(sender)
         if tonumber(getProperty(CETrainer_MaxCapBox,"Text")) > 30 then
            setProperty(CETrainer_MaxCapBox,"Text","30")
         end
         memoryrecord_setValue(memrec4, getProperty(CETrainer_MaxCapBox,"Text"))
end

createHotkey(book0, VK_1)
createHotkey(book1, VK_2)
createHotkey(book2, VK_3)
createHotkey(book3, VK_4)
createHotkey(book4, VK_5)
createHotkey(book5, VK_6)
createHotkey(book6, VK_7)

function book0()
   writeInteger("00CE8D64",0)
end

function book1()
   writeInteger("00CE8D64",1)
end

function book2()
   writeInteger("00CE8D64",2)
end

function book3()
   writeInteger("00CE8D64",3)
end

function book4()
   writeInteger("00CE8D64",4)
end

function book5()
   writeInteger("00CE8D64",5)
end

function book6()
   writeInteger("00CE8D64",6)
end

function book7()
   writeInteger("00CE8D64",7)
end


The button and the self-generated code with hotkeys works awesome, but the hotkeys I added works only with CE opened and returns "Error:attempt to call a nil value". If I save the trainer as .exe, the hotkeys doesn't work and it returns "Error:attempt to call a nil value".

I made prints to track the error and the book functions seems to not be called.

Thank you so much again!
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Dec 17, 2012 5:58 am    Post subject: Reply with quote

use this
Code:

function book0()
   writeInteger("00CE8D64",0)
end
createHotkey(book0, VK_1)

function book1()
   writeInteger("00CE8D64",1)
end
createHotkey(book1, VK_2)

function book2()
   writeInteger("00CE8D64",2)
end
createHotkey(book2, VK_3)

function book3()
   writeInteger("00CE8D64",3)
end
createHotkey(book3, VK_4)

function book4()
   writeInteger("00CE8D64",4)
end
createHotkey(book4, VK_5)

function book5()
   writeInteger("00CE8D64",5)
end
createHotkey(book5, VK_6)

function book6()
   writeInteger("00CE8D64",6)
end
createHotkey(book6, VK_7)

function book7()
   writeInteger("00CE8D64",7)
end
createHotkey(book7, VK_8)

you also forgot to create hotkey for book 7 so I added it for you Razz

_________________
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
federan
How do I cheat?
Reputation: 0

Joined: 25 Jan 2011
Posts: 3
Location: ARGENTINA

PostPosted: Mon Dec 17, 2012 9:33 am    Post subject: Reply with quote

Ah lol, that was because I was calling functions that were nil. I understand now thank you so much!

There was a problem also with writeInteger, but I changed the address to "game.exe+offset" and got it working.

Thank you so much again for the help!
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Dec 17, 2012 9:41 am    Post subject: Reply with quote

no problem mate Razz.
_________________
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
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