OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bedges on 19 Dec 2004, 14:42:45
-
i notice sine and cosine can be used in scripts. that being the case i have a request (apologies if this isn't the place for it).
using the smallflare effect, would it be possible to recreate a moving version of the atomic symbol? you know the one i mean? the three particles circling in their respective ellipses.
given my limited ability with the opf syntax i don't even know where to start, but i remember from way way back programming circles in BASIC... can't for the life of me remember how we did it, but i know a loop, a degree variable, sine and cosine were involved...
i'll work on it myself, but if any of you gurus out there can whip something quick up i would be most grateful. i recall the BASIC version was only something like five lines of code. but then that's why it's called basic huh... :)
cheers
-
Uh huh.....BASIC was good enough in its day, actually it is still used in some circles.
Really it was called BASIC because it means:
Beginners All-Purpose Symbolic Instruction Code.
What exactly do you mean by 'smallflare effect'?
Planck
-
hmmm well the smallflare effect is an extra object added by the great general barron in his editor update. however, after looking up a few BASIC tutorials (ah the memories :) ) - IT WORKS!
place an object, any object, and call it 'circler'. in the init field stick in
[] exec "make_circle.sqs"
then copy and paste this into notepad
;do a circle
_i=0
_r=3
_xcentre=getpos circler select 0
_ycentre=getpos circler select 1
#loop
circler setpos[(_xcentre+((sin _i)*_r)),(_ycentre+((cos _i)*_r))]
~0.01
_i = _i + 1
?_i>=360:exit
goto "loop"
exit
save as "make_circle.sqs", and preview.
now all i have to do is figure out how to make something circle diagonally...
more coffee required methinks ;)
-
?_i>=360:exit
why not make it:
?_i>=360:_i = 0
so it will keep going around
-
heheheheheh. sigh. mhmm, here i am nesting my loops and all it needs is the loop variable reset.
thankyou sir :)
-
Heh heh. Trig! Yaay! :D
If it's an ellipse you want, try this:
;do an oval
_i=0
_rmax = 8
_rmin = 4
_dr = _rmax - _rmin
_xcentre=getpos circler select 0
_ycentre=getpos circler select 1
#loop
circler setpos[(_xcentre+((sin _i)*(_rmin ))+_dr*(sin(_i))),(_ycentre+((cos _i)*(_rmin))+_dr*(sin(_i)))]
~0.01
_i = _i + 2
?_i>=360:_i = 0
goto "loop"
exit
Or if you want the object to inscribe simple harmonic motion, try this:
;do SHM
_i=0
_r=8
_xcentre=getpos circler select 0
_ycentre=getpos circler select 1
_dir = getdir circler
#loop
circler setpos[_xcentre + (sin _dir)*(_r*sin(_i)),_ycentre + (cos _dir)*(_r*sin(_i)),0]
~0.01
_i = _i + 2
?_i>=360:_i = 0
goto "loop"
exit
-
someone did a trig tutorial in the ed depot - check it out
-
I read in wikipedia that BASIC was first a single word, but because it was so popular, ppl turned into an acronym, like Planck said.
Tomasz