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 


FreeER and Corroder! Try this. Transparent Trainer!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Fri Jan 26, 2018 4:48 pm    Post subject: FreeER and Corroder! Try this. Transparent Trainer! Reply with quote

FreeER and Corroder..

Try this.
Can we do this transparent coding for GIF?
I was working for a transparent like this.
Double clicks are needed to get back to the beginning.
an error occurred at startup but it is working properly.


https : // www . dropbox . com /s/fetfdw33mshnjb2/AylinselCurtain1.CT?dl=0
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 42

Joined: 09 Aug 2013
Posts: 1089

PostPosted: Fri Jan 26, 2018 5:16 pm    Post subject: Reply with quote

Looks like CE doesn't really support gifs: http://forum.cheatengine.org/viewtopic.php?p=5695931

Oh, the error at start is caused by the OnActivate event for the form being set to makeTransparent, since the lua code hasn't ran yet that function doesn't exist so it causes an error. Since you call it in the lua code you can just remove the OnActivate event Smile
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Fri Jan 26, 2018 5:27 pm    Post subject: Reply with quote

FreeER wrote:
Looks like CE doesn't really support gifs: http://forum.cheatengine.org/viewtopic.php?p=5695931

Oh, the error at start is caused by the OnActivate event for the form being set to makeTransparent, since the lua code hasn't ran yet that function doesn't exist so it causes an error. Since you call it in the lua code you can just remove the OnActivate event Smile


Thanks
it's just a draft for the idea.
How do I start multiple pictures sequentially with "onTimer"?
At the opening, if the trainer is brought to the scene with a robotic arm?

Can a GIF be built with Timer?
you should try Rolling Eyes
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 42

Joined: 09 Aug 2013
Posts: 1089

PostPosted: Fri Jan 26, 2018 6:19 pm    Post subject: Reply with quote

The way I'd probably do it is have a table of each image and the index of the current image then in the timer you'd increment the index by one and change the image something like...


Code:
-- I don't think this is right for min values other than 1 but it seems to work here
local function wrap(value, min, max)
  while value > max do value = value - max end
  while value < min do value = value + max end
  return value
end
function gifMaker(images, imageObject, interval)
  if not images or type(images) ~= 'table' then return nil end
  -- TODO check what the classname of CE's image object actually is... this is just a guess
  if not imageObject or type(imageObject) ~= 'TCEImage' then return nil end

  local gif = {}
  gif.images = images
  gif.current = 1
  gif.imageObject = imageObject
  -- TODO see if this is actually how you change the image lol
  -- alternatively if you have multiple image objects then take a table of those
  -- and hide all of them, then show the current by changing the Visible property
  gif.updateImage = function() gif.imageObject.Image = gif.images[gif.current] end
  gif.next = function() gif.current = wrap(gif.current+1, 1, #gif.images); gif.updateImage() end
  gif.prev = function() gif.current = wrap(gif.current-1, 1, #gif.images); gif.updateImage() end

  gif.timer = createTimer(gif.imageObject)
  gif.timer.Interval = interval or 1000
  gif.timer.OnTimer = function(t)
    gif.next()
  end
  gif.updateImage() -- make sure the first is showing
  return gif
end


Though I'd probably use a metatables for the common stff and lua's OOP with functions taking a parameter called "self" (arbitrary name) and calling them with gif:next() which is just syntatic sugar for gif.next(gif)
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 33

Joined: 10 Apr 2015
Posts: 1309

PostPosted: Sat Jan 27, 2018 12:49 am    Post subject: Reply with quote

FreeER wrote:
The way I'd probably do it is have a table of each image and the index of the current image then in the timer you'd increment the index by one and change the image something like...


Code:
-- I don't think this is right for min values other than 1 but it seems to work here
local function wrap(value, min, max)
  while value > max do value = value - max end
  while value < min do value = value + max end
  return value
end
function gifMaker(images, imageObject, interval)
  if not images or type(images) ~= 'table' then return nil end
  -- TODO check what the classname of CE's image object actually is... this is just a guess
  if not imageObject or type(imageObject) ~= 'TCEImage' then return nil end

  local gif = {}
  gif.images = images
  gif.current = 1
  gif.imageObject = imageObject
  -- TODO see if this is actually how you change the image lol
  -- alternatively if you have multiple image objects then take a table of those
  -- and hide all of them, then show the current by changing the Visible property
  gif.updateImage = function() gif.imageObject.Image = gif.images[gif.current] end
  gif.next = function() gif.current = wrap(gif.current+1, 1, #gif.images); gif.updateImage() end
  gif.prev = function() gif.current = wrap(gif.current-1, 1, #gif.images); gif.updateImage() end

  gif.timer = createTimer(gif.imageObject)
  gif.timer.Interval = interval or 1000
  gif.timer.OnTimer = function(t)
    gif.next()
  end
  gif.updateImage() -- make sure the first is showing
  return gif
end


Though I'd probably use a metatables for the common stff and lua's OOP with functions taking a parameter called "self" (arbitrary name) and calling them with gif:next() which is just syntatic sugar for gif.next(gif)


I didn't see where is command to load pictures and store to gif table, so is it mean we need add and load gif pictures to form or gif table manually and then run gifMaker() function ?.


@Aylin
Quote:
How do I start multiple pictures sequentially with "onTimer"?
At the opening, if the trainer is brought to the scene with a robotic arm?

Can a GIF be built with Timer?


DB provided it already, see topic : http://forum.cheatengine.org/viewtopic.php?t=579732

Code:
UDF1.show();
local ts,r=tostring,nil;
r = function(s,c,l)s,c,l=ts(s),ts(c),l+0;s=(#s<l and r(c..s,c,l) or s);return s;end; -- simple function to pad zeros
local main = UDF1.CEImage1; -- target
local fmin,fmax = 0,30; -- min frame, max frame
animation = animation or createTimer(getMainForm(),true);
animation.Interval = math.floor(1/30*1000); -- 30 fps
animation.onTimer = function (t)
   local tag,id = string.match(main.Hint,"(%a+)_(%d+)"); -- find frame and the number from Hint
   if (tag and id) then
      id = (id+0>=fmax and fmin or id+1);
   else
      tag,id = 'frame',0; -- hint is not set, so let's set it.
   end
   local frame = string.format('frame_%03d.gif',id) -- frame_001.gif for example
   main.Hint = frame; -- Storage.. lazy to use a variable;
   main.picture.loadFromStream(findTableFile(frame).stream); -- find table file and load it into the image object
end


The idea is store gif images to stream files and load it from stream in a sequences as picture image for image object (CEImage1 as example code above) by timer. Same to @FreeER function wrap()'s above.

On that example above, there are 30 frames (30 gif picture images) to be display, all gif's file name initial by "frame_xxx' (xxx = seq. numbers).
So, be careful with gif's file name, it must be same with gif file initial inside the function.
Also you can split a gif picture image to get all frames, use online tool, eq. : https://ezgif.com/split

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Sat Jan 27, 2018 11:08 am    Post subject: Reply with quote

I used a friend Intro.
Currently Play-Pause-Close works fine.
But as the number of photos increases, MB increases.
Thanks to DarkByte. I evaluated the idea.
This is the idea for the examples that are interpreted in UDF1.
You are the master, you can produce a unique work more.
I still have hope. Rolling Eyes
Thank you for your contributions.



I did a CT sample. Can you develop it? please see
https : // www . dropbox . com /s/ocok8nilej9360p/TraIntro-Gif-Pause-Play-OFF.CT?dl=0
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 33

Joined: 10 Apr 2015
Posts: 1309

PostPosted: Sat Jan 27, 2018 7:15 pm    Post subject: Reply with quote

Aylin wrote:
I used a friend Intro.
Currently Play-Pause-Close works fine.
But as the number of photos increases, MB increases.
Thanks to DarkByte. I evaluated the idea.
This is the idea for the examples that are interpreted in UDF1.
You are the master, you can produce a unique work more.
I still have hope. Rolling Eyes
Thank you for your contributions.



I did a CT sample. Can you develop it? please see
https : // www . dropbox . com /s/ocok8nilej9360p/TraIntro-Gif-Pause-Play-OFF.CT?dl=0


Basic from your idea, here is a more simple sample as same as what you've done.
My focus only to show gif images on sequences, not about transparent form and other stuffs.

Code:
mForm = createForm()
mForm.width = 250
mForm.height = 300
mForm.BorderStyle = 'bsNone'

mForm.OnMouseDown = function() mForm.DragNow() end

mLabel = createLabel(mForm)
mLabel.left = 10
mLabel.top = 5
mLabel.caption = 'Double Click To Close Trainer'

mImage = createImage(mForm)
mImage.width = mForm.width
mImage.top = 30
mImage.height = 290
mImage.strecth = true

---------- set for images stuff here
t = {}
t[1] = 'frame_0.gif'
t[2] = 'frame_1.gif'
t[3] = 'frame_2.gif'
t[4] = 'frame_3.gif'
t[5] = 'frame_4.gif'
t[6] = 'frame_5.gif'
t[7] = 'frame_6.gif'
t[8] = 'frame_7.gif'

pics={}
for i=1,8 do    ---- we have 8 gif images here, so it depending number of image you have and store on the table
  pics[i]=createPicture()
  pics[i].loadFromStream(findTableFile(t[i]).Stream)
end

pics.currentPicture=1

timer=createTimer(f, false)     ---- use just one timer
timer.Interval= 700    --- adjust timer interval to get images display interval
timer.OnTimer=function(timer)
  mImage.Picture=pics[pics.currentPicture] --same as img.Picture.assign(pics[pics.currentPicture])
  pics.currentPicture=(pics.currentPicture % 8)+1     --- 8 is number gif images store in stream
end
timer.Enabled=true

-------- counter to close the trainer
function exiter()
 closeCE();
 return caFree
end

mForm.onDblClick = exiter
mForm.show()


Then you possible to creating your own better... cheers



Test GIFtr.gif
 Description:
 Filesize:  544.84 KB
 Viewed:  6468 Time(s)

Test GIFtr.gif



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Sun Jan 28, 2018 11:35 am    Post subject: Reply with quote

Corroder wrote:
Aylin wrote:
I used a friend Intro.
Currently Play-Pause-Close works fine.
But as the number of photos increases, MB increases.
Thanks to DarkByte. I evaluated the idea.
This is the idea for the examples that are interpreted in UDF1.
You are the master, you can produce a unique work more.
I still have hope. Rolling Eyes
Thank you for your contributions.



I did a CT sample. Can you develop it? please see
https : // www . dropbox . com /s/ocok8nilej9360p/TraIntro-Gif-Pause-Play-OFF.CT?dl=0


Basic from your idea, here is a more simple sample as same as what you've done.
My focus only to show gif images on sequences, not about transparent form and other stuffs.

Code:
mForm = createForm()
mForm.width = 250
mForm.height = 300
mForm.BorderStyle = 'bsNone'

mForm.OnMouseDown = function() mForm.DragNow() end

mLabel = createLabel(mForm)
mLabel.left = 10
mLabel.top = 5
mLabel.caption = 'Double Click To Close Trainer'

mImage = createImage(mForm)
mImage.width = mForm.width
mImage.top = 30
mImage.height = 290
mImage.strecth = true

---------- set for images stuff here
t = {}
t[1] = 'frame_0.gif'
t[2] = 'frame_1.gif'
t[3] = 'frame_2.gif'
t[4] = 'frame_3.gif'
t[5] = 'frame_4.gif'
t[6] = 'frame_5.gif'
t[7] = 'frame_6.gif'
t[8] = 'frame_7.gif'

pics={}
for i=1,8 do    ---- we have 8 gif images here, so it depending number of image you have and store on the table
  pics[i]=createPicture()
  pics[i].loadFromStream(findTableFile(t[i]).Stream)
end

pics.currentPicture=1

timer=createTimer(f, false)     ---- use just one timer
timer.Interval= 700    --- adjust timer interval to get images display interval
timer.OnTimer=function(timer)
  mImage.Picture=pics[pics.currentPicture] --same as img.Picture.assign(pics[pics.currentPicture])
  pics.currentPicture=(pics.currentPicture % 8)+1     --- 8 is number gif images store in stream
end
timer.Enabled=true

-------- counter to close the trainer
function exiter()
 closeCE();
 return caFree
end

mForm.onDblClick = exiter
mForm.show()


Then you possible to creating your own better... cheers

**************************************
These encodings speak to you. You understand the codes.
You did a great job. The narration and the harmony are great.
I will use this code in the trainer: your name will surely be.
CodeCreator: Corroder
Now I will prepare an Intro and drop the link in the comment.
Thank you.


Code:
---------- Intro-GIFCodeCreator: Corroder
t = {}
t [1] = 'frame_001.png'
t [2] = 'frame_002.png'
t [3] = 'frame_003.png'
t [4] = 'frame_004.png'
t [5] = 'frame_005.png'
t [6] = 'frame_006.png'
t [7] = 'frame_007.png'
t [8] = 'frame_008.png'

pics={}
for i=1,8 do    ---- we have 8 gif images here, so it depending number of image you have and store on the table
  pics[i]=createPicture()
  pics[i].loadFromStream(findTableFile(t[i]).Stream)
end

pics.currentPicture=1

timer=createTimer(f, false)     ---- use just one timer
timer.Interval= 700    --- adjust timer interval to get images display interval
timer.OnTimer=function(timer)
  mImage.Picture=pics[pics.currentPicture] --same as img.Picture.assign(pics[pics.currentPicture])
  pics.currentPicture=(pics.currentPicture % 8)+1     --- 8 is number gif images store in stream
end
timer.Enabled=true
Back to top
View user's profile Send private message MSN Messenger
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Mon Jan 29, 2018 4:17 am    Post subject: Reply with quote

Thank you Corroder. Thank you freeER ..
Very successful coding.
Transparent design and GIF compatible.
Now it's time to move the trainer to a higher level.
Thanks again.


https : // www . dropbox . com /s/ku44ff83ut56uur/ate%C5%9Fli%20CTrainer.CETRAINER?dl=0
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 33

Joined: 10 Apr 2015
Posts: 1309

PostPosted: Mon Jan 29, 2018 4:22 am    Post subject: Reply with quote

well done... Laughing Laughing Very Happy
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Mon Jan 29, 2018 3:54 pm    Post subject: Reply with quote

First of all thank you.
your help and your discretion, my rank has risen.
I'm stuck in one place. Actually, I saw it when I added it.
I think we should give this Timer a name.
It is not possible to run different timers.
They must be active for more than one minute and at separate times.
You may be able to start and end with a command.
This one:
Code:
function CETimer1Timer(sender)

and:
Code:
function CETimer2Timer(sender)

How would you code it with?

Code:
t = {}
t[1] = 'frame_0.gif'
t[2] = 'frame_1.gif'
t[3] = 'frame_2.gif'
t[4] = 'frame_3.gif'
t[5] = 'frame_4.gif'
t[6] = 'frame_5.gif'
t[7] = 'frame_6.gif'
t[8] = 'frame_7.gif'

pics={}
for i=1,8 do    ---- we have 8 gif images here, so it depending number of image you have and store on the table
  pics[i]=createPicture()
  pics[i].loadFromStream(findTableFile(t[i]).Stream)
end

pics.currentPicture=1
--------------- function CETimer1Timer(f, false) ?
timer=createTimer(f, false)     ---- use just one timer
timer.Interval= 700    --- adjust timer interval to get images display interval
timer.OnTimer=function(timer)
  mImage.Picture=pics[pics.currentPicture] --same as img.Picture.assign(pics[pics.currentPicture])
  pics.currentPicture=(pics.currentPicture % 8)+1     --- 8 is number gif images store in stream
end
timer.Enabled=true
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 33

Joined: 10 Apr 2015
Posts: 1309

PostPosted: Mon Jan 29, 2018 6:38 pm    Post subject: Reply with quote

Quote:
First of all thank you.
your help and your discretion, my rank has risen.
I'm stuck in one place. Actually, I saw it when I added it.
I think we should give this Timer a name.
It is not possible to run different timers.
They must be active for more than one minute and at separate times.
You may be able to start and end with a command.
This one:
Code:
function CETimer1Timer(sender)

and:
Code:
function CETimer2Timer(sender)

How would you code it with?


Not sure understand what you are trying to do. Of course you can make any timers with different names to handle may events.
But what or which event you need handle using timer from the sample code ?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 8

Joined: 16 Feb 2017
Posts: 570

PostPosted: Tue Jan 30, 2018 4:56 am    Post subject: Reply with quote

I named Timer. The work is successful.

Code:
function CETimer1Timer(sender)
UDF1.CETimer3.Enabled=false
  mImage.Picture=pics[pics.currentPicture]
  pics.currentPicture=(pics.currentPicture % 14)+1


But the INTRO that I put it in is opening UDF1 before doing anything else.
Please have a look at the file.
or a name for "mImage"

or should I put UDF2 on for the initial INTRO?
If we can not find a name for 'mImage', the scenario for INTRO:

Code:
function CETimer19Timer(sender)
UDF2.CEImage18.visible = false
UDF2.CEImage19.visible = true
UDF2.CETimer18.enabled = false
UDF2.CETimer20.enabled = true
end
function CETimer20Timer(sender)
UDF2.CEImage19.visible = false
UDF2.CEImage20.visible = true
UDF2.CETimer19.enabled = false
UDF2.CETimer21.enabled = true
end
function CETimer21Timer(sender)
UDF2.CEImage20.visible = false
UDF2.CEImage21.visible = true
UDF2.CETimer20.enabled = false
UDF2.CETimer22.enabled = true
end


I need to solve this.
I also want to use animation narration for INFO images.
If we do not divide mImage by names, UDF2-UDF3-UDF4 etc. will enter.
If it comes to complexity, do I give the INTRO version and UDF2 as CT? Sad

https : // www . dropbox . com/s/j8tvnxm94p9lcdi/Proge-Fire-GIF-11-22-44.CT?dl=0
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 42

Joined: 09 Aug 2013
Posts: 1089

PostPosted: Tue Jan 30, 2018 8:33 am    Post subject: This post has 1 review(s) Reply with quote

I'd use some code like this https://www.dropbox.com/s/u5b283w3ezcgi7d/Proge-Fire-GIF.CT?dl=0
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 33

Joined: 10 Apr 2015
Posts: 1309

PostPosted: Tue Jan 30, 2018 8:51 am    Post subject: Reply with quote

Quote:
I named Timer. The work is successful.


As I said : In your case timer use to handle one or more events.
So, let review again, what is your scenario. Something like this :

first...
Event #1 : Let show UDF1 with some gif images (playing on it) and wait until user doing something. While waiting for the user reaction. make UDF2 and/or UDF3, etc hide.

Still on event #1, now we go to conditional cases, like this...
if... a button click, then something to do (maybe UDF1 hide and go to event #2 where UDF1 will hide and UDF2 is show. At this point, you need disable or destroy the timer which handle event #1 and so on.....

Then the important thing is : You need write down your plan about what to do for every events. Something like 'events flow chart'. Once you did it, then you able to manage your scripts for every events according to your plan.

I have downloaded your trainer from link you provided above, but I can't open it without error. When I try to open your trainer it give error...
"Error attempt to call nil value" (I am use CE 6.7 missing setup).
This error indicate :
- a variable is not declare yet or
- wrong typing for class properties name such as UDF1, UDF2, Label1, etc
- CE can't find a stream file because typing mismatch or not added yet to stream file
- etc

In your trainer, this error come like a infinity loop, it's mean one of your timers not stop because you not manage code/script to handle errors for every events.

Anyhow, just for your reference, I was made a 'Game Launcher Pad and Tools' using CE 6.6, ago.
You can find it here : https://www.youtube.com/watch?v=dAVy_65nNlw
As Corroder a.k.a VCLBr*...

Just for your motivation...

_________________
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 -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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