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 


Auto activate script

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

Joined: 14 May 2018
Posts: 4

PostPosted: Mon May 14, 2018 8:41 am    Post subject: Auto activate script Reply with quote

Hi, I'm quite new to CE, so I'm sorry if a lot of this is the complete opposite of what someone should do. I made an "Auto assemble script" that I want to run as soon as my computer runs so that when I run that process, it automatically executes it. I added "getAutoAttachList().add("process.exe")" to my Cheat table Lua script, and that seemed to work fine, however, I couldn't find a way to get the script to execute. I tried adding it to "function onOpenProcess(processid)" but that seemed to just give me an error when I copied the code from the "Auto assemble script." Is there a way to have a CT that runs when my computer starts, wait until a program runs, executes that script, and if it closes, will still execute it again when it's reran?
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon May 14, 2018 10:27 am    Post subject: This post has 1 review(s) Reply with quote

Were you mixing Lua script with AA script?
This may help explain the two.
https://wiki.cheatengine.org/index.php?title=Tutorials:Auto_Assembler:Basics
https://wiki.cheatengine.org/index.php?title=Tutorials:Lua:Basics

This is more an explanation on how to do it your self with some Lua script.
https://www.cheatengine.org/forum/viewtopic.php?p=5616543

This is an extension, I haven't used it but seems simple to use.
https://forum.cheatengine.org/viewtopic.php?p=5644833

https://www.google.com/search?q=cheat+engine+auto+activate

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

Joined: 14 May 2018
Posts: 4

PostPosted: Mon May 14, 2018 10:38 am    Post subject: Reply with quote

I keep getting
Quote:
attempt to index a nil value
if I put any code after
Code:
getAutoAttachList().add("process.exe")
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon May 14, 2018 4:02 pm    Post subject: Reply with quote

Is that the full script, this works fine for me.
Code:
getAutoAttachList().add('Tutorial-i386.exe')
speak('I have the power!')


What's the actual script and error.

_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon May 14, 2018 5:56 pm    Post subject: Reply with quote

OrangutanGaming

Quote:

Is there a way to have a CT that runs when my computer starts


1. To run an app or execute a file when computer start by DOS, usually make a file name with AUTOEXEC.BAT and place it on root directory

in Windows 7 :
To run a batch file at start up: start >> all programs >> right-click startup >> open >> right click batch file >> create shortcut >> drag shortcut to startup folder.

or see this :
https://grok.lsu.edu/article.aspx?articleid=13076

Example a bat file to open cheat engine forum when computer start :

Code:
@echo off
title Auto launch Cheat Engine Forum
start firefox https://forum.cheatengine.org
exit


2. To auto execute CT table file when CE start, save CT Table as a lua file and place on CE folder > autorun folder

something like this :

Code:
function dostuff(sender)
  -- your code here
  sender.destroy()
end

originalOnOpenProcess=onOpenProcess;

function onOpenProcess(processid)
  t=createTimer(nil)
  t.OnTimer=dostuff
  t.Interval=1
  t.Enabled=true

  if originalOnOpenProcess~=nil then
    originalOnOpenProcess(processid)
  end
end


Note : when mix AA script with lua script, remember lua script is execute first.

or check this :
https://wiki.cheatengine.org/index.php?title=Tutorials:Lua:Setup_Auto_Attach

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

Joined: 14 May 2018
Posts: 4

PostPosted: Tue May 15, 2018 1:10 am    Post subject: Reply with quote

Code:
aalist=getAutoAttachList();
stringlist_add(aalist,"process.exe");

function onOpenProcess(processId)
 if getProcessIDFromProcessName("Tabletop Simulator.exe") == processId then
  getAddressList().getMemoryRecordByDescription("Auto Assmble script").Active=true;
 end
end

Code:
getAutoAttachList().add("Tabletop Simulator.exe")
getAddressList().getMemoryRecordByDescription("Auto Assmble script").Active=true

Both of those give me the error:
Quote:
Error:[string "aalist=getAutoAttachList();
..."]:6: attempt to index a nil value
or shows the first line of the 2nd code block as the source of the error. Just having
Code:
getAutoAttachList().add("process.exe")
gives me no error though.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue May 15, 2018 1:54 am    Post subject: Reply with quote

The error is telling you you're indexing a nil value (same as "nil.someIndex") on line 6. Check for "nil" with the memory record.

Code:
getAutoAttachList().add("process.exe")

function onOpenProcess(processId)
  if getProcessIDFromProcessName("Tabletop Simulator.exe") == processId then
    aas = getAddressList().getMemoryRecordByDescription("Auto Assmble script")
    if aas ~= nil then
      aas.Active=true
    end
  end
end

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

Joined: 14 May 2018
Posts: 4

PostPosted: Tue May 15, 2018 10:53 am    Post subject: Reply with quote

Code:
getAutoAttachList().add("Tabletop Simulator.exe");

function onOpenProcess(processId)
 if getProcessIDFromProcessName("Tabletop Simulator.exe") == processId then
  getAddressList().getMemoryRecordByDescription("Auto Assemble script").Active=true
 end
end

This code is working, made a typo in "assemble" and still can't find a way to rename the script, but with the specific script, it won't activate when the game is initially ran with this setup, but if I start the script while in a game, it will activate fine. Is there a way to check it's activate status accurately, so check if it's active, and if not, wait 5 secs, then try to activate it again? I found the sleep function, but using
Code:
getAddressList().getMemoryRecordByDescription("Auto Assemble script").Active
didn't work
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