Page 1 of 1

CE Lua script advanced

Posted: Sat Mar 07, 2015 5:47 pm
by papariba
hello,
im trying to make a trainer for game. i found the "base address" (pointer) and i can create a button (wohooo! :D) but i miserably fail at giving that button a function.
so my problem is: which function do i give that button that upon clicking the value of the pointer changes? as for value,it is an array of bytes (teleport hack)

i'd appreciate any help,

thank you for reading.

PS: i am an absolutly inexperienced newbie in terms of lua scripts :(

Re: CE Lua script advanced

Posted: Sat Mar 07, 2015 8:44 pm
by Sethioz
Why do you make it in lua? if you want a basic trainer, use the trainer generator.
assign hotkeys to your addresses / cheats in a cheat list and then generate a trainer from table. it will include all hotkeys and you will be able to edit the layout of trainer. best for beginners.

however if you are sure you wanna use lua, depends what button you wanna make and what it should do.

for example in one trainer i used this to set a hotkey in lua.

Code: Select all

function cheat01(sender)
writeInteger("[[[[[game.exe+00C2564C]+01]+4]+8]+40]+118", 3)
end
createHotkey(drivetrain1, VK_INSERT)
This writes value 3 when you press INSERT button.
buttons and hotkeys are separate in lua, you have to set a hotkey and if you want a button aswell:
- create button
- click on it
- click on object inspector window
- click on events tab
- click on empty area behind "OnClick" and then press on ... button at end.
- this will open lua editor in a place where the button is
- in there, you have to write your code (what button should do)

for example here's what my button does:

Code: Select all

function CEButton1Click(sender)
writeFloat("[[[[[game.exe+00C2564C]+1]+4]+8]+40]+38", getProperty(UDF1_CEEdit1,"Text"))
end
It will take the value from "CEEdit1" box. you can insert an edit box, so you can write your own value into the box and when you hit the button, it takes the inserted value from box and writes it to the address + offset.

I think this is what you looking for?

Re: CE Lua script advanced

Posted: Sat Mar 07, 2015 9:03 pm
by papariba
Hello,

thank you for the quick response.

the trainer generator is unfortunately restricted to hotkeys only,but for my hack to work it need way more "hotkeys" than there are available lol. simple: i have around 15+ different values (=game locations),which would be easier
with 15 different buttons to click on.

i can recall the examples you gave me from your youtube video,but the point is the value i want to change it to is an array of bytes,not float or integer (or am i mistaken?) example: A7 EC 38 47 EC B2 5C 47 00 A0 11 45 7F F7 8E BC 0A F6 7F 3F (one location)
and before i can change that address to this value,i need the base address,which i already found.so how do i convert this idea into a function?

looking forward to reading your answers,

riba

Re: CE Lua script advanced

Posted: Sat Mar 07, 2015 9:09 pm
by Sethioz
I still recommend hotkeys, you can use combination of CTRL+ ALT+ and SHIFT+ numpad buttons.
you will have 30 hotkeys that way.

I wrote one trainer purely based on AoB scan and value changes. just wrote a small assembly script and set a hotkey for each.
if you wanna write HEX string, you just do:
db 01 02 03 04 05

In lua, i'm not entirely sure how it would look like. you'd have to look it up on CE help files or ask on their forum about correct syntax.
it should be something like writehex maybe? and then replace the edit box with the array of bytes and "Text" with "HEX".
but as i said, i'm not sure about correct syntaxes. I always crash my game few times before i get it right, i just go over it and google if necessary, i don't know lua from head, i just know general stuff on how it works.