| View previous topic :: View next topic |
| Author |
Message |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 3:38 am Post subject: Let exe program open multiple times in different locations |
|
|
How do I use them?
Let each form appear in a different location
| Code: | form.getPosition()
form.setPosition() |
| Description: |
|
| Filesize: |
74.39 KB |
| Viewed: |
6030 Time(s) |

|
Last edited by .lua on Fri Jun 21, 2019 5:18 am; edited 1 time in total |
|
| Back to top |
|
 |
Lynxz Gaming Expert Cheater
Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Fri Jun 21, 2019 4:00 am Post subject: Re: Make the form open in different locations |
|
|
| .lua wrote: | How do I use them?
Let each form appear in a different location
| Code: | form.getPosition()
form.setPosition() |
|
form.left = 0
form.top = 0
or
form.setPosition(0,0)
_________________
my english is bad
discord : rynx#9828 |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 4:08 am Post subject: Re: Make the form open in different locations |
|
|
| Lynxz Gaming wrote: |
form.left = 0
form.top = 0
or
form.setPosition(0,0) | I want to have the program open several times in different locations.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25841 Location: The netherlands
|
Posted: Fri Jun 21, 2019 4:34 am Post subject: |
|
|
| Code: |
UDF1.left=0
UDF1.top=0
UDF2.left=10
UDF2.top=10
UDF3.left=10
UDF3.top=10
|
_________________
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 |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 5:13 am Post subject: |
|
|
| Dark Byte wrote: | | Code: |
UDF1.left=0
UDF1.top=0
UDF2.left=10
UDF2.top=10
UDF3.left=10
UDF3.top=10
|
| The generated independent exe is opened many times in different locations
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 5:47 am Post subject: |
|
|
| Code: |
if f then
x,y=f.getPosition()
--f.Destroy()
else
x,y=20,20
end
f=createForm()
f.setPosition(x+20,y+20)
| I think it's simplest, but it's only for the first time, and if I open it again, the first and second times are in the same position.
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Fri Jun 21, 2019 7:09 am Post subject: |
|
|
Couldn't really quite understand the question, multiply instances as a several executable's running? or several forms?
Anyway check this script, its not so ideal nor looks so great, but hey it works.
when destroying a form last position are saved (so next form created is set to those positions);
a function to get instance id, this way you can tell next instance to start at different y position for example..
(run this script in two different CE instances to see)
| Code: | local applicationTitle = getApplication().title; -- start up application title;
getInstanceId = function()
local function inTable(t,i)
for _,v in pairs(t)do if(v==i)then return true;end;end;return false;
end
local app,it,count = getApplication(),{},1;
local idPattern = "%*(%d+)$";
for pid,uselessTab in pairs(getWindowlist()) do
local title = uselessTab[0];
if (title == app.title) then
local isInstance = tonumber(title:match(idPattern));
if (isInstance) then
return isInstance;
end
end
-- appTitle = title:match("(Cheat Engine [%d%.]+)");
appTitle = title:match(applicationTitle);
if (appTitle) then
local isInstance = tonumber(title:match(idPattern)) or 1; -- tryna fetch given id for that window
if (isInstance) then
-- should reupdate in case an instance was closed;
while (inTable(it,count)) do
count = count + 1;
end
table.insert(it,isInstance);
app.Title = table.concat({appTitle," - *", count},"") -- generates new application title, based on available id; viewable on taskbar (by hovering)
return count;
end
end
end
end
local forms,ocreateForm = {x=0,y=0},createForm;
createForm = function(...)
local f,destroyed = ocreateForm(...),false;
f.left,f.top = forms.x,forms.y;
table.insert(forms,f);
local i,mt = #forms,getmetatable(f);
local mt__index = mt.__index;
mt.__index = function(o,index)
local index = tostring(index):lower();
if (index == "destroy") then
forms.x,forms.y = o.left,o.top;
destroyed = true;
table.remove(forms,k);
elseif(index == "destroyed")then -- now we can do if (f.destroyed) then, without errors;
return destroyed;
end
return mt__index(o,index);
end
return f;
end
-- f = createForm(); -- will create form in the last object position
-- f.onClose = function (sender) f.destroy() end; -- invoking sender.destroy will not trigger metatable method.
fTable = {}
local instanceId = getInstanceId();
for i=1,3 do;
local f = createForm();
f.onClose = function (sender) f.destroy(); end;
if (f.left == 0 and f.top == 0) then
local pf = fTable[i-1]
f.left = 5 + (pf and pf.left+pf.width or 0);
f.top = (instanceId-1) * 300;
end
fTable[i] = f;
end
-- demonstrate destruction and recreation;
t = createTimer(nil);
t.interval = 100;
t.tag = os.time();
t.onTimer = function(sender)
local d = os.time() - t.tag;
local f = fTable[#fTable];
if (d == 2) then
f.top = f.top + 5;
f.left = f.left + 5;
elseif (d == 4) then
if (not f.destroyed) then
f.destroy();
end
elseif(d == 6) then
fTable[#fTable] = createForm();
sender.destroy();
end
end |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 8:45 am Post subject: |
|
|
| DaSpamer wrote: |
(run this script in two different CE instances to see)
| Yes, I just want to start CE twice or more, but make sure that two or more forms are not in the same place each time the CE run script is opened.
You can save a bit CT file and open it twice or more, no matter how many times you open it, the final form is in the same place.
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Fri Jun 21, 2019 8:47 am Post subject: |
|
|
| Code: | local ctop = 50
local cleft = 50
local i
for i=1,4 do
local formname = 'Form '..i
local frm = createForm()
_G[formname] = frm
frm.setSize(200,200)
frm.caption = 'Form '..i
frm.Left = cleft
frm.Top = ctop
ctop=ctop+50
cleft=cleft+50
end |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 8:58 am Post subject: |
|
|
| Corroder wrote: | | Code: | local ctop = 50
local cleft = 50
local i
for i=1,4 do
local formname = 'Form '..i
local frm = createForm()
_G[formname] = frm
frm.setSize(200,200)
frm.caption = 'Form '..i
frm.Left = cleft
frm.Top = ctop
ctop=ctop+50
cleft=cleft+50
end |
| This is not what I want.
Sorry, my English is not good enough. I can't always express my right thoughts.
I just want to run the CT file or EXE file many times. Let the form show different positions.
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Fri Jun 21, 2019 9:20 am Post subject: |
|
|
| Quote: | | I just want to run the CT file or EXE file many times. Let the form show different positions. |
Yes, understood. I think need a function to check CE instance running. So, if the first instance has run it set forms position on a particular position and when the next instance call it will set the forms on a different position. I just looking for the logic while testing it if possible.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jun 21, 2019 12:54 pm Post subject: |
|
|
| Corroder wrote: | | Yes, understood. I think need a function to check CE instance running. So, if the first instance has run it set forms position on a particular position and when the next instance call it will set the forms on a different position. I just looking for the logic while testing it if possible. | Looking forward to your success
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Fri Jun 21, 2019 1:05 pm Post subject: |
|
|
| .lua wrote: | | DaSpamer wrote: |
(run this script in two different CE instances to see)
| Yes, I just want to start CE twice or more, but make sure that two or more forms are not in the same place each time the CE run script is opened.
You can save a bit CT file and open it twice or more, no matter how many times you open it, the final form is in the same place.
|
Check the part under fTable definition, some example of how I made.
You can't really expect the form to know where to place itself if you did not assigned it some data to work with.
You could get screen width/height and for each form place it in corespanding position (e.g first instance from top left to top right, second instance in the middle, third instance from bottom left to bottom right).
I mean I have wrote a functional script you just have to define at which position you'd prefer *each* form you are creating to start at, along with instanceId you can set DIFFERENT behavior for each instance.
If you run the script simultaneity you will see that the second instance will place its forms in different position.
the script modifies createForm just to create a new form in the last form position, in case when you close and re-create a form.
You could try obtain windows position of the other instance and based on that place your new forms in relative position to the other instance, but cba.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
|