Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Axem on September 13, 2005, 09:58:37 pm

Title: FRED doesn't like fractions
Post by: Axem on September 13, 2005, 09:58:37 pm
Sigh...

I'm trying to time events exactly to something, however FRED will only let me set delays or chains to whole numbers. I've tried inputting it as a decimal number (47.5), as a fraction using the divide operator (95/2), even going into notepad and working behind FRED's back, but alas none of it works.

Anyone have any ideas how to get around this?
Title: FRED doesn't like fractions
Post by: Nuclear1 on September 13, 2005, 10:04:48 pm
The only time I've had fractions work for me is in send-message-list, but otherwise, I don't think there is a way around. Sorry bro.
Title: FRED doesn't like fractions
Post by: karajorma on September 14, 2005, 05:45:15 am
SEXPs are built to work on intergers. I don't think there's much of a way round this.
Title: FRED doesn't like fractions
Post by: Trivial Psychic on September 14, 2005, 09:08:45 am
Would it be possible to use variables for these figures?  Then you could calculate the decimal figure you want and store its value in a variable, and use that.  Is that possible?
Title: FRED doesn't like fractions
Post by: karajorma on September 14, 2005, 10:15:31 am
AFAIK variables also use integers. You can try it but I doubt you'll have much success.

Even if you could get an integer into a variable though FS2 would simply cast it to an integer as soon as it's used in a SEXP anyway and you've be back to square one.
Title: FRED doesn't like fractions
Post by: ShadowWolf_IH on September 14, 2005, 10:31:31 am
there was once a discussion in the scp about changing the entire system over to ms instead of seconds......but if that happens...so much for backward compatability.
Title: FRED doesn't like fractions
Post by: Kie99 on September 14, 2005, 01:23:39 pm
Couldn't there be some extra sexps, for example, has-time-elapsed and has-time-elapsed-ms?
Title: FRED doesn't like fractions
Post by: Goober5000 on September 14, 2005, 04:38:53 pm
The entire sexp system is based around integers.  Period.  You can't use decimal numbers without rewriting part or all of the sexp system.
Title: FRED doesn't like fractions
Post by: Sesquipedalian on September 14, 2005, 04:54:03 pm
I suspect that a situation that requires such precise timing is likely to break once the player gets in there and starts mucking around anyway.
Title: FRED doesn't like fractions
Post by: Axem on September 14, 2005, 08:00:27 pm
What I was thinking to trick by finding something that takes half a second to do (or some fraction of a second), and then use the event delay so it fires off at a whole number of seconds later. I would just need to find something that takes a half second to do, or is almost everything based on whole seconds?

I should add this is for a cutscene, not a player controlled enviroment, so what the player does, doesn't matter.
Title: FRED doesn't like fractions
Post by: karajorma on September 15, 2005, 02:35:11 am
Do this then. Create a ticker timer with an event like this

Timer - Provides half seconds
When
-is-event-true-delay
--Some event half a second before what you want.
-modify-variable
--TickerTimer(0)
-- +
---TickerTimer(0)
---1

Give it 30 repeats and a delay of 0

Then simply used this

Trigger Event
When
- =
--TickerTimer(0)
--30


Problem with this is that the speed at which TickerTimer is incremented depends on the player's PC. A fast PC seems to update quicker than a slow one. But if you keep the numbers low enough you might manage to get it to work. Make sure you test on a variety of high end and low end PCs just to be sure.
Title: FRED doesn't like fractions
Post by: Axem on September 16, 2005, 09:54:49 pm
Yay, I got it to work another way. I used Physics to trick FRED. An Amazon Advanced Drone at full speed (50m/s) will cover 25m in 0.5s. Using the distance operation and a no warp effect option, the Amazon arrives at the instance I need it, at full speed, and produces the delay needed.

Now syncing to the music will be a breeze!
Title: FRED doesn't like fractions
Post by: phreak on September 16, 2005, 09:59:33 pm
math 4tw
Title: FRED doesn't like fractions
Post by: CP5670 on September 17, 2005, 12:10:06 am
indeed :D

Make sure you put the drone somewhere really far away and make it cloaked, so the player doesn't notice.
Title: FRED doesn't like fractions
Post by: Mongoose on September 17, 2005, 08:01:45 pm
The ingenuity of FREDers never ceases to amaze me :D
Title: FRED doesn't like fractions
Post by: Nuclear1 on September 17, 2005, 09:47:59 pm
Quote
Originally posted by Mongoose
The ingenuity of FREDers never ceases to amaze me :D


You gotta give us some credit. Sitting around all that math-related work does something to you... :D
Title: FRED doesn't like fractions
Post by: karajorma on September 18, 2005, 02:51:31 am
Quote
Originally posted by Axem
Yay, I got it to work another way. I used Physics to trick FRED. An Amazon Advanced Drone at full speed (50m/s) will cover 25m in 0.5s. Using the distance operation and a no warp effect option, the Amazon arrives at the instance I need it, at full speed, and produces the delay needed.

Now syncing to the music will be a breeze!


That's going right into the cookbook. Far better than my solution. :D
Title: FRED doesn't like fractions
Post by: CP5670 on September 18, 2005, 03:08:29 am
Speaking of things like this, anyone remember that old FRED2 tips and tricks thread on the VBB? There was some very useful stuff in there; does anyone still have a copy of it?
Title: FRED doesn't like fractions
Post by: karajorma on September 18, 2005, 03:54:10 am
Yep. I'll have to see about putting it up if no one else steps forward. I know that sandwich did have it up at one point but the link is dead now.