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 


form only a ct

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

Joined: 28 Mar 2012
Posts: 19

PostPosted: Thu Apr 12, 2012 11:07 am    Post subject: form only a ct Reply with quote

I have 2 cts in the moon ... (both activated by checkbox)

ct1 teleport 1:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB()

  r=AOBScan("60 ?? ?? 61 ?? ?? d0 66 ?? ?? 60 ?? ?? 24 ?? a0 ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist=nil
      resultlist={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist[i+1]={}
        resultlist[i+1][1]=a  --luffy
        resultlist[i+1][2]=readBytes(a, 21, true)




      end
    end
  end
end

function restoreAOB()
  for i=1,#resultlist do
    local a=tonumber("0x"..resultlist[i][1])
    local orig=resultlist[i][2];
    for j=0,20 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB()
  end

  return true
end

function deactivatetick(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB()
  end

  return true
end

al=getAddressList()

mr=addresslist_getMemoryRecordByID(al,0);


memoryrecord_onActivate(mr,activatetick)
memoryrecord_onDeactivate(mr,deactivatetick)


ct2 telepor2:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB()

  r=AOBScan("D3 66 ?? ?? 24 1F A0 24 1E A3 D3 66 ?? ?? 24 1F A0 24 ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist=nil
      resultlist={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist[i+1]={}
        resultlist[i+1][1]=a  --luffy
        resultlist[i+1][2]=readBytes(a, 20, true)




      end
    end
  end
end

function restoreAOB()
  for i=1,#resultlist do
    local a=tonumber("0x"..resultlist[i][1])
    local orig=resultlist[i][2];
    for j=0,19 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB()
  end

  return true
end

function deactivatetick(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB()
  end

  return true
end

al=getAddressList()

mr=addresslist_getMemoryRecordByID(al,0);


memoryrecord_onActivate(mr,activatetick)
memoryrecord_onDeactivate(mr,deactivatetick)

-------------------------------------------------------
I would like to create only one ct.

how to do this?

thank you

(excuse the language, I'm Brazilian)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Apr 12, 2012 12:06 pm    Post subject: Reply with quote

something like this (might have some mistakes, but I hope you get the idea:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB1()

  r=AOBScan("60 ?? ?? 61 ?? ?? d0 66 ?? ?? 60 ?? ?? 24 ?? a0 ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist1=nil
      resultlist1={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist1[i+1]={}
        resultlist1[i+1][1]=a  --luffy
        resultlist1[i+1][2]=readBytes(a, 21, true)




      end
    end
  end
end

function restoreAOB1()
  for i=1,#resultlist1 do
    local a=tonumber("0x"..resultlist1[i][1])
    local orig=resultlist1[i][2];
    for j=0,20 do
      writeBytes(a+j,orig[j])
    end
  end
end

function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB1()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB1()
  end

  return true
end



function replaceAOB2()

  r=AOBScan("D3 66 ?? ?? 24 1F A0 24 1E A3 D3 66 ?? ?? 24 1F A0 24 ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist2=nil
      resultlist2={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist2[i+1]={}
        resultlist2[i+1][1]=a  --luffy
        resultlist2[i+1][2]=readBytes(a, 20, true)




      end
    end
  end
end

function restoreAOB2()
  for i=1,#resultlist2 do
    local a=tonumber("0x"..resultlist2[i][1])
    local orig=resultlist2[i][2];
    for j=0,19 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick2(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB2()
  end

  return true
end

function deactivatetick2(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB2()
  end

  return true
end

al=getAddressList()

mr=addresslist_getMemoryRecord(al,0);
memoryrecord_onActivate(mr,activatetick1)
memoryrecord_onDeactivate(mr,deactivatetick1)

mr=addresslist_getMemoryRecord(al,1);
memoryrecord_onActivate(mr,activatetick2)
memoryrecord_onDeactivate(mr,deactivatetick2)


Now just add 2 entries to the cheat table and run that script

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
the rose
Newbie cheater
Reputation: 0

Joined: 28 Mar 2012
Posts: 19

PostPosted: Thu Apr 12, 2012 1:53 pm    Post subject: Reply with quote

thank you ...
helped me a lot
God bless you
Back to top
View user's profile Send private message
the rose
Newbie cheater
Reputation: 0

Joined: 28 Mar 2012
Posts: 19

PostPosted: Fri Apr 13, 2012 6:16 am    Post subject: Reply with quote

I did so with only one checkbox. worked

***teleport12.ct:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB1()

  r=AOBScan("60 ?? ?? 61 ?? ?? d0 66 ?? ?? 60 ?? ?? 24 ?? a0 ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist1=nil
      resultlist1={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist1[i+1]={}
        resultlist1[i+1][1]=a  --luffy
        resultlist1[i+1][2]=readBytes(a, 21, true)




      end
    end
  end
end

function restoreAOB1()
  for i=1,#resultlist1 do
    local a=tonumber("0x"..resultlist1[i][1])
    local orig=resultlist1[i][2];
    for j=0,20 do
      writeBytes(a+j,orig[j])
    end
  end
end

function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB1()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB1()
  end

  return true
end



function replaceAOB2()

  r=AOBScan("D3 66 ?? ?? 24 1F A0 24 1E A3 D3 66 ?? ?? 24 1F A0 24 ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist2=nil
      resultlist2={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist2[i+1]={}
        resultlist2[i+1][1]=a  --luffy
        resultlist2[i+1][2]=readBytes(a, 20, true)




      end
    end
  end
end

function restoreAOB2()
  for i=1,#resultlist2 do
    local a=tonumber("0x"..resultlist2[i][1])
    local orig=resultlist2[i][2];
    for j=0,19 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB2()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB2()
  end

  return true
end

al=getAddressList()

mr=addresslist_getMemoryRecord(al,0);
memoryrecord_onActivate(mr,activatetick1)
memoryrecord_onDeactivate(mr,deactivatetick1)

****************
when I tried to insert another ct, teleport3 gave error

teleport3.ct:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB()

  r=AOBScan("d0 66 ?? ?? 66 ?? ?? 66 ?? ?? 24 00 14 ?? 00 00 60 ?? ?? d0 66 ?? ?? 61 ?? ?? d0 60 ?? ?? 66 ?? ?? 66 ?? ?? 60 ?? ?? 66 ?? ?? 14 ?? 00 00 d0 66 ?? ?? 60 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist=nil
      resultlist={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist[i+1]={}
        resultlist[i+1][1]=a  --luffy
        resultlist[i+1][2]=readBytes(a, 80, true)




      end
    end
  end
end

function restoreAOB()
  for i=1,#resultlist do
    local a=tonumber("0x"..resultlist[i][1])
    local orig=resultlist[i][2];
    for j=0,79 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB()
  end

  return true
end

function deactivatetick(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB()
  end

  return true
end

al=getAddressList()

mr=addresslist_getMemoryRecordByID(al,0);


memoryrecord_onActivate(mr,activatetick)
memoryrecord_onDeactivate(mr,deactivatetick)

***************************
I did this code:

teleport123.ct:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB1()

  r=AOBScan("60 ?? ?? 61 ?? ?? d0 66 ?? ?? 60 ?? ?? 24 ?? a0 ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist1=nil
      resultlist1={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist1[i+1]={}
        resultlist1[i+1][1]=a  --luffy
        resultlist1[i+1][2]=readBytes(a, 21, true)




      end
    end
  end
end

function restoreAOB1()
  for i=1,#resultlist1 do
    local a=tonumber("0x"..resultlist1[i][1])
    local orig=resultlist1[i][2];
    for j=0,20 do
      writeBytes(a+j,orig[j])
    end
  end
end

function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB1()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB1()
  end

  return true
end



function replaceAOB2()

  r=AOBScan("D3 66 ?? ?? 24 1F A0 24 1E A3 D3 66 ?? ?? 24 1F A0 24 ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist2=nil
      resultlist2={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist2[i+1]={}
        resultlist2[i+1][1]=a  --luffy
        resultlist2[i+1][2]=readBytes(a, 20, true)




      end
    end
  end
end

function restoreAOB2()
  for i=1,#resultlist2 do
    local a=tonumber("0x"..resultlist2[i][1])
    local orig=resultlist2[i][2];
    for j=0,19 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB2()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB2()
  end

  return true
end

function replaceAOB3()

  r=AOBScan("d0 66 ?? ?? 66 ?? ?? 66 ?? ?? 24 00 14 ?? 00 00 60 ?? ?? d0 66 ?? ?? 61 ?? ?? d0 60 ?? ?? 66 ?? ?? 66 ?? ?? 60 ?? ?? 66 ?? ?? 14 ?? 00 00 d0 66 ?? ?? 60 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist3=nil
      resultlist3={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist3[i+1]={}
        resultlist3[i+1][1]=a  --luffy
        resultlist3[i+1][2]=readBytes(a, 80, true)




      end
    end
  end
end

function restoreAOB3()
  for i=1,#resultlist3 do
    local a=tonumber("0x"..resultlist3[i][1])
    local orig=resultlist3[i][2];
    for j=0,79 do
      writeBytes(a+j,orig[j])
    end
  end
end

function activatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB3()
  end

  return true
end

function deactivatetick1(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB3()
  end

  return true
end


al=getAddressList()

mr=addresslist_getMemoryRecord(al,0);
memoryrecord_onActivate(mr,activatetick1)
memoryrecord_onDeactivate(mr,deactivatetick1)

*********************this up did not work Sad
Can anyone tell me where is the mistake?

thank you....
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Apr 13, 2012 6:59 am    Post subject: Reply with quote

Your first script also doesn't work. It only activates the second script

Try something like this:
Code:

function myscript()
  closeCE()
end

if spacehk==nil then
  hk=createHotkey('myscript', VK_F1)
end

function myattach(timer)
  if getProcessIDFromProcessName("Transformice.exe") ~= nil then
    object_destroy(timer)
    openProcess("Transformice.exe")
  end
end

t=createTimer(nil);
timer_setInterval(t,100)
timer_onTimer(t,myattach)

function replaceAOB1()

  r=AOBScan("60 ?? ?? 61 ?? ?? d0 66 ?? ?? 60 ?? ?? 24 ?? a0 ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist1=nil
      resultlist1={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist1[i+1]={}
        resultlist1[i+1][1]=a  --luffy
        resultlist1[i+1][2]=readBytes(a, 21, true)




      end
    end
  end
end

function restoreAOB1()
  for i=1,#resultlist1 do
    local a=tonumber("0x"..resultlist1[i][1])
    local orig=resultlist1[i][2];
    for j=0,20 do
      writeBytes(a+j,orig[j])
    end
  end
end


function replaceAOB2()

  r=AOBScan("D3 66 ?? ?? 24 1F A0 24 1E A3 D3 66 ?? ?? 24 1F A0 24 ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist2=nil
      resultlist2={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist2[i+1]={}
        resultlist2[i+1][1]=a  --luffy
        resultlist2[i+1][2]=readBytes(a, 20, true)




      end
    end
  end
end

function restoreAOB2()
  for i=1,#resultlist2 do
    local a=tonumber("0x"..resultlist2[i][1])
    local orig=resultlist2[i][2];
    for j=0,19 do
      writeBytes(a+j,orig[j])
    end
  end
end


function replaceAOB3()

  r=AOBScan("d0 66 ?? ?? 66 ?? ?? 66 ?? ?? 24 00 14 ?? 00 00 60 ?? ?? d0 66 ?? ?? 61 ?? ?? d0 60 ?? ?? 66 ?? ?? 66 ?? ?? 60 ?? ?? 66 ?? ?? 14 ?? 00 00 d0 66 ?? ?? 60 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist3=nil
      resultlist3={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist3[i+1]={}
        resultlist3[i+1][1]=a  --luffy
        resultlist3[i+1][2]=readBytes(a, 80, true)




      end
    end
  end
end

function restoreAOB3()
  for i=1,#resultlist3 do
    local a=tonumber("0x"..resultlist3[i][1])
    local orig=resultlist3[i][2];
    for j=0,79 do
      writeBytes(a+j,orig[j])
    end
  end
end

function activatetick(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB1()
    replaceAOB2()
    replaceAOB3()
  end

  return true
end

function deactivatetick(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB1()
    restoreAOB2()
    restoreAOB3()
  end

  return true
end


al=getAddressList()

mr=addresslist_getMemoryRecord(al,0);
memoryrecord_onActivate(mr,activatetick)
memoryrecord_onDeactivate(mr,deactivatetick)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
the rose
Newbie cheater
Reputation: 0

Joined: 28 Mar 2012
Posts: 19

PostPosted: Fri Apr 13, 2012 10:23 am    Post subject: Reply with quote

you face is very good ...

thank you very much Very Happy
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