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 


Just improve or change the idea.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Wed Oct 07, 2020 7:54 pm    Post subject: Just improve or change the idea. Reply with quote

Based on this topic;
https://forum.cheatengine.org/viewtopic.php?t=614486

Below is a sample code, I'll edit it as a Trainer opening slide.
As stated in the title;
If you have more different or interesting ideas please share

Code:
function chars(str)
 strc = {}
 for i = 1, #str do
  table.insert(strc, string.sub(str,i, i))
 end
  return strc
end

local str = {'THESE CODES AND TRAINER','MADE WITH CHEAT ENGINE','FOLLOW US FOR MORE','NEXT TRAINER; MAY BE FOR YOUR GAME'}

local ind = 1
local indx = str[ind]
local char = chars(indx)
local pos = 80
local ind1=0
local ind2=0
local indp=1

if f and f.destroy then f.destroy() f=nil end

f = createForm()
f.Position = 'poScreenCenter'
f.Width = 400

local cleft = 30

local p1=createPanel(f)
p1.Alignment="taLeftJustify"
p1.height=40 p1.width=360 p1.Top=67 p1.Left=20
p1.Font.Size = 19
p1.Font.Style="fsBold" p1.Color=0xffff00
p1.sendToBack()

local p2=createPanel(f)
p2.Alignment="taLeftJustify"
p2.height=40 p2.width=360 p2.Top=67 p2.Left=f.Width + 10
p2.Font.Size = 19
p2.Font.Style="fsBold" p2.Color=0x00ff00
p2.sendToBack()

function labind()
for i=1,#indx do
  local label = createLabel(f)
  ind1=i
  label.Font.Size = 18
  label.bringToFront()
  label.Left = cleft
  label.Top = i*-40
  label.AutoSize = true
  if (char[i] == " ") then
   label.Caption = " "
  else
   label.Caption = char[i]
  end
   label.Tag = 1
   cleft = cleft + label.Width+1
end
end

if c1 then c1.destroy() end
c1=createTimer(f)
c1.Interval=10 c1.Enabled=false

local c=createTimer(f,false)
c.Interval=1 c.Enabled=false

c.OnTimer= function ()
  for i=f.ControlCount-1,0,-1 do
    local object = f.Control[i]
    if object.Tag==1 then
    object.bringToFront()
      object.Top = object.Top + 2
    if object.Top>pos then
    if indp==1 then p1.caption=p1.caption..object.caption end
    if indp==2 then p2.caption=p2.caption..object.caption end
    object.Tag = 0 ind2=tonumber(ind2) + 1 object.destroy() end
    if ind2==ind1 then c1.Enabled=true end
    end
  end
end

function startEffect()
labindOnOff=2
if indp==1 then p2.Left=f.Width + 10 p2.caption=" " end
if indp==2 then p1.Left=f.Width + 10 p1.caption=" " end
if ind==4 then ind=0 end
ind=tonumber(ind) + 1
indx = str[ind]
char = chars(indx)
cleft = 30
ind2=0
labind()
c.Enabled=true
c1.Enabled=false
end

c1.OnTimer=function()
labindOnOff=3
if indp==1 then
p1.Left=p1.Left - 2
p2.Left=p2.Left - 2 end
if indp==2 then
p1.Left=p1.Left - 2
p2.Left=p2.Left - 2 end

if p1.Left==-370 then
indp=2
startEffect()
c1.Enabled=false end
if p2.Left==-370 then
indp=1
startEffect()
labindOnOff=2
c1.Enabled=false end
end

local labindOnOff=1

function StartStopEffect()
if labindOnOff==3 then return end
if labindOnOff==1 then labind() labindOnOff=2
c.Enabled=true end
if c.Enabled==true then
c.Enabled=false
else
c.Enabled=true
end
end

p1.OnClick=StartStopEffect
p2.OnClick=StartStopEffect
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Oct 08, 2020 2:31 am    Post subject: Reply with quote

This below is to proved nothing, just play around.

Code:
if fm then fm.Destroy() end
if t then t.Destroy() end
if t1 then t1.Destroy() end
if timer1 then timer1.Destroy() end

fm = createForm()
fm.setSize(354,300)
fm.Position = 'poScreenCenter'
fm.Caption = 'Splash screen test'
fm.Color = 12698049

tpnl = createPanel(fm)
tpnl.Align = 'alClient'
tpnl.Color = 12623485

pb=createPaintBox(tpnl)
pb.Align = 'alClient'
pb.OnPaint=function(s)
s.Canvas.gradientFill(0, 0, tpnl.Width, tpnl.height, 986895, 12623485, 1)
end

lbl = createLabel(tpnl)
lbl.Font.Color = 61046 --16760576
lbl.Font.Name = 'Tahoma'
lbl.Font.Size = 14
lbl.Left = 10
lbl.Top = 5
lbl.Caption = ''

p = createPanel(fm)
p.Align = 'alClient'
p.Color = 12623485

l = createLabel(p)
l.Font.Color = 62252
l.Font.Size = 14
l.Caption = 'Start'
l.Left=math.floor(p.Width - l.Width)/2
l.Top = p.Height - 150

--------------------------------------------------------------------------------
function animatedObject(hwnd, time, AnimateWindowFlags)
  return executeCodeLocalEx('user32.AnimateWindow', hwnd, time, AnimateWindowFlags)
end

AnimateWindowFlags =
{
    AW_HOR_POSITIVE = 0x00000001,
    AW_HOR_NEGATIVE = 0x00000002,
    AW_VER_POSITIVE = 0x00000004,
    AW_VER_NEGATIVE = 0x00000008,
    AW_CENTER = 0x00000010,
    AW_HIDE = 0x00010000,
    AW_ACTIVATE = 0x00020000,
    AW_SLIDE = 0x00040000,
    AW_BLEND =0x00080000
}

sentence = [[
>>

Welcome users....
This is The Ordinary Scripting World.
Have funs with custom splash screen
on the opening trainer you made....

This is a sample game trainer
splash screen made using Cheat Engine
Lua scripting ...

Click on me to stop auto typing
]]

local len = string.len(sentence)
local n = 0

function selfTyping(text)
 lbl.Caption = ''
 text = ''
 n = n + 1
 text = string.sub(sentence,1,n)
 lbl.Caption = text
 if n > len then n = 0 end
end

t1 = createTimer()
t1.Interval = 100
t1.OnTimer = selfTyping
t1.Enabled = false

function splash()
 timer1.enabled = false
 l.Caption = ''
 t.enabled = true
 animatedObject(p.handle, 2000, AnimateWindowFlags.AW_SLIDE | AnimateWindowFlags.AW_CENTER | AnimateWindowFlags.AW_HIDE)
 --animatedObject(p.handle, 5000, AnimateWindowFlags.AW_HOR_NEGATIVE | AnimateWindowFlags.AW_SLIDE | AnimateWindowFlags.AW_HIDE)
 t.Enabled = false
 t.Destroy()
 t = nil
 lbl.Caption = ''
 sleep(1000)
 t1.Enabled = true
 selfTyping()
end

t = createTimer(f)
t.Interval = 100
t.OnTimer = splash
t.Enabled = false

function terminated()
 t1.enabled = false
 lbl.Caption = sentence
end

--------------------------------------------------------------------------------
function onCollision(obj1,obj2)
 obj1x = obj1.left
 obj1y = obj1.top
 obj1w = obj1.width
 obj1h = obj1.height
 obj2x = obj2.left
 obj2y = obj2.top
 obj2w = obj2.width
 obj2h = obj2.height
 if obj2x + obj2w >= obj1x and obj2y + obj2h >= obj1y and obj2y <= obj1y + obj1h and obj2x <= obj1x + obj1w then
 return true
 end
end

local objWidth=l.Width
local objHeight=l.Height
local objX,objY,volX,volY

function bounced()
 volX=math.random(1,6)
 volY=math.random(1,6)
 objX=l.Left
 objY=l.Top
 objWidth=l.Width
 objX=math.random(0,fm.Width-objWidth)
 objX=math.random(0,fm.Height-objHeight)
 l.Caption = 'Click on everywhere to stop me'
 timer1.Enabled=true
end

function timer1_Tick(sender)
 l.Left=objX
 l.Top=objY
 objX=objX+volX
 objY=objY+volY
 if (objX<0) then  volX=-volX end
 if (objX+objWidth>p.Width) then volX=-volX  end
 if (objY<0) then volY=-volY end
 if (objY+objHeight>p.Height) then  volY=-volY end
end

timer1=createTimer(fm)
timer1.Interval=15
timer1.Enabled=false
timer1.onTimer=timer1_Tick

fm.Show()
l.onClick=bounced
p.OnClick = splash
lbl.OnClick = terminated

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

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu Oct 08, 2020 4:45 am    Post subject: Reply with quote

The main source of the code I shared in the title belongs to you.
Thanks for sharing your opinion.
Apparently, there are not many participants in the forum interested in animation.
Idea Idea Idea
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Oct 08, 2020 6:56 am    Post subject: Reply with quote

ByTransient wrote:
Apparently, there are not many participants in the forum interested in animation. Idea Idea Idea


90% here just interest to hack the games (event with steal the hack code for the games) Laughing Laughing Laughing

_________________
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
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