+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Fetching Box

  1. #1
    Wire Noob Shlimmy's Avatar
    Join Date
    Jun 2009
    Posts
    4

    Default Fetching Box

    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)






    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"}
    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.
    Attached Files Attached Files

  2. #2
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: Fetching Box

    Nice idea, not bad for a beginner, I would suggest learning entity functions , as well as entity discover functions and trying to implement those.

  3. #3
    Wire Sofaking smellslike's Avatar
    Join Date
    May 2009
    Location
    in a lonley world
    Posts
    412

    Default Re: Fetching Box

    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

  4. #4
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default Re: Fetching Box

    Nice little gizmo. I like how you used thrusters instead of just using applyForce.

    I'd like a video of it in action.


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  5. #5
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Fetching Box

    That's a nice one
    Take the suggestion from above to improve.

    Remove 4 thrusters from the back, instead increase the weight of the middle one a bit.
    ( Less thrusters means a lot less lag )
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  6. #6
    Wire Noob Shlimmy's Avatar
    Join Date
    Jun 2009
    Posts
    4

    Default Re: Fetching Box

    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?

  7. #7
    Wire Amateur Vivid's Avatar
    Join Date
    Apr 2008
    Location
    The most boring town in Sweden
    Posts
    98

    Default Re: Fetching Box

    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

  8. #8
    Wire Noob Shlimmy's Avatar
    Join Date
    Jun 2009
    Posts
    4

    Default Re: Fetching Box

    hrm a bit confused on the syntax of entities and entity discovery

    here is an example expression from the wiki
    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()
    say I wanted it to instead track my location, how would I do that?

    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

  9. #9
    Wirererer adeeda's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    135

    Default Re: Fetching Box

    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.

  10. #10
    Wire Sofaking ryland's Avatar
    Join Date
    Oct 2009
    Location
    Card bord box next to wal-mart.
    Posts
    594

    Default Re: Fetching Box

    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

+ Reply to Thread
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots