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 

Cheat Engine Lua and Intro - Gif

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

Joined: 16 Feb 2017
Posts: 616

PostPosted: Tue Jul 23, 2019 8:03 pm    Post subject: Cheat Engine Lua and Intro - Gif Reply with quote

The masters have published a lot on the subject.
To me, this is the most useful.
You can click, you can determine the location.
You can prepare multiple gifs and run them independently.

We give you the full code and as an example:
The following example: Trainer input animation.
You can change and use it as you wish.

Before specifying a few basic rules:
Let me talk about the masters who produced this coding.
This code generating and developing;
@Corroder and @FreeER, thanks.
17 I used it with the Trainer and reached it in its final form.
And having it will add some fun to your Trainer. Wink

There are 3 basic rules: ( of course interchangeable. )
1) Picture names can be from "frame_001" to "frame_999".

2) You should split a normal ".gif" image into fragmented ".png" s.
... here is a site that will do this easily to you. :
cf.: (Ezgif.jpeg)

3-1) Do not activate Script repeatedly during editing.
This ensures that the images are loaded twice and there is confusion.
Note that when you create "createGif" it generates.

3-2) and do not activate Script in the "Form Design" panel.
Records the generated gif in the "Form Designer".
Delete it and don't host it in "Form Designer."

Currently available code: (No images Wink )

local form1 = createForm(true) --Form1 = UDF1 or CETrainer name
form1.Position = poDesktopCenter
form1.Width = 316
form1.Height = 460
form1.caption="Form Play Gif"

local b1 = createButton(form1)
control_setPosition(b1, 123, 390)
b1.caption="Stop G1"

local b2 = createButton(form1)
control_setPosition(b2, 123, 430)
b2.caption="Stop G2"

----------------- Voice Message -------------------
local t1 = createTimer(form1)
t1.Interval = 10000
t1.OnTimer = function()
showMessage=(speak("Click Cheat Engine to donate.", waittilldone));
t1.Enabled = true
------------------- Image Gif Code ----------------
--ImageGIF Code Creator: Corroder and FreeER Thanks
function createGIF(form, width, top, frames, doCenter)
    local pics={}
    for _,frame in pairs(frames) do
      local pic
      if frame.ClassName == 'TMemoryStream' then
        pic = createPicture()
      else -- first try to load as a tableFile then as a filepath
        local file = findTableFile(frame)
        if file then
          pic = createPicture()
          -- loadFromFile doesn't report success, nor does the Picture object
          -- have a way to check, so do it ourselves first.
          local function file_exists(name)
             if f~=nil then io.close(f) return true else return false end
          if file_exists(frame) then
            pic = createPicture()
      -- if successfully loaded then add it
      if pic then pics[#pics+1] = pic end

    -- if we failed to load any frames
    if #frames ~= 0 and #pics == 0 then return nil end

    pics.currentPicture = 1

    local mImage = createImage(form) = top
    mImage.left = mImage.left
    if doCenter then
      mImage.left = (form.width-mImage.width) / 2
    mImage.stretch = true
    local gif = {}
    gif.image = mImage = pics = function()
      pics.currentPicture = (pics.currentPicture % #pics) + 1
      mImage.Picture = pics[pics.currentPicture]

    gif.timer = createTimer(mImage)
    gif.timer.Interval = 3000 / -- frames per second
    gif.timer.OnTimer = function(sender) end
    return gif

local frameNameFormat = 'frame_%03d.png'
---------------------- Create Gif -----------------------
------------------------- Gif 1--------------------------
local t = {}
for i=1,11 do
  t[i] = findTableFile(frameNameFormat:format(i)).Stream
local gif1 = createGIF(form1, 277, 280, t, false)
gif1.image.width = 277
gif1.image.Left = 20
gif1.image.Top = 10
gif1.image.height = 320
gif1.image.stretch = true
------------------------- Gif 2 -------------------------
local t = {}
for i=12,19 do
  t[#t+1] = findTableFile(frameNameFormat:format(i)).Stream
local gif2 = createGIF(form1, 296, 280, t, false)
gif2.image.width = 296
gif2.image.Left = 10
gif2.image.Top = 340
gif2.image.height = 40
gif2.image.stretch = true
-------------- Gif Play False or True ---------------
gif1.image.Visible = true
gif2.image.Visible = true
----------------- Gif Play - Pause ------------------
b1.OnClick = function()
if gif1.image.Visible == false then
gif1.image.Visible = true
t1.Enabled = true
b1.caption="Stop G1"
gif1.image.Visible = false
b1.caption="Play G1"
t1.Enabled = false

b2.OnClick = function()
if gif2.image.Visible == false then
gif2.image.Visible = true
b2.caption="Stop G2"
gif2.image.Visible = false
b2.caption="Play G2"

gif2.image.OnClick = function()

How is this done? Here is the video:


And the sample .CT file :

I think you could use this project and help CE a bit. Cool Cool Cool Wink

Note: With this code, 13 gifs in one Trainer and
I used 127 pictures.
They all worked smoothly.
Here is the code I used, CE Lua Game Trainer.
Take some stress and test the gifs.

Cheat Engine Lua Games: "Win or Lose"
(13 gif and 127 pictures (2 MB))

Enjoy it ! Smile

Form Play Gif.JPG
 Filesize:  44.85 KB
 Viewed:  8136 Time(s)

Form Play Gif.JPG

 Filesize:  105.14 KB
 Viewed:  8136 Time(s)


Hi Hitler Take control of your trainer
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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