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 


Custom LUA Executer window [Help needed again]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Apr 27, 2013 10:52 am    Post subject: Custom LUA Executer window [Help needed again] Reply with quote

Hey Dark Byte,
Well, I've made an Project.
And now I want to insert into it some Admin Special Tools.
So I want to do thisL
A Custom LUA Engine window.

What I want is to a some sort of LUA Engine, that almost identical as Cheat Engine ones, but with some options that will be related to website and etc.

How can I perform the following actions :
To Display errors or notes in it.
Allow me to execute LUA scripts if I write them in the Memo.


What Im gonna do with it:
Debug and check the project.
Display notices to all other Admins
Edit files or variables (to debug&test) of the Project and/or the server files.
Load hacks from different locations that contains the full list, and to test it before setting it visible to all the other members.

Do you mind sharing with me the scripts you used for your LUA engine? =)

_________________
I'm rusty and getting older, help me re-learn lua.


Last edited by daspamer on Thu May 02, 2013 6:01 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Apr 27, 2013 11:13 am    Post subject: Reply with quote

@Flash hacker
"To Display errors or notes in it. "

You can override default print function:
Code:
if oldprint==nil then oldprint = print end
function print(...)
  oldprint('our print',...)
end




In your case, it would be something like this (not tested):
Code:
debug = false

if oldprint==nil then oldprint = print end

function print(...)
  if debug then oldprint('overrided print',...) end
  memo_append(UDF1_CEMemo1,...)
end



"Allow me to execute LUA scripts if I write them in the Memo."
You already know how to do it. Yes, loadstring:
Code:
loadstring(control_getCaption(UDF1_CEEdit1))()


you can use memo too, but you must merge all memo lines into one big string.





@DB
btw, it looks like this doesn't work:
UDF1.CEMemo1.append('text')

[[attempt to call field 'append' (a nil value)]]

_________________
Back to top
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Apr 27, 2013 11:19 am    Post subject: Reply with quote

mgr.inz.Player wrote:
@Flash hacker

You can override default print function:
Code:
if oldprint==nil then oldprint = print end
function print(...)
  oldprint('our print',...)
end




In your case, it would be something like this (not tested):
Code:
debug = false

if oldprint==nil then oldprint = print end

function print(...)
  if debug then oldprint('overrided print',...) end
  memo_append(UDF1_CEMemo1,...)
end



"Executing lua code"
You already know how to do it. Yes, loadstring:
Code:
loadstring(control_getCaption(UDF1_CEEdit1))()





@DB
btw, it looks like this doesn't work:
UDF1.CEMemo1.append('text')

[[attempt to call field 'append' (a nil value)]]

Wut, I have completly forgot about loadstring D:
Will check it =).

The print worked, That's basically I all needed for now =).
Thanks alot mate!!!

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Apr 27, 2013 2:09 pm    Post subject: Reply with quote

"override , overrided " - lol Shocked

I meant: "overload" and "overloaded"

_________________
Back to top
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed May 01, 2013 7:30 am    Post subject: Reply with quote

How can i set the strings language to lua? Like in c.e (global commands in bold and numbers in blue..)
_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu May 02, 2013 6:03 am    Post subject: Reply with quote

Alright this is what Im using currently.
Code:
acp     = {}
acp[1]  = createForm()
acp[2]  = createPanel(acp[1])
acp[3]  = createMemo(acp[2])
acp[4]  = createMemo(acp[2])
acp[5]  = createButton(acp[2])

setProperty(acp[1], "BiDiMode", "bdLeftToRight")

setProperty(acp[3], "BorderStyle", "bsSingle")
setProperty(acp[4], "BorderStyle", "bsSingle")

control_setSize(acp[1], 450, 350)
x,y = control_getSize(acp[1])
control_setSize(acp[2], x, y)
control_setSize(acp[3], x * 0.94, (y * 0.94) / 1.75)
control_setSize(acp[4], (x * 0.94) * 0.83, (y * 0.94) / 2.75 )
control_setPosition(acp[3], x * 0.03 , y * 0.03)
x,y = control_getSize(acp[3])
control_setPosition(acp[4], x * 0.033  , y * 1.06)
x,y = control_getSize(acp[4])
control_setSize(acp[5], x * 0.20, y)
he,we = control_getPosition(acp[4])
control_setPosition(acp[5], x+15, we)

control_setCaption(acp[5], 'Execute')

debug = false
if oldprint==nil then oldprint = print end

function print(...)
  if debug then oldprint('overloaded print', ...) end
  memo_append(acp[3], ...)
end

function ExecuteACP()
loadstring(control_getCaption(acp[4]))()
end

control_onClick(acp[5],ExecuteACP)

how can I set the text language to LUA? like in cheat Engine LUA engine window?

Also, how can I make it print errors in the that window and not in the C.E LUA engine?
(print"..." works fine and being displayed in the acp window, but printasd for example returns an error which being displayed in LUA engine and not in the acp window).

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu May 02, 2013 4:45 pm    Post subject: Reply with quote

This works
Code:
loc={}
loc[0] = print(0)
loc[1] = print(1)
loc[2] = print(2)
loc[3] = print(3)
loc[4] = print(4)

check = 0
i = 0
repeat
if loc[i+1]==nil then
check = 1
else
i = i+1
print(loc[i])
check = 0
end
until check == 1

But this does not
Code:
loc={}
loc[0] = print(0)
loc[1] = print(1)
loc[2] = print(2)
loc[3] = print(3)
loc[4] = print(4)

check = 0
i = 0
repeat
if loc[i+1]==nil then
check = 1
else
i = i+1
print(loc[i])
check = 0
end
until check == 1
if check==1 then check=0 end

But if I insert it in lua engine it does.
Dark Byte, is there any way to execute it as plain text?

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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