View previous topic :: View next topic |
Author |
Message |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Sun Jan 27, 2019 2:57 pm Post subject: An example for the index: + and - |
|
|
I'm moving a picture step by step.
and a loop occurred.
But coming to the place I want will cause the code to multiply.
Can I get a sample with index + and index?
Thanks in advance.
Code: | index = 1 --Left=1
index = index + 1 --++Left=150
index = 1 --Left=150
index = index - 1 Left=1 |
Code: | function CETimer1Timer(sender)
if UDF1.CEImage1.Left==1 then
control_setVisible(UDF1.CEImage1, true)
UDF1.CEImage1.Left=8
elseif UDF1.CEImage1.Left==8 then
UDF1.CEImage1.Left=16
elseif UDF1.CEImage1.Left==16 then
UDF1.CEImage1.Left=24
elseif UDF1.CEImage1.Left==24 then
UDF1.CEImage1.Left=32
elseif UDF1.CEImage1.Left==32 then
UDF1.CEImage1.Left=40
elseif UDF1.CEImage1.Left==40 then
UDF1.CEImage1.Left=48
elseif UDF1.CEImage1.Left==48 then
UDF1.CEImage1.Left=56
elseif UDF1.CEImage1.Left==56 then
UDF1.CEImage1.Left=64
elseif UDF1.CEImage1.Left==64 then
UDF1.CEImage1.Left=1
end
end |
_________________
|
|
Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Jan 27, 2019 4:43 pm Post subject: |
|
|
looks like you're just adding 8 until it's 64 so something like
Code: | if UDF1.CEImage1.Left == 1 then show it and stuff
elseif UDF1.CEImage1.Left < 64 then UDF1.CEImage1.Left = UDF1.CEImage1.Left + 8
else UDF1.CEImage1.Left = 1 end |
_________________
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Sun Jan 27, 2019 6:53 pm Post subject: |
|
|
FreeER wrote: | looks like you're just adding 8 until it's 64 so something like
Code: | if UDF1.CEImage1.Left == 1 then show it and stuff
elseif UDF1.CEImage1.Left < 64 then UDF1.CEImage1.Left = UDF1.CEImage1.Left + 8
else UDF1.CEImage1.Left = 1 end |
|
Code: | if UDF1.CEImage1.Left == 1 then show |
After "show", it gives an error.
the following code is progressing, but it does not return.
Code: | function CETimer1Timer(sender)
if UDF1.CEImage1.Left==1 then
UDF1.CEImage1.Left = UDF1.CEImage1.Left + 4
elseif UDF1.CEImage1.Left < 150 then
UDF1.CEImage1.Left = UDF1.CEImage1.Left + 4
elseif UDF1.CEImage1.Left==150 then
UDF1.CEImage1.Left = UDF1.CEImage1.Left - 4
elseif UDF1.CEImage1.Left < 1 then
UDF1.CEImage1.Left = UDF1.CEImage1.Left - 4
end
end |
Also, thanks for your reply.
_________________
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Mon Jan 28, 2019 6:46 am Post subject: |
|
|
An example with long codes .CT
@freeER, it was compiled with the codes you gave.
https://www.dosyaupload.com/epXD
Is there a way back and forth?
Left + 2
Left - 2
_________________
|
|
Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Jan 28, 2019 5:00 pm Post subject: |
|
|
If you want to change directions the easiest way is to store the "speed" in a variable eg.
Code: | speed = 2 -- initial setup
-- change dir when reaching limits by negating speed
if pos < left_limit or pos > right_limit then speed = -speed end
-- move
pos = pos + speed |
_________________
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Tue Jan 29, 2019 10:09 am Post subject: |
|
|
Thanks @Corroder done
You understood me. I needed a sample. Thanks.
I'm going to use this on the Trainer.
And in the video of use: I will specify the code owner.
Thanks again.
final with a small addition.
Code: | Timer1 = createTimer(f)
Timer1.Interval = 5000
Timer1.Enabled = true
Timer1.OnTimer = Imgplay
img.Left = -200
if img.Left==-200 then
Direction = 'out'
Timer.Enabled = true end
function Imgplay()
Timer.Enabled = false
if Direction=='out' then
Direction = 'in'
Timer.Enabled = true
else
Direction = 'out'
Timer.Enabled = true
end
end
f.Show()
|
_________________
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Tue Jan 29, 2019 1:13 pm Post subject: |
|
|
Corroder wrote: | Never mind @Aylin, try to grow it up... good luck  |
Wouldn't the adults have fun?
After all: we will not save the world by cheating.
Entertainment should go on.
_________________
|
|
Back to top |
|
 |
|