Nice idea, not bad for a beginner, I would suggest learning entity functions , as well as entity discover functions and trying to implement those.
Hey i'm Shlimmy, relatively new to E2 and very new to these forums,
Not too impressive, but one of my first "contraptions"
i'm sure this has been done before, but i think it is kinda cool.
This is a box that will "pick up" a small ball and bring it back to you. It uses Target finders and beacon sensors that connect with an E2 chip (code below) that control thrusters on the box. The screen just says whether it is finding the ball or bringing it back (i wanted to mess around with the strings)
it's a bit disorganized, and i'm not sure that i made it in the most efficient way possible. Any tips to improve it or add another feature would be cool.Code:@name Fetcher @inputs Xoffsetplayer Xoffsetball Tarball Tarplayer Balldist Playerdist @outputs Lthrust Rthrust Fthrust Sthrust Disp:string @persist Track Target @trigger ##Thrust Commands## if (Target == 1) {if (Track == 1) {if (Xoffsetplayer > 1) {Rthrust = 1} else {Rthrust = 0} if (Xoffsetplayer < 1) {Lthrust = 1} else {Lthrust = 0} if (Target == 1) {Fthrust = 1} else {Fthrust = 0}} if (Track == 2) {if (Xoffsetball > 1) {Rthrust = 1} else {Rthrust = 0} if (Xoffsetball < 1) {Lthrust = 1} else {Lthrust = 0} if (Target == 1) {Fthrust = 1} else {Fthrust = 0}}} if (Target == 0) {Track = 0} ##Track Commands## if (Balldist < 80) {Track = 1} else {Track = 2} if (Tarball == 1 & Tarplayer == 1) {Target = 1} else {Target = 0} ##Slow down (optional)## if (Playerdist < 250 & Track == 1) {Sthrust = 0} else {Sthrust = 1} ##Display Commands## if (Track == 1) {Disp = "Retrieving Ball"} if (Track == 2) {Disp = "Finding Ball"}
Nice idea, not bad for a beginner, I would suggest learning entity functions , as well as entity discover functions and trying to implement those.
Ninja'd. its pretty good, but to make everything alot easier use entity discovery.
Working on military pack.
Remember
amateurs build the ark....
Professionals build the titanic
Im not familiar with entity functions, but they seem to have a lot more potential. Ill have to look at some examples.
Hrm ill try to get fraps for that purpose, but i have never really done anything with apply force, are they really much different?
Well I'd say that applyForce can be a bit tricky in the beginning. To understand it fully you'll need a grasp of how the vector system works in E2. But it's not that hard to implement some code. Look at some examples and it's easy to modify those to fit your code. I hope I haven't scared you, I recently started messing with E2 and this is just how I feel.
"He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife." - Douglas Adams
"If somebody thinks they're a hedgehog, presumably you just give 'em a mirror and a few pictures of hedgehogs and tell them to sort it out for themselves." - Douglas Adams
hrm a bit confused on the syntax of entities and entity discovery
here is an example expression from the wiki
say I wanted it to instead track my location, how would I do that?Code:@name GPS (updated by Syranide) @outputs X Y Z Pos:vector runOnTick(1) Pos=entity():pos() X=Pos:x() Y=Pos:y() Z=Pos:z()
it works when I am moving, but when i stand still it wigs out
this is what i tried, is this right?
Code:@name GPS (updated by Syranide) @outputs X Y Z Pos:vector runOnTick(1) Pos=findPlayerByName("Shlimmy"):pos() X=Pos:x() Y=Pos:y() Z=Pos:z()
Last edited by Shlimmy; 11-30-2009 at 06:56 PM. Reason: tried something
That is actually the right syntax, you don't have a problem there. The problem is the find functions, I think. You can only run them every so often, I'm not sure the ticks you need between them. But an easy fix for this would be to only find your entity once.
Here I put Player as a persistent variable. If there is no Player set, (!Player), then it sets Player as the owner of the chip. Or, you could use findPlayerByName(). Then Player stays the same, and only the position will update every tick.
Code:@name GPS (updated by Syranide) @outputs X Y Z Pos:vector @persist Player:entity runOnTick(1) if(!Player) { Player = owner() #Player = findPlayerByName("") } Pos=Player:pos() X=Pos:x() Y=Pos:y() Z=Pos:z()
Anne drew Andrew and Drew, and Druanne drew Anne, Drew, Andrew, and Ru.
AnDrEw in-game.
I like it its nice and simple.
"I like pie"-Jat Goodwin
<Azrael-> ryland: LOL is such a noobish thing to say.
<ryland> LOL
<Fox682> LOLLOL
<Fox682> LOL
<ryland> LOL
Bookmarks