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 


Which way is it going? "+"? "-"?

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

PostPosted: Sun Sep 27, 2020 7:58 am    Post subject: Which way is it going? "+"? "-"? Reply with quote

I could not find any examples to understand this.

I need to print a "TrackBar" progress or a "OnResize" progress.
Rising or falling!
Sample;

Code:
function UDF1_CETrackBar1Change(sender)
if UDF1.CETrackBar1.Position==UDF1.CETrackBar1.Position + 1 then
print("The value is Rising: "..tonumber(UDF1.CETrackBar1.Position)) end

if UDF1.CETrackBar1.Position==UDF1.CETrackBar1.Position - 1 then
print("The value is Falling: "..tonumber(UDF1.CETrackBar1.Position)) end
end


or

Code:
function UDF1_FormResize(sender)
if UDF1.Width==UDF1.Width - 1 then
print("The value is Rising: "..tonumber(UDF1.Width)) end

if UDF1.Width==UDF1.Width + 1 then
print("The value is Rising: "..tonumber(UDF1.Width)) end
end


The above codes did not work.
How can a test like this be done?

_________________
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: 25806
Location: The netherlands

PostPosted: Sun Sep 27, 2020 8:10 am    Post subject: Reply with quote

store the original position/width and compare that on change, and afterwards save the new position/width
_________________
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: Sun Sep 27, 2020 8:18 am    Post subject: Reply with quote

Like this?. Or I am misunderstood as well

I set the trackbar range is 0 to 10 and trackbar position is 5 as default.

Code:
tb  = UDF1.CETrackBar1

tb.OnChange = function()
 tbVal = tb.Position
 if tbVal > 5 and tbVal <= 10 then
    print('Rising..')
 elseif tbVal < 5 and tbVal >= 0 then
    print('Falling..')
 else
    print('Centering..')
 end
end

UDF1.Show()


EDIT : Should be this

Code:
tb  = UDF1.CETrackBar1
tb.Position = 5

tb.OnChange = function()
 local tbNow = 5
 local tbNew = tb.Position

 if tbNow == tbNew then
    return nil
 elseif tbNew > tbNow then
    print('Rising..')
    tbNow = tbNew
 elseif tbNew < tbNow then
    print('Falling..')
    tbNow = tbNew
 end
end

UDF1.Show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL


Last edited by Corroder on Sun Sep 27, 2020 9:03 am; edited 2 times in total
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1526

PostPosted: Sun Sep 27, 2020 9:00 am    Post subject: Reply with quote

I think I'm asking wrong. Sad
I do not want to decrease or decrease from the current position.
I can find this result.
I'm trying to do;
Is the progress bar or "ReSize" going right or left?
I'm trying to find this.
So; Direction, right or left?

example:

Code:
function UDF1_CETrackBar1Change(sender)
if UDF1.CETrackBar1.Min + 1 then
print("The value is Rising: "..tonumber(UDF1.CETrackBar1.Position))
else
print("The value is Falling: "..tonumber(UDF1.CETrackBar1.Position)) end
end


@Corroder example;
Value; 0, 5, 10. Result; 6,7,8 "Rising". 9,8,7,6 "Rising"
No! It should be like this;
0,1,2,3,4,5,6,7,8,9,10, "Rising"
10,9,8,7,6,5, etc. "Falling"
Value + 1 = "Rising"
Value - 1 = "Falling"
Progress bar going right or left?
I want to question this. Smile

_________________
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: Sun Sep 27, 2020 9:06 am    Post subject: Reply with quote

I am edit my sample. and Progress bar always going to right. If the bar meter have left and right, I think its call as 'Gauge Bar Indicator' Laughing
_________________
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: 1526

PostPosted: Sun Sep 27, 2020 10:17 am    Post subject: Reply with quote

5 to 10 Rising and 10 to 5 Rising. Smile
It should be like this; 0 - progression "Rising" (When moving the bar to the right).
10 - 0 progress (When sliding the bar left) "Falling"
Rising should print +1 "Rising" and Falling - 1 "Falling". 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: Sun Sep 27, 2020 7:06 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
tb = UDF1.CETrackBar1
tb.Max = 10
tb.Step = 1
tb.Min = 0
tb.Position = 5
tb.frequency = 1
lbl = UDF1.CELabel1
lbl.Caption = 'idle'

curpos = tb.position
newpos = tb.position

tb.onChange = function()
 curpos = tb.position
 if curpos > newpos then
    lbl.Caption = 'up'
    print('Aylin Becone A Rising Star')
    newpos = curpos
    curpos = tb.position
 end

 if curpos < newpos then
    lbl.Caption = 'down'
    print('Aylin Has Fallen')
    newpos = curpos
    curpos = tb.position
 end

end

UDF1.show()

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

PostPosted: Mon Sep 28, 2020 6:23 am    Post subject: Reply with quote

Thanks @Corroder. Smile
Now I can see in which direction it is heading left or right.
The strange part is; I could not find any examples for "left or right" in Lua.
Your code works fine and you got me out of this situation, I owe you +1.

Note; While I was dealing with the code below, this question struck me.
https://forum.cheatengine.org/viewtopic.php?p=5765172#5765172

Is it going "right" or "left" ..
I think "Lua" or CE (DB) should generate a shorter code to this.
TrackBar..Move.Right
ProgressBar..Move.Left
if TrackBar.Move==Right then vs.


Thanks again mate.

_________________
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: Mon Sep 28, 2020 8:29 am    Post subject: Reply with quote

I think I have something like this before in old topic in the forum.
https://forum.cheatengine.org/viewtopic.php?p=5721406#5721406

but the original script actually is here:

Code:
if f then f.destroy() end
f = createForm()
f.Width = 300
f.Height = 200
f.Position = 'poScreenCenter'

c = createCheckBox(f)
c.Left = 10
c.Top = 10
c.Caption = 'Check Me To Show Track Bar'

l = createLabel(f)
l.Font.Size = 12
l.Caption = 'Corroder'
l.Top = c.Top + c.Height + 20
l.Left = math.floor(f.Width - l.Width) / 2
l.Font.Color = 0
l.Visible = false

t = createTrackBar(f)
t.left = 20
t.top = f.height - 60
t.width = f.width - t.left - 20
t.height = 30
t.frequency = 1
t.Max = 48   --- Maximum Value for a variable you want to change
t.Min = 12   --- Maninum Value for a variable you want to change
t.position = 0
t.SelStart = 0
t.SelEnd = 0
t.Visible = false

l2 = createLabel(f)
l2.Caption = 'Font Size : 12'
l2.Top = t.Top + t.Height + 8
l2.Left = 10
l2.Font.Color = 0
l2.Visible = false

f.show()


---- input here what all stuffs you want change when it check / uncheck
function cCheck(sender)
  if sender.Checked then
     l.Visible = true
     l2.Visible = true
     t.Visible = true
  else
     l.Visible = false
     l2.Visible = false
     t.Visible = false
  end
end


---- Change your variable values here according to trackbar position
ls = t.Position
ns = t.Position

function TrackBar1Change(sender)
 l.Font.Size = t.Position
 ls = t.Position

 if ls > ns then
 l.Font.Color =    4231485
 l2.Font.Color =    4231485
 l2.Caption = 'Font Size INCREASE to : '..tostring(t.position)
 l.Left = math.floor(f.Width - l.Width) / 2
 l.Top = c.Top + c.Height + 20
 ns = ls
 ls = t.Position
 elseif ls < ns then
 l.Font.Color =   858083
 l2.Font.Color =   858083
 l2.Caption = 'Font Size DECREASE to : '..tostring(t.position)
 l.Left = math.floor(f.Width - l.Width) / 2
 l.Top = c.Top + c.Height + 20
 ns = ls
 ls = t.Position
 end
end

t.onChange = TrackBar1Change    --- execute trackbar change
c.onChange = cCheck  --- execute check box change

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

PostPosted: Mon Sep 28, 2020 10:41 am    Post subject: Reply with quote

Yes @Corroder, all solutions are made by adding additional queries.
We can print whether an object moves to the right or left (the direction of travel while it is manual) with additional codes.
What are there we might want to question (?);
TrackBar
ProgressBar
Timer
ReSize
Lines
etc.
Going forward or backward, up or down.
Knowing for now is not possible without additional codes.
"if Object.PositionMove + 1 then" or "- 1"
Is this a shortcoming? We will see over time.
Thank you for participating in the thread and for your opinion.

_________________
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