Beginner Help Needed

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
DaSpamer
What is cheating?
What is cheating?
Posts: 2
Joined: Sat Mar 04, 2017 2:03 am
Reputation: 0

Re: Beginner Help Needed

Post by DaSpamer » Sat Mar 04, 2017 3:24 am

A little bit offtopic
The table.search function provided here is updated and much more optimized, (based on my test in that post, using very same laptop model, or desktop using i7-4790k @4GHz).
It seems that table.search is 2-3 times much faster, thus this function could be handy almost in any situation, and I really hope you guys make use of it.
I commented new timestamps, along with the older previous test ones.

Code: Select all

-- i7-4720HQ @3.5GHz 4Cores
local start_time = os.clock();
t = {}
for i=1,500000 do --500k table size
    t[i]=i-1
end
print(os.clock()-start_time) -- 0.0280000.. -- 0.05 sec to create the table
local start_time = os.clock();
print(tostring(table.search(t,500000,false,true)))--true -- will try to find a key with the value of 500,000
print(os.clock()-start_time) -- 0.08799999.. -- 0.197sec sec to scan the whole table

function nestedTable(object,times) -- creates nested table -> object={{{{..n times}}}}
    if (times > 0 ) then
        object[#object+1] = {times = times}
        return (nestedTable(object[#object],times-1))
    end
end
local start_time = os.clock();
t = {};
nestedTable(t,15000) --> will create table inside a table x 15000 times.
print(os.clock()-start_time) -- 0.017000 .. --0.007 sec to create the nested table
local start_time = os.clock();
print(tostring(table.search(t,1,false)))-- true -- will try to find a 1 (as a table value), the very last table value
print(os.clock()-start_time) -- 0.04199999.. -- 0.014 sec to find the value in the nested table


I recommend using the code as it is, It's very simple, basically iterates over the whole table and it's childs childs childs...

User avatar
++METHOS
Administration
Administration
Posts: 203
Joined: Thu Mar 02, 2017 9:02 pm
Reputation: 29

Re: Beginner Help Needed

Post by ++METHOS » Sat Mar 04, 2017 3:36 am

Thanks, DaSpamer.

I wish I could make more sense of what you wrote here. I will be sure to study it more and hopefully make use of it in the future. :mrgreen:

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1154
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 206
Contact:

Re: Beginner Help Needed

Post by TheyCallMeTim13 » Sat Mar 04, 2017 3:49 am

DaSpamer wrote:
Sat Mar 04, 2017 2:34 am

Some quick method to create a dir (Silently).

Code: Select all

YOURPATH = "%APPDATA%\\blah"
shellExecute('cmd.exe', '/c mkdir "' .. YOURPATH .. '"', nil, false);
Thank you been kinda trying to do that, with lua.

User avatar
++METHOS
Administration
Administration
Posts: 203
Joined: Thu Mar 02, 2017 9:02 pm
Reputation: 29

Re: Beginner Help Needed

Post by ++METHOS » Sat Mar 04, 2017 3:59 am

Yes. :D I skimmed over that part as soon as I saw what it was for.

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1154
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 206
Contact:

Re: Beginner Help Needed

Post by TheyCallMeTim13 » Tue Apr 10, 2018 4:44 am

Darkenki wrote:
Mon Apr 09, 2018 8:17 pm
I am a noob I am trying but it seems I cant get it to work or even make it recognize commands
when I speak it does not recognize either ...
Also what benifits do i get if I upgrade to mark 3 ???

I also need to know from where can i get facebook login and logout if i can get a script and a step by step guide ?
pls help
LMFAO, are you joking or is this for real?

User avatar
corroder
Novice Cheater
Novice Cheater
Posts: 20
Joined: Fri Mar 03, 2017 1:54 am
Reputation: 1

Re: Beginner Help Needed

Post by corroder » Tue Apr 10, 2018 4:51 am

if input=="save" then
print("This feature has not been implemented.")
end
if 'save' mean is to save the table, then :

1. function to make a new directory on local disk :

Code: Select all

function mkdir(dirname)
 path = TrainerOrigin or getMainForm()
 os.execute("mkdir "..dirname)
end
2. function to save table to local disk

Code: Select all

do
local function exportstring( s )
 s = string.format( "%q",s )
 s = string.gsub( s,"\\\n","\\n" )
 s = string.gsub( s,"\r","\\r" )
 s = string.gsub( s,string.char(26),"\"..string.char(26)..\"" )
 return s
end

function table.save(  tbl,filename )
 local charS,charE = "   ","\n"
 local file,err
 if not filename then
 file =  { write = function( self,newstr ) self.str = self.str..newstr end, str = "" }
 charS,charE = "",""
 elseif filename == true or filename == 1 then
 charS,charE,file = "","",io.tmpfile()
 else
 file,err = io.open( filename, "w" )
 if err then return _,err end
 end
 local tables,lookup = { tbl },{ [tbl] = 1 }
 file:write( "return {"..charE )
 for idx,t in ipairs( tables ) do
 if filename and filename ~= true and filename ~= 1 then
 file:write( "-- Table: {"..idx.."}"..charE )
 end
 file:write( "{"..charE )
 local thandled = {}
 for i,v in ipairs( t ) do
 thandled[i] = true
 if type( v ) ~= "userdata" then
 if type( v ) == "table" then
 if not lookup[v] then
 table.insert( tables, v )
 lookup[v] = #tables
 end
 file:write( charS.."{"..lookup[v].."},"..charE )
 elseif type( v ) == "function" then
 file:write( charS.."loadstring("..exportstring(string.dump( v )).."),"..charE )
 else
 local value =  ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
 file:write(  charS..value..","..charE )
 end
 end
 end
 for i,v in pairs( t ) do
 if (not thandled[i]) and type( v ) ~= "userdata" then
 if type( i ) == "table" then
 if not lookup[i] then
 table.insert( tables,i )
 lookup[i] = #tables
 end
 file:write( charS.."[{"..lookup[i].."}]=" )
 else
 local index = ( type( i ) == "string" and "["..exportstring( i ).."]" ) or string.format( "[%d]",i )
 file:write( charS..index.."=" )
 end
 if type( v ) == "table" then
 if not lookup[v] then
 table.insert( tables,v )
 lookup[v] = #tables
 end
 file:write( "{"..lookup[v].."},"..charE )
 elseif type( v ) == "function" then
 file:write( "loadstring("..exportstring(string.dump( v )).."),"..charE )
 else
 local value =  ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
 file:write( value..","..charE )
 end
 end
 end
 file:write( "},"..charE )
 end
 file:write( "}" )
 if not filename then
 return file.str.."--|"
 elseif filename == true or filename == 1 then
 file:seek ( "set" )
 return file:read( "*a" ).."--|"
 else
 file:close()
 return 1
 end
end
end
3. To use

Code: Select all

myTable = {}
mydir = 'Test'
myFile = 'testSave.lua'

mkdir(mydir)
table.save(myTable,mydir..'\\'..myFile)

Post Reply

Who is online

Users browsing this forum: No registered users