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 


unsure how to write this script to do what I want
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Mon Sep 14, 2015 8:12 pm    Post subject: unsure how to write this script to do what I want Reply with quote

I would like to know how to make this work

When this address 12B81548 has the value of 1,2,3,4 or 5

I want the value of these addresses



Address: Starting Value
11F9B8D4: 14642864 change to this value 4294967295
12882354: 24524640 change to this value 4294967295
129D2FA4: 25354864 change to this value 4294967295
129C7F14: 17747056 change to this value 4294967295
11F690D4: 25341312 change to this value 4294967295
12B297C4: 22708128 change to this value 4294967295
127599D4: 21844512 change to this value 4294967295
11FB04E4: 14799024 change to this value 4294967295
119C2784: 32426208 change to this value 4294967295
12A7C784: 26650400 change to this value 4294967295
1278A2A4: 25881776 change to this value 4294967295
12A8D634: 25287040 change to this value 4294967295
12840B34: 25000800 change to this value 4294967295
1277C1C4: 24423632 change to this value 4294967295
122D7E84: 23956064 change to this value 4294967295
127BFDC4: 22801696 change to this value 4294967295
12727EB4: 22557056 change to this value 4294967295
1194DFC4: 21479168 change to this value 4294967295
127B8C14: 17732800 change to this value 4294967295
1213EB44: 17081936 change to this value 4294967295
1280C0A4: 15161040 change to this value 4294967295
12894BE4: 14555504 change to this value 4294967295
122D7B94: 8755248 change to this value 4294967295

then when this address 12B8152C has a value of 0
Wait 2 seconds then values change back to the starting values

If anyone knows how to write this please let me know
Back to top
View user's profile Send private message
Snow1337
Catastrophic Cheatah
Reputation: 1

Joined: 12 Oct 2004
Posts: 183
Location: Your, Computer

PostPosted: Mon Sep 14, 2015 9:01 pm    Post subject: Reply with quote

Faxonation wrote:
I would like to know how to make this work

When this address 12B81548 has the value of 1,2,3,4 or 5

I want the value of these addresses



Address: Starting Value
11F9B8D4: 14642864 change to this value 4294967295
12882354: 24524640 change to this value 4294967295
129D2FA4: 25354864 change to this value 4294967295
129C7F14: 17747056 change to this value 4294967295
11F690D4: 25341312 change to this value 4294967295
12B297C4: 22708128 change to this value 4294967295
127599D4: 21844512 change to this value 4294967295
11FB04E4: 14799024 change to this value 4294967295
119C2784: 32426208 change to this value 4294967295
12A7C784: 26650400 change to this value 4294967295
1278A2A4: 25881776 change to this value 4294967295
12A8D634: 25287040 change to this value 4294967295
12840B34: 25000800 change to this value 4294967295
1277C1C4: 24423632 change to this value 4294967295
122D7E84: 23956064 change to this value 4294967295
127BFDC4: 22801696 change to this value 4294967295
12727EB4: 22557056 change to this value 4294967295
1194DFC4: 21479168 change to this value 4294967295
127B8C14: 17732800 change to this value 4294967295
1213EB44: 17081936 change to this value 4294967295
1280C0A4: 15161040 change to this value 4294967295
12894BE4: 14555504 change to this value 4294967295
122D7B94: 8755248 change to this value 4294967295

then when this address 12B8152C has a value of 0
Wait 2 seconds then values change back to the starting values

If anyone knows how to write this please let me know


Code:
 [ENABLE] 
//code from here to '[DISABLE]' will be used to enable the cheat 

alloc(newmem,2048) //2kb should be enough 
label(returnhere) 
label(originalcode) 
label(changecode)
label(exit) 

Game.exe+12345678: 
jmp newmem 
returnhere: 
pop eax
newmem:
mov eax, [12B81548]
cmp eax, 01
je changecode
jne after
cmp eax, 02
je changecode
jne after
cmp eax, 03
je changecode
jne after
cmp eax, 04
je changecode
jne after
cmp eax, 05
je changecode
jne newmem
changecode:
mov esi, [11F9B8D4]
mov ebx, ff ff ff ff
mov esi, ebx
pop esi
mov esi, [12882354]
mov esi, ebx
pop esi
etc. etc.







originalcode: 
mov [esi+00000146],eax (guess)

exit: 
jmp returnhere 
  
  
[DISABLE] 
//code from here till the end of the code will be used to disable the cheat 
dealloc(newmem) //free memory
Game.exe+12345678: 

_________________
Back to top
View user's profile Send private message Visit poster's website
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Sep 14, 2015 9:05 pm    Post subject: Reply with quote

Code:
[ENABLE]
{$lua}
if mytimer == nil then
  should_change = true
  elapsed_time = 0
  interval_timer = 100
  mytimer=createTimer(nil)
  mytimer.Interval=interval_timer
  mytimer.OnTimer=function(t)
    local value = readInteger("12B81548")
    if value >= 1 and value <= 5 and should_change then
      should_change = false
      elapsed_time = 0
      writeInteger("11F9B8D4", 4294967295)
      -- write the rest
    end
    value = readInteger("12B8152C")
    if value == 0 then
      if elapsed_time > 2000 then
        should_change = true
        writeInteger("11F9B8D4", 14642864)
        -- write the rest
      end
      elapsed_time = elapsed_time + interval_timer
    end
  end
end
mytimer.Enabled=true
{$asm}
[DISABLE]
{$lua}
mytimer.Enabled=false
Back to top
View user's profile Send private message
Snow1337
Catastrophic Cheatah
Reputation: 1

Joined: 12 Oct 2004
Posts: 183
Location: Your, Computer

PostPosted: Mon Sep 14, 2015 9:08 pm    Post subject: Reply with quote

yea his script is cleaner
_________________
Back to top
View user's profile Send private message Visit poster's website
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Mon Sep 14, 2015 11:42 pm    Post subject: Reply with quote

(OOPS! Wrongly understand the problem, there are 2 address 2 test 0-5 ...)
-- updated, and hopefully fixed~

This similar to Zanzer version, just made it a bit handy to update the address list. Also assume the original values in the list need not be hard coded, but restore as is.

Code:
{$lua}
if syntaxcheck==true then return end

function monitor(probe1,probe2,nuke,addrs)
  local T = {t=createTimer(),c=0,mode=0,tick=0,store={}}
  T.t.Interval = 100
  T.t.OnTimer = function(sender)
--    if T.c<400 then T.c=T.c+1 else return sender.Destroy() end -- no one should live forever!!
--[[ debug
    writeInteger("__+70",T.c)
    writeInteger("__+80",T.mode)
    writeInteger("__+90",T.tick)
    writeInteger("__+a0",#T.store)
--]]
    local p1,p2 = readInteger(probe1),readInteger(probe2)
    if T.mode~=1 and p1<=5 and p1>=1 then
      local s = {}
      for i,addy in ipairs(addrs) do
        s[i]=string.format([[
        %X:
        dd %X
        ]],getAddress(addy),nuke)
        if #T.store<i then T.store[i]={addy,readInteger(addy)} end
      end
      assert(autoAssemble(table.concat(s,"\n")),"check not setting nuke")
      T.mode=1
      T.tick=0
    elseif T.mode==1 and p2==0 then
      T.mode=2
    elseif T.mode==2 then
      if T.tick < 2000/T.t.Interval then
        T.tick = T.tick +1
      else
        T.tick=0
        T.mode=0
        local s = {}
        for i=#T.store,1,-1 do
          local k = T.store[i]
          table.remove(T.store)
          s[i]=string.format([[
          %X:
          dd %X
          ]],getAddress(k[1]),k[2])
        end
        assert(autoAssemble(table.concat(s,"\n")),"check not removing nuke")
      end
    end
  end
  return T
end

[ENABLE]

local r = autoAssemble([[
  globalalloc(__,$4000)
  __:
  dq __
  __+10:
  db 11 11 11 11
  __+20:
  db 22 22 22 22
  __+30:
  db 33 33 33 33
  __+40:
  db 44 44 44 44
  __+50:
  db 55 55 55 55
]])

-- TT = TT or monitor('__+08','__+0c',-1,{'__+10','__+30','__+40','__+50'})
TT = TT or monitor("12B81548","12B8152C",-1,{"11F9B8D4","12882354","129D2FA4","129C7F14","11F690D4","12B297C4","127599D4","11FB04E4","119C2784","12A7C784","1278A2A4","12A8D634","12840B34","1277C1C4","122D7E84","127BFDC4","12727EB4","1194DFC4","127B8C14","1213EB44","1280C0A4","12894BE4","122D7B94"})

TT.t.Enabled=true
[DISABLE]
TT.t.Enabled=false


_________________
- Retarded.


Last edited by panraven on Tue Sep 15, 2015 12:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Tue Sep 15, 2015 9:43 am    Post subject: Does this look right Reply with quote

This is what I get when I put this in lua engine

Script Error:[string "[ENABLE]..."]:1: unexpected symbol near '['




ENABLE]
{$lua}
if mytimer == nil then
should_change = true
elapsed_time = 0
interval_timer = 100
mytimer=createTimer(nil)
mytimer.Interval=interval_timer
mytimer.OnTimer=function(t)
local value = readInteger("12B81548")
if value >= 1 and value <= 5 and should_change then
should_change = false
elapsed_time = 0
writeInteger("11F9B8D4", 4294967295)
writeInteger("12882354", 4294967295)
writeInteger("12750934", 4294967295)
writeInteger("129D2FA4", 4294967295)
writeInteger("129C7F14", 4294967295)
writeInteger("11F690D4", 4294967295)
writeInteger("12B297C4", 4294967295)
writeInteger("127599D4", 4294967295)
writeInteger("11FB04E4", 4294967295)
writeInteger("119C2784", 4294967295)
writeInteger("12A7C784", 4294967295)
writeInteger("1278A2A4", 4294967295)
writeInteger("12A8D634", 4294967295)
writeInteger("12840B34", 4294967295)
writeInteger("1277C1C4", 4294967295)
writeInteger("122D7E84", 4294967295)
writeInteger("127BFDC4", 4294967295)
writeInteger("12727EB4", 4294967295)
writeInteger("1194DFC4", 4294967295)
writeInteger("127B8C14", 4294967295)
writeInteger("1213EB44", 4294967295)
writeInteger("1280C0A4", 4294967295)
writeInteger("12894BE4", 4294967295)
writeInteger("122D7B94", 4294967295)
end
value = readInteger("12B8152C")
if value == 0 then
if elapsed_time > 2000 then
should_change = true
writeInteger("11F9B8D4", 14642864)
writeInteger("12882354", 24524640)
writeInteger("12750934", 14653680)
writeInteger("129D2FA4", 25354864)
writeInteger("129C7F14", 17747056)
writeInteger("11F690D4", 25341312)
writeInteger("12B297C4", 22708128)
writeInteger("127599D4", 21844512)
writeInteger("11FB04E4", 14799024)
writeInteger("119C2784", 32426208)
writeInteger("12A7C784", 26650400)
writeInteger("1278A2A4", 25881776)
writeInteger("12A8D634", 25287040)
writeInteger("12840B34", 25000800)
writeInteger("1277C1C4", 24423632)
writeInteger("122D7E84", 23956064)
writeInteger("127BFDC4", 22801696)
writeInteger("12727EB4", 22557056)
writeInteger("1194DFC4", 21479168)
writeInteger("127B8C14", 17732800)
writeInteger("1213EB44", 17081936)
writeInteger("1280C0A4", 15161040)
writeInteger("12894BE4", 14555504)
writeInteger("122D7B94", 8755248)
end
elapsed_time = elapsed_time + interval_timer
end
end
end
mytimer.Enabled=true
{$asm}
[DISABLE]
{$lua}
mytimer.Enabled=false
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Sep 15, 2015 11:37 am    Post subject: Re: Does this look right Reply with quote

Faxonation wrote:
This is what I get when I put this in lua engine

Script Error:[string "[ENABLE]..."]:1: unexpected symbol near '['




ENABLE]
{$lua}
if mytimer == nil then
should_change = true
elapsed_time = 0
interval_timer = 100
mytimer=createTimer(nil)
mytimer.Interval=interval_timer
mytimer.OnTimer=function(t)
local value = readInteger("12B81548")
if value >= 1 and value <= 5 and should_change then
should_change = false
elapsed_time = 0
writeInteger("11F9B8D4", 4294967295)
writeInteger("12882354", 4294967295)
writeInteger("12750934", 4294967295)
writeInteger("129D2FA4", 4294967295)
writeInteger("129C7F14", 4294967295)
writeInteger("11F690D4", 4294967295)
writeInteger("12B297C4", 4294967295)
writeInteger("127599D4", 4294967295)
writeInteger("11FB04E4", 4294967295)
writeInteger("119C2784", 4294967295)
writeInteger("12A7C784", 4294967295)
writeInteger("1278A2A4", 4294967295)
writeInteger("12A8D634", 4294967295)
writeInteger("12840B34", 4294967295)
writeInteger("1277C1C4", 4294967295)
writeInteger("122D7E84", 4294967295)
writeInteger("127BFDC4", 4294967295)
writeInteger("12727EB4", 4294967295)
writeInteger("1194DFC4", 4294967295)
writeInteger("127B8C14", 4294967295)
writeInteger("1213EB44", 4294967295)
writeInteger("1280C0A4", 4294967295)
writeInteger("12894BE4", 4294967295)
writeInteger("122D7B94", 4294967295)
end
value = readInteger("12B8152C")
if value == 0 then
if elapsed_time > 2000 then
should_change = true
writeInteger("11F9B8D4", 14642864)
writeInteger("12882354", 24524640)
writeInteger("12750934", 14653680)
writeInteger("129D2FA4", 25354864)
writeInteger("129C7F14", 17747056)
writeInteger("11F690D4", 25341312)
writeInteger("12B297C4", 22708128)
writeInteger("127599D4", 21844512)
writeInteger("11FB04E4", 14799024)
writeInteger("119C2784", 32426208)
writeInteger("12A7C784", 26650400)
writeInteger("1278A2A4", 25881776)
writeInteger("12A8D634", 25287040)
writeInteger("12840B34", 25000800)
writeInteger("1277C1C4", 24423632)
writeInteger("122D7E84", 23956064)
writeInteger("127BFDC4", 22801696)
writeInteger("12727EB4", 22557056)
writeInteger("1194DFC4", 21479168)
writeInteger("127B8C14", 17732800)
writeInteger("1213EB44", 17081936)
writeInteger("1280C0A4", 15161040)
writeInteger("12894BE4", 14555504)
writeInteger("122D7B94", 8755248)
end
elapsed_time = elapsed_time + interval_timer
end
end
end
mytimer.Enabled=true
{$asm}
[DISABLE]
{$lua}
mytimer.Enabled=false


Paste it in a copy of cheat entry of script type (it show <script> at 'value' with no type showing, vs 4bytes or float type) from 'change script' right-click command.

If there are no script type cheat entry, make one with -> memory view ->tool->AutoAssemble-> then
1. Template->'Cheat Table Framework code' &
2. File->Assign to current cheat table

Then a script type cheat entry should be in the mainform lower panel.

bye~



cescriptxx.jpg
 Description:
 Filesize:  17.47 KB
 Viewed:  14190 Time(s)

cescriptxx.jpg



_________________
- Retarded.
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Tue Sep 15, 2015 12:14 pm    Post subject: Reply with quote

Still not working.


lua1.png
 Description:
Here is a picture after following your directions
 Filesize:  313.29 KB
 Viewed:  14181 Time(s)

lua1.png


Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Sep 15, 2015 12:28 pm    Post subject: Reply with quote

Try Zanzer's script, not mine. You have already hard coded the addresses.
Check if the copy and paste missing some characters?

_________________
- Retarded.
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Tue Sep 15, 2015 1:08 pm    Post subject: Reply with quote

that was Zanzer's code

I tried them all and get the same sort of error
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Sep 15, 2015 4:27 pm    Post subject: Reply with quote

Not sure what's going on with your system.
I copied your script and it pasted fine.



test.CT
 Description:

Download
 Filename:  test.CT
 Filesize:  2.73 KB
 Downloaded:  708 Time(s)

Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Tue Sep 15, 2015 6:17 pm    Post subject: Reply with quote

I got it working but I cant get it to shut off when it runs its cycle. I would like for it to turn off once the original values are back and only turn back on when that first address is a 1 ,2,3,4 or five again.

Do you know how to make that happen?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Sep 15, 2015 7:09 pm    Post subject: Reply with quote

Well, of course, my code is always flawless... Smile
So I must question whether readInteger("12B8152C") ever equals zero.
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Wed Sep 16, 2015 5:12 pm    Post subject: Reply with quote

I got it now. Everything works perfect. Is there any way to save the script into my savestate so I don't have to run the script everytime?


2.png
 Description:
 Filesize:  799.85 KB
 Viewed:  14025 Time(s)

2.png




Last edited by Faxonation on Wed Sep 16, 2015 5:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Sep 16, 2015 5:52 pm    Post subject: Reply with quote

Looks like you changed my logic.
Did 12B8152C equal 0 while 12B81548 equaled 2?

By the way, if you execute the code a second time, it will not update any changes you made in the function.
If you want it to update the function, you'll have to move it outside of the initial IF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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