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 


[HELP] Select Combo box list + button = open file

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Almaftuchin
Newbie cheater
Reputation: 0

Joined: 01 Oct 2015
Posts: 13

PostPosted: Mon Mar 27, 2017 10:29 am    Post subject: [HELP] Select Combo box list + button = open file Reply with quote

Hello, i made form and add some cetrainer in cheat engine, then i want to my form functional.
For example if select trainer1 then click open button, there will open the trainer1.cetrainer file
pls fix with my CT example and Cetrainer below:
www*dropbox*com/sh/pioev8nm9zpyqra/AADX45wEjSbdUwzbqjKwuagsa?dl=1

_________________
beginner
Back to top
View user's profile Send private message
Almaftuchin
Newbie cheater
Reputation: 0

Joined: 01 Oct 2015
Posts: 13

PostPosted: Tue Mar 28, 2017 3:21 pm    Post subject: Reply with quote

bump
_________________
beginner
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 Mar 28, 2017 5:41 pm    Post subject: Reply with quote

Code:
loadTable("C:\\mytable.ct")
Back to top
View user's profile Send private message
Almaftuchin
Newbie cheater
Reputation: 0

Joined: 01 Oct 2015
Posts: 13

PostPosted: Tue Mar 28, 2017 9:20 pm    Post subject: Reply with quote

Do you have download the CT file example from link above?
how to load the cetrainer from addeed file in cheat engine?
Can you fix this?
Code:
UDF1.visible = true
--- Combo box
al = combobox_getItems(UDF1.CEComboBox1)
strings_clear(al)
strings_add(al, 'Select')
strings_add(al, 'Trainer 1')
strings_add(al, 'Trainer 2')
strings_add(al, 'Trainer 3')
--- Open file
function openFile()
AttachItems = combobox_getItems(UDF1.CEComboBox1)
AttachIndex = combobox_getItemIndex(UDF1.CEComboBox1)
local check = strings_getString(AttachItems,AttachIndex)
if check == 'Select' then showMessage('Select trainer first') end
if check == 'Trainer 1' then open("trainer1.CETRAINER") end
if check == 'Trainer 2' then open("trainer2.CETRAINER") end
if check == 'Trainer 3' then open("trainer3.CETRAINER") end
end
--- On Click Event
control_onClick(UDF1.CEButton1, openFile)
--- Function button



2.png
 Description:
how to call cetrainer file with lua?
 Filesize:  183.89 KB
 Viewed:  9999 Time(s)

2.png



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

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Mar 28, 2017 10:54 pm    Post subject: Reply with quote

Code:
UDF1.visible = true

--- Combo box
al = combobox_getItems(UDF1.CEComboBox1)
ali = combobox_getItemIndex(UDF1.CEComboBox1)
strings_clear(al)
strings_add(al, 'Select')
strings_add(al, 'Trainer 1')
strings_add(al, 'Trainer 2')
strings_add(al, 'Trainer 3')
combobox_setItemIndex(UDF1.CEComboBox1, ali)

--- Open file
function openFile()
  AttachItems = combobox_getItems(UDF1.CEComboBox1)
  AttachIndex = combobox_getItemIndex(UDF1.CEComboBox1)
  if not (AttachIndex > 0 and AttachIndex < AttachItems.Count) then
    showMessage("You must select a trainer!")
    return
  end
  check = AttachItems[AttachIndex]
  if check == 'Trainer 1' then createTrainer("trainer1.CETRAINER") end
  if check == 'Trainer 2' then createTrainer("trainer2.CETRAINER") end
  if check == 'Trainer 3' then createTrainer("trainer3.CETRAINER") end
end

function createTrainer(filename)
  filepath = os.getenv("TEMP") .. "\\" .. filename
  trainer = findTableFile(filename)
  trainer.saveToFile(filepath)
  os.execute(filepath)
end

--- On Click Event
control_onClick(UDF1.CEButton1, openFile)


to load file form stream file you need a function like this below, I am not sure this work since I am not testing it yet.

Code:
function loadTableCode(n2)
 local t2 = findTableFile(n2)
 if t2 ~= nil then
 local s2 = t2.Stream
 local c2 = readStringLocal(s2.Memory,s2.Size)
 return c2 ~= nil and loadstring(c2)
 end
end

local f2 = loadTableCode('blabla.CETRAINER')
print(type(f2))
if type(f2) == 'function' then f2() else print('not loaded') end


or use loadString

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Almaftuchin
Newbie cheater
Reputation: 0

Joined: 01 Oct 2015
Posts: 13

PostPosted: Wed Mar 29, 2017 12:39 am    Post subject: Reply with quote

thank you very much! working perfect!
_________________
beginner
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25284
Location: The netherlands

PostPosted: Wed Mar 29, 2017 1:51 am    Post subject: Reply with quote

this also works if you have cheat tables/cetrainers as files inside your table:
Code:

loadTable(findTableFile(n2).Stream)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Mar 29, 2017 4:45 am    Post subject: Reply with quote

Dark Byte wrote:
this also works if you have cheat tables/cetrainers as files inside your table:
Code:

loadTable(findTableFile(n2).Stream)


ah,,yes, CE have this build in function already... since 6.5.1 ?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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 Discussions 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