project: Script 4 Everyone (need people)

Work together on Algodoo projects here.

project: Script 4 Everyone (need people)

Postby ianno » Tue Oct 20, 2009 12:00 pm

it is a idea of me to make the moast complete script tutoreal and list with scripts of algodoo and than sent it to someone high in algodoo that can put in on the website, in the installation self, or maybe in algodoo! i have self also some scripts to:

Water Spawner maybe lazers
(e)=>{Scene.addWater({vecs = [e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos, e.pos]})

Water spawner for Lazers maybe oncollide
(e)=>{Scene.addWater({vecs = [e.pos, e.pos, e.pos]})} i thing if you post something like this it is the best

Circle Spawner
(e)=>{scene.addCircle({ radius := 0.1; density := 2.0; restitution := 0.5; friction := 0.5; pos := e.pos }) };

Box Spawner
(e)=>{ Scene.addBox({size := [0.83575642, 0.27858579]; density := 2.00; pos := e.pos; restitution := 0.5; friction = 0.5; angle := 0}) }

----------------------------------------------------------------------------------------------------------------------------------

Self Collision
(e)=>{heteroCollide = false;}

Collide water
(e)=>{collideWater = true }

----------------------------------------------------------------------------------------------------------------------------------

Shape color([R,G,B,A] 0-255)
(e)=>{color = [1.0, 0.0, 0.0, 1.0]}

Text Color ([R,G,B,A] 0-255)
(e)=>{textColor = [1.0, 0.0, 0.0, 1.0]}

Text Size
(e)=>{textScale = 3;}

----------------------------------------------------------------------------------------------------------------------------------

Density
(e)=>{density = 10.02;}

Repel
(e)=>{attraction = - 20;}

Attract
(e)=>{attraction = 50;}

Killer
(e)=>{killer = true }

----------------------------------------------------------------------------------------------------------------------------------

"Anti-Gravity"
(e)=>{Sim.gravityAngleOffset = 3.1415927;}

Pause Sim
(e)=>{sim.running = false;}

Change Zoom
(e)=>{scene.camera.zoom = 17.700001}

change Camra Pan
(e)=>{scene.camera.pan = [ - 446, 14.6];}

----------------------------------------------------------------------------------------------------------------------------------

Set destroy key (With spawned objects)
buttonDestroy := "e"

Set collision (With spawned objects)
collideSet := 0;

Add Text (With spawned objects)
text := "Hello World!"

----------------------------------------------------------------------------------------------------------------------------------

If you wish to use more than one script in an object then the format should be as follows
Say you want to combine (e)=>{attraction = 50;} and (e)=>{color = [1.0, 0.0, 0.0, 1.0]}
You would write it as… note the semicolon and spaces.
(e)=>{ attraction = 50; color = [1.0, 0.0, 0.0, 1.0]}

----------------------------------------------------------------------------------------------------------------------------------
this part i made by my self

press ~ and type scene.my.steer=0 press enter and than type scene.my.motor=0 and than enter.
to make a mouse cotroled flying object make a circle with (e)=>{scene.my.motor = (app.mousepos(1) - e.pos(1)) * 5; scene.my.steer = (app.mousepos(0) - e.pos(0)) }
2 wheels with motorspeed {scene.my.motor} and a box with on 2 sides a hing with motor speed{scene.my.steer}

for example look at UFO mousecontrolled V1 websites for more info

{scene.my.recognisation} for color changing at oncollide (not tested)

(e)=>{color = ((color + e.other.color) / 2)} "mix" the color when it collide

vel := [10, 20],10 to spawn an opject right -10 for left, 20 to spawn up and -20 to spawn down, how higher the number how faster it will spawn that way.

!!!I NEED SOME PEOPLE FOR MORE SCRIPTS!!!

ps. sorry if you see allot of spell mistakes and bad grammer :oops:
Last edited by ianno on Tue Oct 20, 2009 4:34 pm, edited 1 time in total.
After one year of inactifyti i will make my comeback!
ianno
 
Posts: 42
Joined: Wed Sep 02, 2009 3:06 pm

Re: AHOX project: Script 4 Everyone

Postby davidz40 » Tue Oct 20, 2009 2:14 pm

There's much more extensive collection of scripts on the forum arleady, and I don't think that collab forum is proper place for this. But on the other hand, it's short and clear enough to be easily understandable by newbies, so it could be usefull, just move it to the tutorials and remove "AHOX" from the name because it's not related with it in any way :?
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: project: Script 4 Everyone (need people)

Postby Kutis - AHOX » Fri Nov 06, 2009 10:15 pm

I want to join ;)
for make it ßetter :lol:
Kutis - AHOX
 
Posts: 140
Joined: Sun Oct 04, 2009 7:41 pm
Location: In your Algodoo improving your scenes to make it better

Re: project: Script 4 Everyone (need people)

Postby standardtoaster » Fri Nov 06, 2009 10:22 pm

Actually, for color it's not [R, G, B, A] it's [H, S, V, A] Hue, Saturation, Value, and Alpha.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: project: Script 4 Everyone (need people)

Postby Kutis - AHOX » Tue Nov 10, 2009 3:57 pm

No. It's really R G B A
Kutis - AHOX
 
Posts: 140
Joined: Sun Oct 04, 2009 7:41 pm
Location: In your Algodoo improving your scenes to make it better

Re: project: Script 4 Everyone (need people)

Postby standardtoaster » Tue Nov 10, 2009 4:19 pm

Wrong. >.> I should know. I had to work with the values for my gradient spawners.
Image
Does that say Red, Blue, Green? I didn't think so.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: project: Script 4 Everyone (need people)

Postby KarateBrot » Wed Nov 11, 2009 4:02 am

In the scripting menu the colors are mixed with the values [R,G,B,A].
The HSVA colors in the appearance menu get convertet to RGBA for the scripting menu. You can see it by setting all values (besides A) to 0 and then for R type in 1. The box will be red. Set it back to 0 and change G to 1. The box will be green etc... Saturation is controlled by the size of the value. Turn R to 0.5 and it will be dark red etc... Value is controlled by the difference between the colors. R = 0.5 and then raise G and B at the same amount. It will get grey (limit at 0.5)

You are both right... The values in the scripting menu are RGBA but they get converted to HSVA and the other way round HSVA in the appearance menu gets converted to RGBA. But I don't know what's the REAL color mode Algodoo calculates with. Ask Emil :D
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: project: Script 4 Everyone (need people)

Postby standardtoaster » Wed Nov 11, 2009 4:25 am

I was going to post something like you just said after I had tested it earlier today. I didn't have time to post it. At least someone posted it.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: project: Script 4 Everyone (need people)

Postby phunaddict » Wed Dec 02, 2009 6:18 pm

about the color thing
i know RGB but whats A?
and what should i use to set darkness?
phunaddict
 
Posts: 20
Joined: Fri Sep 11, 2009 11:17 pm

Re: project: Script 4 Everyone (need people)

Postby phunaddict » Wed Dec 02, 2009 6:21 pm

nevermind,found it...
the more RGB the lighter
phunaddict
 
Posts: 20
Joined: Fri Sep 11, 2009 11:17 pm

Re: project: Script 4 Everyone (need people)

Postby standardtoaster » Wed Dec 02, 2009 6:22 pm

A is Alpha, otherwise known as transparency.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: project: Script 4 Everyone (need people)

Postby cdh473 » Sun Jan 03, 2010 3:14 pm

Kutis - AHOX wrote:I want to join ;)
for make it ßetter :lol:

Ssetter?
And here's how the whole rgba thing works:
R=Red
G=Green
B=Blue
A=Alpha=Transparency
if you have R=0, G=0, B=0, A=255, then the color is black. If you have R=255, G=255, B=255, and A=255, then the color is white. if A=0 in ANY case, then the object is completely invisible.
Please excuse my posts. I am extremely stupid.
User avatar
cdh473
 
Posts: 816
Joined: Tue Sep 01, 2009 12:37 am
Location: Yes

Re: project: Script 4 Everyone (need people)

Postby Lustitaj » Fri Mar 19, 2010 2:47 am

{scene.my.recognisation} for color changing at oncollide (not tested)


This code won't do anything without first declaring the variable in console
Code: Select all
recognisation = [0.0, 0.0, 0.0, 0.0]

And you have to add something to change the value of the variable like in the oncollide
Code: Select all
scene.my.recognisation = e.other.color


You could also write something about changing collision groups with the" collideset = X "command if you write about self collision and water collision
Basicly you can change every value of the object that is showed in the script menu by laserhit or collision (or setting that value as a variable like color = {scene.my.recognisation}) and some more values like position or velocity if this object is getting created.

if you have R=0, G=0, B=0, A=255, then the color is black. If you have R=255, G=255, B=255, and A=255, then the color is white. if A=0 in ANY case, then the object is completely invisible.

Nope. Not completely - you'll see the borders :) Offcourse you can set it to completely invisible with drawborder = false and drawcake = false if editing a circle. And you can use 1.0 as well as 255. That color effects are really useful. I like colors :D
And I'm hungry :(
Lustitaj
 
Posts: 1
Joined: Fri Mar 19, 2010 2:35 am

Re: project: Script 4 Everyone (need people)

Postby phunbox1 » Sun Oct 17, 2010 2:13 am

does anyone know how to spawn an object and give it a life span without killers

example: spawn an object and after 5 seconds it automaticly dies


i was thinking if you could make the density change to 0 (after 5 seconds) then it will disappear

THANKS
phunbox1
phunbox1
 
Posts: 4
Joined: Sat Apr 17, 2010 1:00 am

Re: project: Script 4 Everyone (need people)

Postby Chronos » Sun Oct 17, 2010 9:54 am

Maybe if you started a new topic instead of bumping on old one...

Also, this can easily be found out by searching the forums.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: project: Script 4 Everyone (need people)

Postby CoolRulez12 » Wed Dec 15, 2010 4:26 am

@phunbox1, you can use a code like..
Code: Select all
(e)=>{TBox:=Scene.addCircle{[Put normal propreties here];time1:=100;timer:=0};TBox.timer<TBox.timer?{TBox.timer=TBox.timer+1}:{TBox.density=0}}

Hope that helped.
CoolRulez12
 
Posts: 2
Joined: Tue Dec 14, 2010 5:40 am


Return to Collab forum

Who is online

Users browsing this forum: No registered users and 4 guests

cron