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 for script ??

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

Joined: 04 Jan 2016
Posts: 10

PostPosted: Mon Jan 04, 2016 8:10 am    Post subject: Help for script ?? Reply with quote

When i make a custom trainer which replace Aob codes of a game,
i need to make 2 button for a single hack.

Code:
function CEButton1Click(sender)
stringListAddresses = AOBScan("XX ZZ VV DD","*X*W-C")--ищем
    -------------------------------------------------------------------------------------
    if (stringListAddresses~=nil) then
  lenghtLines = stringlist_getCount(stringListAddresses)--считаем кол-во найденного
        for i = 0, lenghtLines-1 do -- делаем цикл для i которая изначальна равна 0 и повторяется
   address = stringlist_getString(stringListAddresses, i) --загоняем в переменную address
           writeBytes(address ,0xXX);--делаем подмену в найденой сигнатуре
         showMessage ( "Activated" )
   end --закрываем цикл
    end


and for replacing the code this one

Code:
function CEButton2Click(sender)
 if lenghtLines ~= nil then
  for i = 0, lenghtLines-1 do
       address = stringlist_getString(stringListAddresses, i)
       --на это меняем при включение (кнопка вкл)
       writeBytes(address,0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
    end



how can i combine this codes into a single one so that i can enable a single hack with just a button.
or is there any easier code that can be placed to replace a AA AA AA AA aob with XX XX XX XX aob.
(i got this code from some russian site,that why those russian words)
Back to top
View user's profile Send private message
diamond818
Newbie cheater
Reputation: 0

Joined: 04 Jan 2016
Posts: 10

PostPosted: Tue Jan 05, 2016 2:35 am    Post subject: Reply with quote

Some body please check..
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Tue Jan 05, 2016 9:57 am    Post subject: Reply with quote

If those are 2 different cheats, just put the bodies into the same function, then assign that function to the OnClick property of a button.

If one of those enables the cheat and the other disables the cheat, then still put them in the same function, but wrap them in an if...else statement and use a boolean declared outside the scope of the function to toggle which one is run.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
diamond818
Newbie cheater
Reputation: 0

Joined: 04 Jan 2016
Posts: 10

PostPosted: Tue Jan 05, 2016 12:37 pm    Post subject: Reply with quote

Thanks...i will check and reply
(these codes are for enabling the hack,no disable)

----------------------------------------------------------------------------------


Yeah got it working...

Is there any simpler lua script for doing the above thing in button pres like
replace a aob XX XX XX XX with ZZ ZZ ZZ ZZ.
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Tue Jan 05, 2016 1:15 pm    Post subject: Reply with quote

Code:
function DEC_HEX(IN)
   local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
    if IN<1 then
      OUT=0
      return OUT
   end
   while IN>0 do
      I=I+1
      IN,D=math.floor(IN/B),math.mod(IN,B)+1
      OUT=string.sub(K,D,D)..OUT
   end
   return OUT
end

function Aobswap(search, change)
     aobs = AOBScan(search, "+W*X")
     if(aobs == nil) then
      AobSwapCheck=false
    else
       j = stringlist_getCount(aobs)
      for i = 1, j do
          address=stringlist_getString(aobs,i-1)
          for i = 1, string.len(change), 3 do
             z = string.sub(change, i, i+2)
             x, y = string.find(z, "%?+")
              if (x == nil) then
                script=[[
                ]]..address.."+"..(DEC_HEX((i-1)/3))..[[:
                db ]]..z..[[
                ]]
                autoAssemble(script)
             end
          end
       end
      object_destroy(aobs);
      aobs=nil
      AobSwapCheck=true
   end
end


That is what i use for AobSwap.

Usage:

Aobswap(" SCAN CODE "," REPLACE CODE ")
Back to top
View user's profile Send private message
diamond818
Newbie cheater
Reputation: 0

Joined: 04 Jan 2016
Posts: 10

PostPosted: Tue Jan 05, 2016 2:56 pm    Post subject: Reply with quote

But iam getting this

h t t p: //pr ntscr.c o m/ 9m i eh u

please remove the space and check the pic
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Tue Jan 05, 2016 3:39 pm    Post subject: Reply with quote

...that's not how functions work.

You can call the AoB swap function from another function. Then set that function to the OnClick.

Something like this:
Code:
...
function Aobswap(search, change)
  ...
end

function CEButton1Click(sender)
  Aobswap("11 22 33 44", "AA BB CC DD")
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Tue Jan 05, 2016 3:41 pm    Post subject: Reply with quote

Cant see the full string so cant help out Sad
But since some of the code is black and the other is blue i would say you missed a quotation mark somewhere.

Quote:

Aobswap("12 12 12","13 13 13")
Back to top
View user's profile Send private message
diamond818
Newbie cheater
Reputation: 0

Joined: 04 Jan 2016
Posts: 10

PostPosted: Sat Jan 09, 2016 11:30 am    Post subject: Reply with quote

sOrry for not replying..have been busy..

I get error.When ever i click execute,this shows up
htt p: // prn ts cr . com /9 nz sw e remove space and see
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Sat Jan 09, 2016 3:24 pm    Post subject: Reply with quote

Here ya go. Your issue was you added your code to the actual function. But you should be calling the function when the button is pressed. This is just to show how to use it.


for diamond818.CT
 Description:

Download
 Filename:  for diamond818.CT
 Filesize:  1.58 KB
 Downloaded:  593 Time(s)

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