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
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

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. : https://ezgif.com/split
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 )

Code:
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));
end
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()
        pic.loadFromStream(frame)
      else -- first try to load as a tableFile then as a filepath
        local file = findTableFile(frame)
        if file then
          pic = createPicture()
          pic.loadFromStream(file.Stream)
        else
          -- 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)
             local f=io.open(name,"r")
             if f~=nil then io.close(f) return true else return false end
          end
          if file_exists(frame) then
            pic = createPicture()
            pic.loadFromFile(frame)
          end
        end
      end
      -- if successfully loaded then add it
      if pic then pics[#pics+1] = pic end
    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)
    mImage.top = top
    mImage.left = mImage.left
    if doCenter then
      mImage.left = (form.width-mImage.width) / 2
    end
    mImage.stretch = true
    local gif = {}
    gif.image = mImage
    gif.pics = pics
    gif.next = function()
      pics.currentPicture = (pics.currentPicture % #pics) + 1
      mImage.Picture = pics[pics.currentPicture]
    end

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

local frameNameFormat = 'frame_%03d.png'
---------------------- Create Gif -----------------------
------------------------- Gif 1--------------------------
local t = {}
for i=1,11 do
  t[i] = findTableFile(frameNameFormat:format(i)).Stream
end
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
end
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"
else
gif1.image.Visible = false
b1.caption="Play G1"
t1.Enabled = false
end
end

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

gif2.image.OnClick = function()
shellExecute("https://www.paypal.com/xclick/business=dark_byte%40hotmail.com&no_note=1&tax=0&lc=US")
end


How is this done? Here is the video:

Link



And the sample .CT file : https://www.dosyaupload.com/rw03

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))
https://www.dosyaupload.com/6ud8

Enjoy it ! Smile



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

Form Play Gif.JPG



Ezgif.JPG
 Description:
 Filesize:  105.14 KB
 Viewed:  11339 Time(s)

Ezgif.JPG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website 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