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 


Matrix Effect! [DEVELOPMENT-IDEA]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1486

PostPosted: Sat Feb 08, 2025 10:52 am    Post subject: Matrix Effect! [DEVELOPMENT-IDEA] Reply with quote

Below is a code similar to the matrix effect and a form of its usage simulator.

I am looking for ideas for further development.

Options I am looking for:
You may have a different option idea, feel free to add it.
The most important part that is visible now is that the effect movements are not fluid.
In other words, the text does not flow, it is as if it is descending from a step.

The code is shared below, I am waiting for your ideas for development or correction.
Good luck in advance.

Code:
if mtxFrm then mtxFrm.Destroy() mtxFrm=nil end
DP1=getScreenDPI()/96
mtxFrm=createForm()
mtxFrm.height=360*DP1 mtxFrm.width=640*DP1 mtxFrm.left=351*DP1 mtxFrm.top=132*DP1
mtxFrm.PopupMode=0 mtxFrm.caption="Matrix Effect V1"
mtxFrm.Position="poDesktopCenter" mtxFrm.ShowInTaskBar="stAlways"
mtxFrm.BorderStyle="bsSingle"
--[==[
mtxFrm.BorderStyle="bsNone"
mtxFrm.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
mtxFrm.Color=0x000100
Object.OnMouseDown=function() mtxFrm.DragNow() end
--]==]
-------------------------
local mtrx = {}
----------------------- mtrx.pnl1 ----- 
mtrx.pnl1=createPanel(mtxFrm)
mtrx.pnl1.AutoSize=false
mtrx.pnl1.height=310*DP1 mtrx.pnl1.width=630*DP1 mtrx.pnl1.left=5*DP1 mtrx.pnl1.top=0*DP1
mtrx.pnl1.color=0
-----------------------
----------------------- mtrx.pnl2 ----- 
mtrx.pnl2=createPanel(mtxFrm)
mtrx.pnl2.AutoSize=false
mtrx.pnl2.height=240*DP1 mtrx.pnl2.width=400*DP1 mtrx.pnl2.left=115*DP1 mtrx.pnl2.top=35*DP1
mtrx.pnl2.caption=""
-----------------------
----------------------- mtrx.btn1 ----- 
mtrx.btn1=createButton(mtxFrm)
mtrx.btn1.AutoSize=false
mtrx.btn1.height=25*DP1 mtrx.btn1.width=150*DP1 mtrx.btn1.left=245*DP1 mtrx.btn1.top=320*DP1
mtrx.btn1.caption="Open  Hack  Panel"
mtrx.btn1.Font.Style="fsBold" mtrx.btn1.Font.Size=10*DP1
-----------------------
----------------------- mtrx.btn2 ----- 
mtrx.btn2=createButton(mtxFrm)
mtrx.btn2.AutoSize=false
mtrx.btn2.height=25*DP1 mtrx.btn2.width=110*DP1 mtrx.btn2.left=525*DP1 mtrx.btn2.top=320*DP1
mtrx.btn2.caption="Start Effect"
mtrx.btn2.Font.Style="fsBold" mtrx.btn2.Font.Size=10*DP1
-----------------------

--############################################################################--
--############################################################################--
mtrx.pnl2.Visible = false

mtrx.btn1.OnClick = function()
    mtrx.pnl2.Visible = not mtrx.pnl2.Visible
end

--------------------------------- Effect  Codes  --------------------
local matrixCharacters = {
     "ア","ァ","カ","サ","タ","ナ","ハ","マ","ヤ","ャ","ラ","ワ","ガ","ザ",
"ダ","バ","パ","イ","ィ","キ","シ","チ","ニ","ヒ","ミ","リ","ヰ","ギ",
"ジ","ヂ","ビ","ウ","ゥ","ク","ス","ツ","ヌ","フ","ム","ユ","ル","グ",
"ズ","ブ","ヅ","プ","ケ","セ","テ","ネ","ヘ","メ","レ","ヱ","ゲ","ゼ",
"デ","ベ","オ","コ","ソ","ト","ノ","ホ","モ","ヨ","ロ","ヲ","ゴ","ボ",
    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
   "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
    "U", "V", "W", "X", "Y", "Z",
    "あ", "い", "う", "え", "お", "か", "き", "く", "け", "こ",
    "さ", "し", "す", "せ", "そ", "た", "ち", "つ", "て", "と",
    "な", "に", "ぬ", "ね", "の", "は", "ひ", "ふ", "へ", "ほ",
    "ま", "み", "む", "め", "も", "や", "ゆ", "よ", "ら", "り",
    "る", "れ", "ろ", "わ", "を", "ん"
}

local labels = {}
local endlabels = {}
local tablabels = {}
local vsblabels = {}
local strt = 1
local strt2 = 1
local strt3 = 1
local endidx = 1
local panel1 = ""
local fnt2 = 0

function matrixEffect(panel, fnt)
--collectgarbage('setpause',100)
panel1 = panel
fnt2 = (tonumber(fnt) + math.floor(tonumber(fnt) / 2))
    if strt2 == 1 then
        local numColumns = panel.Width / (tonumber(fnt) + 5)
        for col = 1, numColumns do
            local label = createLabel(panel)
            --label.AutoSize = false
            label.Width = 25
            label.Height = 0
            label.Left = (col - 1) * (tonumber(fnt) + 5)
            label.Top = -40
            label.Font.Color = 0x00FF00
            label.Alignment = taCenter
            label.Font.Name = "Lucida Console"
            label.Font.Size = fnt
            label.Font.Style = fsBold
            table.insert(labels, label)
            local label1 = createLabel(panel)
            label1.AutoSize = false
            label1.Width = tonumber(fnt) -- + 3
            label1.Height = 18
            label1.Left = label.Left
            label1.Top = label.Top + 10
            label1.Alignment = taCenter
            label1.Font.Name = "Lucida Console"
            label1.Font.Style = fsBold
            label1.Font.Size = fnt + 2
            label1.OptimalFill = true
            label1.Font.Color = 0xFFFFFF
            label1.Color = 0x47A043 --0x00E100
            table.insert(endlabels, label1)
            table.insert(vsblabels, true)
        end
        strt2 = 2
    end
end

function full_letter(sn)
    local letter = ""
    for i = 1, sn do
        local newChar = matrixCharacters[math.random(1, #matrixCharacters)]
        letter = letter .. "\n" .. newChar
    end
    return letter
end

function updateLabels(label, idx)
    local sn = math.random(21, 44)
    local cpt = ""
    for i = 1, sn do
        local newChar = matrixCharacters[math.random(1, #matrixCharacters)]
        cpt = cpt .. "\n" .. newChar
        label.Caption = cpt
        --label.Height = label.Height + tonumber(fnt2)
        if endlabels[idx] then
            local newChar1 = matrixCharacters[math.random(1, #matrixCharacters)]
            endlabels[idx].Caption = newChar1
        end
    end
    return sn
end

function startLabels(label, idx)
    label.Height = 0
    label.Caption = ""
    local endsoon = updateLabels(label, idx)
    tablabels[idx] = endsoon
    label.Top = - (panel1.Height + 60)
    endlabels[idx].Top = label.Top + label.Height + 5
    label.Visible = true
    endlabels[idx].Visible = true
    vsblabels[idx] = true
end

function cptLabels(label, idx)
    label.Caption = full_letter(tablabels[idx])
    label.Top = label.Top + 25
    endlabels[idx].Top = label.Top + label.Height + 5
    local newChar1 = matrixCharacters[math.random(1, #matrixCharacters)]
    endlabels[idx].Caption = newChar1
end

function cptLabels2()
  for n, label in ipairs(labels) do
    label.Caption = full_letter(tablabels[n])
    local newChar1 = matrixCharacters[math.random(1, #matrixCharacters)]
    endlabels[n].Caption = newChar1
  end
end

function resetLabel(label, idx)
    label.Visible = false
    label.Caption = ""
    label.Height = 0
    endlabels[idx].Visible = false
    endlabels[idx].Caption = ""
    vsblabels[idx] = false
end

function tmr_quest()
    if strt == 1 then
        for n, label in ipairs(labels) do
            startLabels(label, n)
        end
        strt = 2
    else
      if strt3 == 2 then
        for n, label in ipairs(labels) do
            if endlabels[n].Top > panel1.Height then
                resetLabel(label, n)
            end
            if vsblabels[n] == false then
                startLabels(label, n)
            else
                cptLabels(label, n)
            end
        end
      end
      if strt3 == 3 then
        cptLabels2()
      end
    end
    collectgarbage("count")
end

if tmr2 then tmr2.Destroy() tmr2 = nil end
tmr2 = createTimer()
tmr2.Interval = 100
tmr2.OnTimer = tmr_quest
tmr2.Enabled = false

--------------------------  start -- stop -- Effect  ---------------

mtrx.btn2.OnClick = function()
  if strt3 == 3 then
        tmr2.Enabled = false
        mtrx.btn2.Caption = "Start Effect"
        strt3 = 1
        return strt3
  end
  if strt3 == 2 then
        mtrx.btn2.Caption = "Stop Effect"
        strt3 = 3
        return strt3
  end
  if strt3 == 1 then
        mtrx.btn2.Caption = "Spin in Place"
        strt3 = 2
        tmr2.Enabled = true
        return strt3
  end
end

matrixEffect(mtrx.pnl1, 14)


Note: You can freely use the code in its current or optimized form in your form.



Ekr1.PNG
 Description:
 Filesize:  32.73 KB
 Viewed:  6133 Time(s)

Ekr1.PNG



_________________
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
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3304

PostPosted: Sun Feb 09, 2025 3:23 am    Post subject: Reply with quote

Haha, looks fun!
Though I think in matrix characters were falling - in your code they seem randomly changing every time.
Have a look here:
https://www.youtube.com/watch?v=NuMf5J-BI_w

Generate random char -> bright, with a timer.
Timer keeps it lit for a few secs, then fades out.
The timer does not change the character, only the brightness.
The "fall speed" is random across the characters, but remains static in scope of a single character.
These may help with the effect.
Not sure what to use it for though, other than a screen saver.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1486

PostPosted: Sun Feb 09, 2025 4:22 pm    Post subject: Reply with quote

Csimbi wrote:
Though I think in matrix characters were falling - in your code they seem randomly changing every time.


Adapted versions vary depending on the user.
That is, different versions can be made.
The code below is adapted to the one in the video you provided.

Csimbi wrote:
Not sure what to use it for though, other than a screen saver.


1) Fun..
2) Different Trainer versions..
3) This project was on my mind a long time ago. Now I'm working on it.

Here is another version of the effect with some additions:
V2:

Code:
if mtxFrm then mtxFrm.Destroy() mtxFrm=nil end
DP1=getScreenDPI()/96
mtxFrm=createForm()
mtxFrm.height=360*DP1 mtxFrm.width=640*DP1
mtxFrm.PopupMode=0 mtxFrm.caption="Matrix Effect V2"
mtxFrm.Position="poDesktopCenter" mtxFrm.ShowInTaskBar="stAlways"
mtxFrm.BorderStyle="bsSingle"
-------------------------
local mtrx = {}
----------------------- mtrx.pnl1 ----- 
mtrx.pnl1=createPanel(mtxFrm)
mtrx.pnl1.AutoSize=false
mtrx.pnl1.height=310*DP1 mtrx.pnl1.width=630*DP1 mtrx.pnl1.left=5*DP1 mtrx.pnl1.top=0*DP1
mtrx.pnl1.color=0
-----------------------
----------------------- mtrx.pnl2 ----- 
mtrx.pnl2=createPanel(mtxFrm)
mtrx.pnl2.AutoSize=false
mtrx.pnl2.height=240*DP1 mtrx.pnl2.width=400*DP1 mtrx.pnl2.left=115*DP1 mtrx.pnl2.top=35*DP1
mtrx.pnl2.caption=""
-----------------------
----------------------- mtrx.btn1 ----- 
mtrx.btn1=createButton(mtxFrm)
mtrx.btn1.AutoSize=false
mtrx.btn1.height=25*DP1 mtrx.btn1.width=150*DP1 mtrx.btn1.left=245*DP1 mtrx.btn1.top=320*DP1
mtrx.btn1.caption="Open  Hack  Panel"
mtrx.btn1.Font.Style="fsBold" mtrx.btn1.Font.Size=10*DP1
-----------------------
----------------------- mtrx.btn2 ----- 
mtrx.btn2=createButton(mtxFrm)
mtrx.btn2.AutoSize=false
mtrx.btn2.height=25*DP1 mtrx.btn2.width=110*DP1 mtrx.btn2.left=525*DP1 mtrx.btn2.top=320*DP1
mtrx.btn2.caption="Start Effect"
mtrx.btn2.Font.Style="fsBold" mtrx.btn2.Font.Size=10*DP1
-----------------------

--############################################################################--
--############################################################################--
mtrx.pnl2.Visible = false

mtrx.btn1.OnClick = function()
    mtrx.pnl2.Visible = not mtrx.pnl2.Visible
end

--------------------------------- Effect  Codes  --------------------
local matrixCharacters = {
     "ア","ァ","カ","サ","タ","ナ","ハ","マ","ヤ","ャ","ラ","ワ","ガ","ザ",
"ダ","バ","パ","イ","ィ","キ","シ","チ","ニ","ヒ","ミ","リ","ヰ","ギ",
"ジ","ヂ","ビ","ウ","ゥ","ク","ス","ツ","ヌ","フ","ム","ユ","ル","グ",
"ズ","ブ","ヅ","プ","ケ","セ","テ","ネ","ヘ","メ","レ","ヱ","ゲ","ゼ",
"デ","ベ","オ","コ","ソ","ト","ノ","ホ","モ","ヨ","ロ","ヲ","ゴ","ボ",
    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
   "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
    "U", "V", "W", "X", "Y", "Z",
    "あ", "い", "う", "え", "お", "か", "き", "く", "け", "こ",
    "さ", "し", "す", "せ", "そ", "た", "ち", "つ", "て", "と",
    "な", "に", "ぬ", "ね", "の", "は", "ひ", "ふ", "へ", "ほ",
    "ま", "み", "む", "め", "も", "や", "ゆ", "よ", "ら", "り",
    "る", "れ", "ろ", "わ", "を", "ん"
}

local labels = {}
local endlabels = {}
local tablabels = {}
local vsblabels = {}
local idxlabels = {}
local zerolabels = {}
local ttlabels = {}
local strt = 1
local strt2 = 1
local strt3 = 1
local panel1 = ""
local ttidx = 1
local tttxt = ""
local ttvsb = 1
local ttcpt = 1
local ttstp = 1
-------------------------------- title ---------------------------

function ttcaption(pnl, txt, fnt)
local wd1 = #txt * tonumber(fnt)
local tp1 = (pnl.Height / 2) - (tonumber(fnt) / 2) - (tonumber(fnt) / 2)
local lf1 = (pnl.Width / 2) - (wd1 / 2)
 for i=1, #txt do
  local ttlbl = createLabel(pnl)
  ttlbl.AutoSize = false
  ttlbl.Alignment = taCenter
  ttlbl.Width = tonumber(fnt) - 4
  ttlbl.Height = tonumber(fnt) + fnt + 4
  ttlbl.Top = tp1
  if i==1 then
    ttlbl.Left = lf1
  else
    aa3 = (i * fnt) + lf1 - fnt
    ttlbl.Left = aa3
  end
  ttlbl.Font.Style = fsBold
  ttlbl.Font.Name = "Segoe Script"
  ttlbl.Font.Size = fnt + 4
  ttlbl.Visible=false
  ttlbl.OptimalFill = true
  ttlbl.Font.Color = 0xffffff
  ttlbl.Color = 0x205E1B
  ttlbl.bringToFront()
  table.insert(ttlabels, ttlbl)
 end
end

function matrixEffect(panel, fnt, txt)
panel1 = panel
    if strt2 == 1 then
        local numColumns = panel.Width / (tonumber(fnt) + 5)
        for col = 1, numColumns do
            local label = createLabel(panel)
            label.Width = 25
            label.Height = 0
            if col==1 then
              label.Left = (col - 1) * (tonumber(fnt) + 5) + 3
            else
              label.Left = (col - 1) * (tonumber(fnt) + 5)
            end
            label.Top = -40
            label.Font.Color = 0x00FF00
            label.Alignment = taCenter
            label.Font.Name = "Lucida Console"
            label.Font.Size = fnt
            label.Font.Style = fsBold
            table.insert(labels, label)
            local label1 = createLabel(panel)
            label1.AutoSize = false
            label1.Width = tonumber(fnt)
            label1.Height = 18
            label1.Left = label.Left
            label1.Top = label.Top + 10
            label1.Alignment = taCenter
            label1.Font.Name = "Lucida Console"
            label1.Font.Style = fsBold
            label1.Font.Size = fnt + 2
            label1.OptimalFill = true
            label1.Font.Color = 0xFFFFFF
            label1.Color = 0x205E1B --0x00E100
            table.insert(endlabels, label1)
            table.insert(vsblabels, true)
            table.insert(idxlabels, 1)
        end
        strt2 = 2
    end
  if txt=="" then
    ttidx=100
  else
    fnts = tonumber(fnt) * 3
    ttcaption(panel, txt, fnts) tttxt = txt
  end
end

function updateLabels(label, idx)
cidx = tablabels[idx]
sn = tonumber(idxlabels[idx])
idxlabels[idx] = tonumber(sn) + 1
ttidx = tonumber(ttidx) + 1
  if ttidx==60 then
    if ttvsb~=3 then
      if ttvsb==2 then
        for i=ttcpt, #tttxt do
          if i==ttcpt then
            ttlabels[i].Caption = tttxt:sub(i,i)
            ttlabels[i].OptimalFill = true
          else
            local ttChar = matrixCharacters[math.random(1, #matrixCharacters)]
            ttlabels[i].Caption = ttChar
            ttlabels[i].OptimalFill = true
          end
        end
        ttstp = tonumber(ttstp) + 1
          if ttstp==5 then
            ttcpt = tonumber(ttcpt) + 1
            ttstp=1
          end
        aa2 = #tttxt + 1
        if ttcpt == aa2 then ttvsb = 3 end
      end
      if ttvsb==1 then
        for n, ttlbl in ipairs(ttlabels) do
          ttlbl.Visible = true
          local ttChar = matrixCharacters[math.random(1, #matrixCharacters)]
          ttlbl.Caption = ttChar
        end
        ttvsb = 2
      end
    end
    ttidx = 1
  end
    if idxlabels[idx] == tonumber(cidx) then
      label.Visible = true
      endlabels[idx].Visible = true
      vsblabels[idx] = true
      idxlabels[idx] = 1
    end
    if vsblabels[idx]==true then
        local newChar = matrixCharacters[math.random(1, #matrixCharacters)]
        label.Caption = newChar .. "\n" .. label.Caption
        endlabels[idx].Top = label.Top + label.Height - 15
           zero = zerolabels[idx]
           zerolabels[idx] = tonumber(zero) - 1
        if endlabels[idx] then
            local newChar1 = matrixCharacters[math.random(1, #matrixCharacters)]
            endlabels[idx].Caption = newChar1
        end
    end
end

function startLabels(label, idx)
    label.Caption = ""
    local endsoon = math.random(11, 22)
    tablabels[idx] = tonumber(endsoon)
    label.Top = - tonumber(endsoon)
    endlabels[idx].caption = ""
    zerolabels[idx] = tonumber(endsoon)
    idxlabels[idx] = 1
    updateLabels(label, idx)
end

function cptLabels()
  for n, label in ipairs(labels) do
    local newChar1 = matrixCharacters[math.random(1, #matrixCharacters)]
    endlabels[n].Caption = newChar1
  end
end

function resetLabel(label, idx)
    label.Visible = false
    label.Caption = ""
    label.Height = 0
    label.Top = 0
    endlabels[idx].Top = 0
    endlabels[idx].Visible = false
    endlabels[idx].Caption = ""
    vsblabels[idx] = false
    startLabels(label, idx)
end

function tmr_quest()
    if strt == 1 then
        for n, label in ipairs(labels) do
            startLabels(label, n)
        end
        strt = 2
    else
      if strt3 == 2 then
        tmr2.Interval = 100
        for n, label in ipairs(labels) do
            if zerolabels[n]==0 then
                resetLabel(label, n)
            elseif vsblabels[n] == false then
                updateLabels(label, n)
            else
                updateLabels(label, n)
            end
        end
      end
      if strt3 == 3 then
        cptLabels()
        tmr2.Interval = 200
      end
    end
    collectgarbage("count")
end

if tmr2 then tmr2.Destroy() tmr2 = nil end
tmr2 = createTimer()
tmr2.Interval = 100
tmr2.OnTimer = tmr_quest
tmr2.Enabled = false

--------------------------  start -- stop -- Effect  ---------------

mtrx.btn2.OnClick = function()
  if strt3 == 3 then
        tmr2.Enabled = false
        mtrx.btn2.Caption = "Start Effect"
        strt3 = 1
        return strt3
  end
  if strt3 == 2 then
        mtrx.btn2.Caption = "Stop Effect"
        strt3 = 3
        return strt3
  end
  if strt3 == 1 then
        mtrx.btn2.Caption = "Spin in Place"
        strt3 = 2
        tmr2.Enabled = true
        return strt3
  end
end

matrixEffect(mtrx.pnl1, 11, "Cheat Engine")



Ekr1.PNG
 Description:
 Filesize:  20.04 KB
 Viewed:  5823 Time(s)

Ekr1.PNG



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