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 


Is there any way to prevent vibration?

 
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: 37

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Tue Aug 11, 2020 4:54 am    Post subject: Is there any way to prevent vibration? Reply with quote

The writing should flow up and grow.
Is there any way to stop this effect from flickering?
Here is a sample code;

Code:
if f then f.destroy() end

f = createForm()

label1 = createLabel(f) label1.AutoSize=false label1.Width=80
label1.Height=60 label1.Font.Style="fsBold"
label1.Font.Size=12 label1.OptimalFill=true label1.Tag=30
label1.Alignment="taCenter"

local text1 = {"CHEAT ENGINE 1", "CHEAT ENGINE 2-11-08-2020", "CHEAT ENGINE 3", "CHEAT ENGINE 4-11-08-2021"}  -- will sub with words table

label1.Top = f.Height
local ctop = tonumber(f.Height)
local text11=tonumber(1)
 label1.Left=tonumber(ctop) / 2 - 15
ctop1=tonumber(100)
label1.Width=tonumber(ctop1)
 label1.Caption = text1[text11]

c=createTimer(f)
c.Interval=10
c.Enabled = false

c.OnTimer=function()
ctop=ctop - 1
ctop1=ctop1 + 1
 label1.Top=tonumber(ctop)
label1.Width=tonumber(ctop1)
label1.Left=tonumber(ctop) / 2 - 15

if ctop == f.Height - f.Height - 30 then
text11=tonumber(text11) + 1
label1.Caption = text1[text11]
ctop1=tonumber(100)
label1.Width=tonumber(ctop1)
ctop = tonumber(f.Height) label1.Left=tonumber(ctop) / 2 - 15 end
if text11==4 then text11=0 end
print(label1.Width)
end

f.OnClick=function()
if c.Enabled==false then
c.Enabled=true
else
c.Enabled=false
end
end


Thanks in advance for the ideas.

_________________
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
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Tue Aug 11, 2020 8:35 pm    Post subject: Re: Is there any way to prevent vibration? Reply with quote

Code:

if f then f.destroy() end

f = createForm()

label1 = createLabel(f) label1.AutoSize=false label1.Width=80
label1.Height=60 label1.Font.Style="fsBold"
label1.Font.Size=12 label1.OptimalFill=true label1.Tag=30
label1.Alignment="taCenter"

local text1 = {"CHEAT ENGINE 1", "CHEAT ENGINE 2-11-08-2020", "CHEAT ENGINE 3", "CHEAT ENGINE 4-11-08-2021"} -- will sub with words table

label1.Top = f.Height
local ctop = tonumber(f.Height)
local text11=tonumber(1)
label1.Left=tonumber(ctop) / 2 - 15
ctop1=tonumber(100)
label1.Width=tonumber(ctop1)
label1.Caption = text1[text11]

f.OnPaint=function ()
ctop=ctop - 1
ctop1=ctop1 + 1
label1.Top=tonumber(ctop)
label1.Width=tonumber(ctop1)
label1.Left=tonumber(ctop) / 2 - 15
sleep(10)
if ctop == f.Height - f.Height - 30 then
text11=tonumber(text11) + 1
label1.Caption = text1[text11]
ctop1=tonumber(100)
label1.Width=tonumber(ctop1)
ctop = tonumber(f.Height) label1.Left=tonumber(ctop) / 2 - 15 end
if text11==4 then text11=0 end
end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Wed Aug 12, 2020 11:15 am    Post subject: Reply with quote

It's a good idea to use "OnPaint" as a timer. Smile Thank you.

But the problem still persists.
The writing is still shaking as it grows, making it difficult to read during transition.

Instead of growing step by step, writing should flow like water. Wink

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Aug 12, 2020 12:57 pm    Post subject: Reply with quote

It says as 'Text Jittering / Wiggling'
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Wed Aug 12, 2020 2:02 pm    Post subject: Reply with quote

Corroder wrote:
It says as 'Text Jittering / Wiggling'


Smile

@Corroder, don't you have an Idea ?
How can the text grow without shaking?
In its present form, it is eye-straining.

_________________
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
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25793
Location: The netherlands

PostPosted: Wed Aug 12, 2020 4:07 pm    Post subject: Reply with quote

instead of relying on OptimalFill try manipulating the font yourself

perhaps some fonts work better than others

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Wed Aug 12, 2020 5:45 pm    Post subject: Reply with quote

I have tried other options instead of "OptimalFill".
AutoSize=true
Font.Height ...

I even tried different "Font.Name".
But the trembling still continues. Sad

_________________
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
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25793
Location: The netherlands

PostPosted: Wed Aug 12, 2020 10:43 pm    Post subject: Reply with quote

try an image.

Draw the text to a picture at the biggest size used and then set the image to scaling mode

then just resize the image and it will scale the highest resolution image into something smaller (so no pixelation)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Aug 13, 2020 12:52 am    Post subject: Reply with quote

Aylin wrote:
Smile

@Corroder, don't you have an Idea ?
How can the text grow without shaking?
In its present form, it is eye-straining.


In others apps, usually using draw text or example in flash using 'text break apart' to animating the text and prevent from text wiggling/shaking.

Most peoples use is GDI32 / GDI+ to animating texts, example like 'Star Wars Intro Scene'.

I don't know how to do it in CE Lua, maybe apply to create a paintbox and use textRect() or textOut() to draw the texts.

Edit:
Also use true font type will reduce text wiggling, like MS Serif font

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

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Thu Aug 13, 2020 10:59 am    Post subject: Reply with quote

I made a compilation for "canvas" from the DB, @mgr.inz.Player examples.
But the trembling continues.
I guess it might be because "Font" was added to Canvas.

Code:
function FormClose(sender)
  object_destroy(MyForm)
  MyForm = nil
  return caFree
end

FormClose()

MyForm = createForm(false)
  control_setSize(MyForm, 400,400)
  control_setCaption(MyForm,'Canvas Test')
  setProperty(MyForm, 'BorderStyle', 'bsSizeable')
  form_onClose(MyForm, FormClose)
  form_show(MyForm)
  control_setColor(MyForm, 0xffffff)

MyPanel = createPanel(MyForm)
  control_setPosition(MyPanel, 30,30)
  control_setSize(MyPanel, 340,340)
  setProperty(MyPanel, 'Anchors','akTop,akLeft,akRight,akBottom')
  control_setColor(MyPanel, 0xffffff)

MyImage = createImage(MyPanel)
  control_setAlign(MyImage, alClient)
  image_stretch(MyImage, true)

if t1 then t1.destroy() end
t1=createTimer() t1.Interval=50 t1.Enabled=false

local fontsize = 29
local text1 = {"CHEAT ENGINE 1", "CHEAT ENGINE 2-11-08-2020", "CHEAT ENGINE 3", "CHEAT ENGINE 4-11-08-2021"}


MyForm.OnClick=function()
if t1.Enabled==false then
t1.Enabled=true
else
t1.Enabled=false
end
end

local cLeft=100
local cTop=tonumber(MyPanel.Height) / 2
local text11=tonumber(1)

t1.OnTimer=function()
canvas = image_getCanvas(MyImage)

brush = canvas_getBrush(canvas)
  brush_setColor(brush, 0x000000)

font = canvas_getFont(canvas)
font_setName(font,'Terminal')
setProperty(font,'CharSet','OEM_CHARSET')
--font_setSize(font,fontsize)
font_setColor(font,0xffffff)

cLeft=tonumber(cLeft) - 2
--cTop=tonumber(cTop) - 4

if fontsize==tonumber(30) then fontsize=30 font_setSize(font,fontsize)
else
fontsize=tonumber(fontsize) + 1 font_setSize(font,fontsize) end

canvas_textOut(canvas,cLeft,cTop,text1[text11])

if cLeft==tonumber(MyPanel.Width) - MyPanel.Width then
--cTop=tonumber(MyPanel.Height)
if text11==4 then text11=0 end
text11=tonumber(text11) + 1
cLeft=100

fontsize = tonumber(2)
font_setSize(font,fontsize)
canvas_textOut(canvas,cLeft,cTop,text1[text11])
collectgarbage ("collect")
end
end

_________________
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
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu Aug 13, 2020 6:51 pm    Post subject: Reply with quote

I think a simpler approach can be downscaling, simply draw your text at maximum resolution and downscale it to desired scale, much better than upscaling, the text size change almost seamlessly.
right click to stop printing.
Code:
f = f and f.destroy() or createForm();
pb = createPaintBox(f);
f.setSize(1024,512);
pb.align = 'alClient';

txt_bitmap = txt_bitmap and txt_bitmap.destroy() or createBitmap();
txt_bitmap.width,txt_bitmap.height = pb.Width,pb.Height//3; -- eh we don't need so much height
txt_bitmap.Canvas.Font.Size = 56;
txt_bitmap.Canvas.Font.Color = 0xAA;
txt_bitmap.Canvas.Font.Quality = 'fqCleartype';

local txt_width,txt_height = 0,0;
local print_values = true;

txt = {"CHEAT ENGINE 1", "CHEAT ENGINE 2-11-08-2020", "CHEAT ENGINE 3", "CHEAT ENGINE 4-11-08-2021"};
txt_id = 0;
total_steps,step = 300,0;

animate_timer = createTimer(f,false);
animate_timer.interval = 1; -- smoother than 50;

update_bm = function()
   local c = txt_bitmap.Canvas;
   c.Brush.Color = 0;
   c.clear();
   txt_id = (txt_id % #txt) + 1;
   
   local txt = txt[txt_id];
   c.textOut(0,0,txt);
   txt_width,txt_height = c.getTextWidth(txt),c.getTextHeight(txt);
end

pb.OnPaint = function(sender)
   local min_step = total_steps//10;-- lets not start at step 1, to avoid pixels wiggling around..
   step = math.max(min_step,(step % total_steps) + 1);
   if (step == min_step) then
      update_bm();
   end
   local r = total_steps/step;
   local nw,nh = txt_width / r, txt_height / r;
   if (print_values) then
      print(r,'\t',nw,' , ',nh,'\t',txt_width,txt_height);
   end
   local x,y = (sender.width - nw) / 2, (sender.height - nh) / 2;
   local pbc = sender.Canvas;
   pbc.clear();
   pbc.copyRect(x,y,x+nw,y+nh,txt_bitmap.Canvas,0,0,txt_width,txt_height);
end

animate_timer.onTimer = function(sender)
   pb.repaint();
end;

pb.onMouseDown = function(sender,button,x,y)
   if (button == 1) then
      print_values = not print_values;
      return;
   end
   animate_timer.Enabled = not animate_timer.Enabled;
end


Edit:
Added min_step to avoid those wiggling pixels and make it animate a bit smoother, alternatively can be done by adding to the step a constant

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri Aug 14, 2020 4:32 am    Post subject: Reply with quote

Info : Also use Double Buffered also will reduce text wiggling. Usually use in VB, C#, etc
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1520

PostPosted: Fri Aug 14, 2020 11:36 am    Post subject: Reply with quote

DaSpamer wrote:
I think a simpler approach can be downscaling, simply draw your text at maximum resolution and downscale it to desired scale, much better than upscaling, the text size change almost seamlessly.
right click to stop printing.
Code:
f = f and f.destroy() or createForm();
pb = createPaintBox(f);
f.setSize(1024,512);
pb.align = 'alClient';

txt_bitmap = txt_bitmap and txt_bitmap.destroy() or createBitmap();
txt_bitmap.width,txt_bitmap.height = pb.Width,pb.Height//3; -- eh we don't need so much height
txt_bitmap.Canvas.Font.Size = 56;
txt_bitmap.Canvas.Font.Color = 0xAA;
txt_bitmap.Canvas.Font.Quality = 'fqCleartype';

local txt_width,txt_height = 0,0;
local print_values = true;

txt = {"CHEAT ENGINE 1", "CHEAT ENGINE 2-11-08-2020", "CHEAT ENGINE 3", "CHEAT ENGINE 4-11-08-2021"};
txt_id = 0;
total_steps,step = 300,0;

animate_timer = createTimer(f,false);
animate_timer.interval = 1; -- smoother than 50;

update_bm = function()
   local c = txt_bitmap.Canvas;
   c.Brush.Color = 0;
   c.clear();
   txt_id = (txt_id % #txt) + 1;
   
   local txt = txt[txt_id];
   c.textOut(0,0,txt);
   txt_width,txt_height = c.getTextWidth(txt),c.getTextHeight(txt);
end

pb.OnPaint = function(sender)
   local min_step = total_steps//10;-- lets not start at step 1, to avoid pixels wiggling around..
   step = math.max(min_step,(step % total_steps) + 1);
   if (step == min_step) then
      update_bm();
   end
   local r = total_steps/step;
   local nw,nh = txt_width / r, txt_height / r;
   if (print_values) then
      print(r,'\t',nw,' , ',nh,'\t',txt_width,txt_height);
   end
   local x,y = (sender.width - nw) / 2, (sender.height - nh) / 2;
   local pbc = sender.Canvas;
   pbc.clear();
   pbc.copyRect(x,y,x+nw,y+nh,txt_bitmap.Canvas,0,0,txt_width,txt_height);
end

animate_timer.onTimer = function(sender)
   pb.repaint();
end;

pb.onMouseDown = function(sender,button,x,y)
   if (button == 1) then
      print_values = not print_values;
      return;
   end
   animate_timer.Enabled = not animate_timer.Enabled;
end


Edit:
Added min_step to avoid those wiggling pixels and make it animate a bit smoother, alternatively can be done by adding to the step a constant


Thanks @DaSpamer for the code and solution.
Sorry to try it out, I'm 3 weeks away from the PC. Sad
I will try it at the first opportunity.
Thanks for the help and attention.

_________________
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