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 


help creating button

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

Joined: 24 Jan 2019
Posts: 2

PostPosted: Thu Jan 24, 2019 3:02 am    Post subject: help creating button Reply with quote

hello,
i already made a functional lua script but embarrassingly i can't seem to make a button for it in trainer.

here's my script :

Code:
function MyAobScan(Bytes)
local StartAddress=0;
local EndAddress=0x00007fffffffffff;
local Scan = createMemScan();
Scan.OnlyOneResult=true;
Scan.firstScan(soExactValue, vtByteArray, rtTruncated, Bytes, "", StartAddress, EndAddress, "", fsmNotAligned, "", true, false, false, false);
Scan.waitTillDone();
return Scan.getOnlyResult();
end

local awal = string.format("%X",MyAobScan("00 00 00 00 ?? ?? 00 00 75 3A 00 00 00 00"))

local v = string.sub(awal,1,5)

   local s1_atk = v.."EAC"
   local s1_np = v.."ECC"
   local s1_Hp = v.."EB8"
    local s1_MHp = v.."EBC"
    local s1_nplv = v.."ED0"
    local s1_npm = v.."F7C"
   print("servant HP: "..s1_Hp)
   writeToClipboard(s1_Hp)
   print("HP")
    writeInteger(s1_MHp,179650)
    writeInteger(s1_Hp,179650)
   writeInteger(s1_atk,716000)
   writeInteger(s1_np,20000)
    writeInteger(s1_nplv,5)
    writeInteger(s1_npm,5)
   
   local s2_atk = v.."C64"
   local s2_np = v.."C84"
    local s2_Hp = v.."C70"
    local s2_MHp = v.."C74"
    local s2_nplv = v.."C88"
    local s2_npm = v.."D34"
    writeInteger(s2_Hp, 155000)
    writeInteger(s2_MHp, 155000)
   writeInteger(s2_atk,252000)
   writeInteger(s2_np,20000)
    writeInteger(s2_nplv,5)
    writeInteger(s2_npm,5)
   
   local s3_atk = v.."A1C"
   local s3_np = v.."A3C"
    local s3_Hp = v.."A28"
    local s3_MHp = v.."A2C"
    local s3_nplv = v.."A40"
    local s3_npm = v.."AEC"
    writeInteger(s3_MHp,150000)
    writeInteger(s3_Hp,150000)
   writeInteger(s3_atk,155000)
   writeInteger(s3_np,20000)
    writeInteger(s3_nplv,5)
    writeInteger(s3_npm,5)


i think i just need 1 button to get this script running and just have to click on it again to get new scan result.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 27

Joined: 10 Apr 2015
Posts: 983

PostPosted: Thu Jan 24, 2019 7:03 am    Post subject: Reply with quote

Code:
function MyAobScan(Bytes)
local StartAddress=0;
local EndAddress=0x00007fffffffffff;
local Scan = createMemScan();
Scan.OnlyOneResult=true;
Scan.firstScan(soExactValue, vtByteArray, rtTruncated, Bytes, "", StartAddress, EndAddress, "", fsmNotAligned, "", true, false, false, false);
Scan.waitTillDone();
return Scan.getOnlyResult();
end

--- Put in a function

function doAWAL()
local awal = string.format("%X",MyAobScan("00 00 00 00 ?? ?? 00 00 75 3A 00 00 00 00"))

local v = string.sub(awal,1,5)

   local s1_atk = v.."EAC"
   local s1_np = v.."ECC"
   local s1_Hp = v.."EB8"
    local s1_MHp = v.."EBC"
    local s1_nplv = v.."ED0"
    local s1_npm = v.."F7C"
   print("servant HP: "..s1_Hp)
   writeToClipboard(s1_Hp)
   print("HP")
    writeInteger(s1_MHp,179650)
    writeInteger(s1_Hp,179650)
   writeInteger(s1_atk,716000)
   writeInteger(s1_np,20000)
    writeInteger(s1_nplv,5)
    writeInteger(s1_npm,5)
   
   local s2_atk = v.."C64"
   local s2_np = v.."C84"
    local s2_Hp = v.."C70"
    local s2_MHp = v.."C74"
    local s2_nplv = v.."C88"
    local s2_npm = v.."D34"
    writeInteger(s2_Hp, 155000)
    writeInteger(s2_MHp, 155000)
   writeInteger(s2_atk,252000)
   writeInteger(s2_np,20000)
    writeInteger(s2_nplv,5)
    writeInteger(s2_npm,5)
   
   local s3_atk = v.."A1C"
   local s3_np = v.."A3C"
    local s3_Hp = v.."A28"
    local s3_MHp = v.."A2C"
    local s3_nplv = v.."A40"
    local s3_npm = v.."AEC"
    writeInteger(s3_MHp,150000)
    writeInteger(s3_Hp,150000)
   writeInteger(s3_atk,155000)
   writeInteger(s3_np,20000)
    writeInteger(s3_nplv,5)
    writeInteger(s3_npm,5)
end

--- make a button in a trainer, let say it name = CEButton1
--- then call the function by onClick event for CEButton1

UDF1.CEButton1.onClick = doAWAL

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
tempetahu0
How do I cheat?
Reputation: 0

Joined: 24 Jan 2019
Posts: 2

PostPosted: Thu Jan 24, 2019 8:41 am    Post subject: Reply with quote

EDIT2 : it seems i don't need to create code to doAWAL just select function at onClick is enough.
p.s : any input to make it run faster? Razz [/code]
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