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.

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);
    @Cd = set(1,0,0);

.hip file also attached.


Edited by GlennimusPrime

Share this post

Link to post
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};



Share this post

Link to post
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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now