Jump to content

VEX Timer Attributes


Recommended Posts

I'm trying to make a vex timer that colours a point travelling along a line.
I've managed to make a time multiplier control to slow down the speed of the moving colour point, and also a frame offset control to set the start frame for the action to happen.
image.png.59bf4be60643cf3531cba5c4874ce2fe.png

What I'd love to implement is a way to set the amount of time the point is coloured - So if the time multiplier is set very low and the point colour is moving slowly, I'd like to be able to set the amount of frames the coloured point is visible for.

As I'm always learning, I'd love if someone could take a look over this VEX and let me know if I've even set this up correctly and I am most open to changes if I have set this up poorly, or it can be shortened in any way.

int time = $T*chf("time_mult")*$FPS;
int time2 = floor(time - ($RFSTART-1) * chf("time_mult"));
int time3 = time2 - chi("frame_offset") * chf("time_mult");
if (time3 != @ptnum){
    @Cd = (0,0,0);
}
else
{
    @Cd = set(1,0,0);
}

.hip file also attached.

VEX_Timer.hiplc

Edited by GlennimusPrime
Link to comment
Share on other sites

have a look at the scene or try my code...not sure if that's what you're after

 

int speed = chi("num_frames_between_move");
int frames_on = chi("num_frames_turned_on");
int pt_to_turn_on = (@Frame-1000) / (speed + frames_on);
int on = @Frame % (speed + frames_on) < frames_on;
if(on && @ptnum==pt_to_turn_on) @Cd = {0,1,0};

 

dm_VEX_Timer.hiplc

Link to comment
Share on other sites

Very close! Thanks for giving this a go @3dome, it almost works!

If I set the num of frames between to 6 and the number of frames turned on to 3, the green dot seems to jump back one spot and then continue forward.
I'd also love to implement a frame offset slider into this too if possible.

I think some of your code here can help me try to work this out, but if anyone else has any ideas, they'd be greatly appreciated.

Edited by GlennimusPrime
Link to comment
Share on other sites

On 11/25/2022 at 1:47 AM, GlennimusPrime said:

Very close! Thanks for giving this a go @3dome, it almost works!

If I set the num of frames between to 6 and the number of frames turned on to 3, the green dot seems to jump back one spot and then continue forward.
I'd also love to implement a frame offset slider into this too if possible.

I think some of your code here can help me try to work this out, but if anyone else has any ideas, they'd be greatly appreciated.

yeah you're right, sorry for not thoroughly testing my code.

here's an update that now should work fine and also has a offset parameter:
(Edit: that variable name frame_from_one doesn't make sense as it's actually 0 when the first point turns green)
 

//put $RFSTART into the parameter. Remove the -1 if you 
//don't want the first frame to be already counted
int rfstart = chi("rfstart")-1; 

int offset = chi("offset");
int frame_from_one = int(@Frame - rfstart - offset);
int speed = chi("num_frames_between_move");
int frames_on = chi("num_frames_turned_on");

int pt_to_turn_on = frame_from_one / (speed + frames_on);
int on = frame_from_one % (speed + frames_on) < frames_on;
if(frame_from_one >= 0 && (on && @ptnum==pt_to_turn_on)) @Cd = {0,1,0};

 

dm_VEX_Timer.hiplc

Edited by 3dome
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...