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 


How to change values of the AA script

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

Joined: 26 Feb 2018
Posts: 4
Location: Peru

PostPosted: Sat Apr 14, 2018 10:29 pm    Post subject: How to change values of the AA script Reply with quote

hi...

I need help with this .. change values of the AA script in Lua.

I Use string.format and tostring ()



Code:

function CECheckbox1Change(ItemFilter)

  if ItemFilter.checked then
    autoAssemble(string.format([[
    alloc(ItemFilter,256)
    alloc(ItemList,2048)
    alloc(Mesos,4)
    alloc(Mode,4)
    label(Return)
    label(End)
    label(FilterMesos)
    label(RejectOrAccept)
    label(AcceptFilter)
    label(RejectFilter)
    label(Ignore)
   

    Mesos:
    dd #0 // Minimum meso

    Mode:
    dd #%s // 0 = Accept, 1 = reject

    ItemList:
    %s
   
    dd 00 // End of list

    ItemFilter:
    push edx
    mov edx,[Mesos]
    cmp eax,edx
    jle FilterMesos
    mov edx,ItemList
    jmp RejectOrAccept

    FilterMesos:
    mov [ebx+48],0
    jmp End

    RejectOrAccept:
    cmp byte ptr [Mode],0
    je AcceptFilter
    cmp byte ptr [Mode],1
    je RejectFilter

    AcceptFilter:
    cmp eax,[edx]
    je End
    cmp dword ptr [edx],0
    je Ignore
    add edx,4
    jmp AcceptFilter

    RejectFilter:
    cmp eax,[edx]
    je Ignore
    cmp dword ptr [edx],0
    je End
    add edx,4
    jmp RejectFilter

    Ignore:
    cmp eax,#50000 // Added this code otherwise mesos is dropped but not shown in accept mode
    jle End
    mov eax,0

    End:
    pop edx
    mov ecx,edi // Original Opcode
    mov [ebx+48],eax // Original Opcode
    jmp Return

    0108F40F:
    jmp ItemFilter
    Return:
   ]],tostring(UDF1.CEEdit1.Text),UDF1.CEMemo1.Lines.Text))
  end
end   


function ChangeFilterMode(FilterMode)
local value = tostring(UDF1.CEEdit1.Text)
  if FilterMode.Checked then
    writeBytes("Mode", value)
  end
end





Values to be changed are:

Mode: it can be 1 or 0 from un textbox

ItemList: from Memo
dd # 2512226
dd # 2512227
dd # 2512228
dd # 2512229
dd # 2512230
dd # 2512231

I can not find the error.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat Apr 14, 2018 10:59 pm    Post subject: Reply with quote

Code:
print(string.format('1: %s; 2: %s', tostring(1, 2)))

Quote:
Error:[string "print(string.format('1: %s; 2: %s', tostring(..."]:1: bad argument #3 to 'format' (no value)


Code:
print(string.format('1: %d; 2: %d', 1, 2))

Quote:
1: 1; 2: 2

_________________
Back to top
View user's profile Send private message Visit poster's website
byway
How do I cheat?
Reputation: 0

Joined: 26 Feb 2018
Posts: 4
Location: Peru

PostPosted: Sun Apr 15, 2018 4:59 pm    Post subject: Reply with quote

Code:
print(string.format('1: %d; 2: %d', 1, 2))

Quote:
1: 1; 2: 2
[/quote]

correct, but how to use it in the AA script
to edit the values within the AA script.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun Apr 15, 2018 5:08 pm    Post subject: Reply with quote

Are you asking how to use "string.format" or is this a new question?
_________________
Back to top
View user's profile Send private message Visit poster's website
byway
How do I cheat?
Reputation: 0

Joined: 26 Feb 2018
Posts: 4
Location: Peru

PostPosted: Sun Apr 15, 2018 5:24 pm    Post subject: Reply with quote

how to use it correctly because it does not work in this way

Code:


autoAssemble(string.format([[
alloc(ItemList,2048)
alloc(Mode,4)
..
 Mode:
 dd #%s

 ItemList:
  %s
..
..
]],UDF1.CEEdit1.Text,UDF1.CEMemo1.Lines.Text))




Code:

 writeBytes("Mode", value)
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun Apr 15, 2018 5:30 pm    Post subject: Reply with quote

Code:
print(type(UDF1.CEEdit1.Text))
print(UDF1.CEEdit1.Text)
print(type(UDF1.CEMemo1.Lines.Text))
print(UDF1.CEMemo1.Lines.Text)


Code:

print(string.format([[
alloc(ItemList,2048)
alloc(Mode,4)
 Mode:
 dd #%s

 ItemList:
  %s
]],UDF1.CEEdit1.Text,UDF1.CEMemo1.Lines.Text))


Run this and show your results. But I think for starters all the "\r" and "\n" will be trimmed (haven't tested but I remember running into this before).

EDIT:
A different way (the one I like to go), try this function:
Code:

function interp(s, tbl)
   if s == nil then return end
   return (s:gsub('($%b{})', function(w) return tbl[w:sub(3, -2)] or w end))
end


Code:
local s = [[
alloc(ItemList,2048)
alloc(Mode,4)
 Mode:
 dd #${Value}

 ItemList:
  ${ItemList}
]]
local script = interp(s, { Value = UDF1.CEEdit1.Text, ItemList = UDF1.CEMemo1.Lines.Text })
autoAssemble(script)

_________________
Back to top
View user's profile Send private message Visit poster's website
byway
How do I cheat?
Reputation: 0

Joined: 26 Feb 2018
Posts: 4
Location: Peru

PostPosted: Mon Apr 16, 2018 1:05 pm    Post subject: Reply with quote

thanks but apparently it does not work as it should be ..
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