+ Reply to Thread
Page 3 of 75 FirstFirst 123451353 ... LastLast
Results 21 to 30 of 749
Like Tree5Likes

Thread: Cronus: The Ultimate Drone

  1. #21
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: Cronus: The Ultimate Drone

    E = Potents:entity(Check)

    Check is still 0, the array starts at 1.
    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.

  2. #22
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Cronus: The Ultimate Drone

    And that still doesn't solve the issue, it's now in the find.LUA, but says it expects a table.

  3. #23
    Wire Noob bluedragon11200's Avatar
    Join Date
    May 2009
    Posts
    10

    Default Re: Cronus: The Ultimate Drone

    I wish i was good enough in E-2 to even help out. Though at least I can somewhat read the code

    Just one more reason why I have to get better at E-2 ....

  4. #24
    Wire Sofaking BlackholeWM's Avatar
    Join Date
    Dec 2008
    Posts
    805

    Default Re: Cronus: The Ultimate Drone

    EPIC!

    I have to see a vid of this when it is finished.

  5. #25
    Lifetime Supporter rich_27's Avatar
    Join Date
    Aug 2007
    Location
    findByUser("rich_27"):pos()
    Posts
    224

    Default Re: Cronus: The Ultimate Drone

    Wow! This project is amazing, and I have already learnt quite a lot just reading through the code!

  6. #26
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Cronus: The Ultimate Drone

    Anything that's wrong with the body part finding code at the moment must be something with the LUA, because I've tried hard to sequentially remove each and every entity discovery function past the sphere and the error remains, even down to using findResult(Check) and removing the findSortByDistance(), it just sticks around for some reason.

    There's only one table in the entire code and not once does any table interact with the entity discovery functions.

  7. #27
    Wire Sofaking Vbitz's Avatar
    Join Date
    Feb 2009
    Location
    NZ
    Posts
    685

    Default Re: Cronus: The Ultimate Drone

    your little pet will destroy all servers, well done i want one. oh can it wire with any contraption like with a sort of interface part. and anyway wired wirers are rare, try a body part networking system, it will be easyer and will cause cahos on all servers, long live cronus

  8. #28
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Cronus: The Ultimate Drone

    Body part networking system?

    Care to elaborate on that?

  9. #29
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: Cronus: The Ultimate Drone

    Can you post your current code?
    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.

  10. #30
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Cronus: The Ultimate Drone

    Okay, developments with the prop finding code. Recent alterations in the find.lua seem to have cured the error I was getting so I've been forging ahead in perfecting it.

    This works for the most part, but an arm and a leg aren't getting assigned (Typically I'm seeing Arm1 and Leg2) and whilst I could cancel out the duplicate assignments with a simple Potents:remove(Check) line it seems to negate any of the parts being assigned for some reason.[highlight=E2]@name Cronus body part finder
    @outputs SiD TiD PiD A1iD A2iD L1iD L2iD
    @persist O:entity C:entity Body:table GT
    @persist Search Pierre:string Part Potents:array Pos Check
    @persist Flip Switch
    @persist Skull:entity Torso:entity Pelvis:entity
    @persist Arm1:entity Arm2:entity Leg1:entity Leg2:entity

    if(first()){
    O = owner()
    C = entity()

    GT = 10

    #Setting body part box preferentials
    Body:setVector("Skull",vec(17,14,15))
    Body:setVector("Torso",vec(36,36,1))
    Body:setVector("Pelvis",vec(19,19,6))
    Body:setVector("Arm",vec(24,24,12))
    Body:setVector("Leg",vec(10,10,43))

    #Running initial prop search
    findInSphere(Cos(),1000)
    findClipToClass("prop_physics")
    findSortByDistance(Cos())

    Potents = findToArray()
    Check = 1
    Flip = 1}

    #Entity discovery flipswitch
    if(Flip){
    timer("playerED",findPlayerUpdateRate())
    timer("chipED",findUpdateRate())
    if(clk("playerED")){Switch++}
    if(clk("chipED")){Switch++}
    if(Switch == 2){
    Switch = 0
    Flip = 0}}

    runOnChat(1)
    #Initiating a new area check for body props
    if(O:lastSaid() == "!body check" & chatClk(O) & !Flip){
    findInSphere(Cos(),1000)
    findClipToClass("prop_physics")
    findSortByDistance(Cos())

    Potents = findToArray()
    Flip = 1}

    #Changing the give/take value
    if(O:lastSaid():lower():left(3) == "!gt" & chatClk(O)){
    Mes = O:lastSaid():lower()
    GT = Mes:right(Mes:length()-4):toNumber()}

    #Checking for missing body parts
    timer("bod_check",10)
    if(clk("bod_check")){
    if(!Skull){Pierre = "Skull", Part = 0}
    elseif(!Torso){Pierre = "Torso", Part = 1}
    elseif(!Pelvis){Pierre = "Pelvis", Part = 2}
    elseif(!Arm1){Pierre = "Arm",Part = 3}
    elseif(!Arm2){Pierre = "Arm",Part = 4}
    elseif(!Leg1|!Leg2){Pierre = "Leg", Part = 5}
    elseif(!Leg2){Pierre = "Leg", Part = 6}
    Search = 1}

    #Checking the props
    if(Search){
    runOnTick(1)
    E = Potents:entity(Check)
    if(tickClk()){
    if(!E:isFrozen() & E:hasConstraints() == 0){
    #Prop box elements
    Box = E:boxSize()
    L = Box:x()
    W = Box:y()
    H = Box:z()
    #Part box elements
    Bod = Body:vector(Pierre)
    BodX = Bod:x()
    BodY = Bod:y()
    BodZ = Bod:z()

    #Box element comparison
    if(L < BodX+GT & L > BodX-GT){Pos++}
    if(W < BodY+GT & W > BodY-GT){Pos++}
    if(H < BodZ+GT & H > BodZ-GT){Pos++}

    if(Pos == 3){
    #Prop to body part assignment
    if(!Part){Skull = E}
    elseif(Part == 1){Torso = E}
    elseif(Part == 2){Pelvis = E}
    elseif(Part == 3){Arm1 = E}
    elseif(Part == 4){Arm2 = E}
    elseif(Part == 5){Leg1 = E}
    elseif(Part == 6){Leg2 = E}
    Search = 0
    Check = 1}
    else{
    Pos = 0
    if(Check != Potents:count()){Check++}
    else{
    Search = 0
    Check = 1}}}
    elseif(Check != Potents:count()){Check++}
    else{
    Search = 0
    Check = 1}}}

    #Body part ID output
    timer("bpart_id",10)
    if(clk("bpart_id")){
    SiD = Skull:id()
    TiD = Torso:id()
    PiD = Pelvis:id()
    A1id = Arm1:id()
    A2iD = Arm2:id()
    L1iD = Leg1:id()
    L2id = Leg2:id()}[/highlight]I also broke the code up a bit and added some comments for comprehension. I've found it easier also to wrap large bundles of code in an if statement rather than add things like " & tickClk()" to them, which reduces readibility but makes it easier to understand where it is readable...I think.

    And here's a quick idea for some efficiency improving:

    Currently, we get the occasional find event and cut it to fit what is presently needed, and then have to wait a little bit to get a new event.

    To improve efficiency, how about we make a full basic findInSphere(N,V), followed by the usual findSortByDistance(V), and findToArray() and then filter them in a looping code section into different arrays (NPCs, Players, and Props, etc.). Each time there's a new find event, the arrays are emptied and then restocked. That way, we get the biggest bang for our buck from each find event, though it takes slightly longer to respond.

    So a way this might work could be using a Props array, an NPCs array, and a Players array:[highlight=E2]#Emptying arrays
    Plays = NPCs = Props = array()

    #Find event
    findInSphere(1000,Chipos())
    findSortByDistance(Chipos())
    Find = findToArray()
    SortFind = 1

    #Sorting
    if(SortFind){
    timer("find_sort",10)
    if(clk("find_sort")){
    Ent = Find:entity(Check)
    if(Ent:isPlayer){Plays:setEntity(Plays:count()+1,E nt}
    elseif(Ent:isNPC){NPCs:setEntity(NPCs:count()+1,En t}
    elseif(Ent:class() == "prop_physics"){ #Prop class entity that isn't already a body part
    if(Ent:id() != Skull:id() & Ent:id() != Torso:id() & Ent:id() != Pelvis:id() &
    Ent:id() != Leg1:id() & Ent:id() != Leg2:id() &
    Ent:id() != Arm1:id() & Ent:id() != Arm2:id()){
    Props:setEntity(Props:count()+1,Ent}}
    if(Check != Find:count()){Check++}
    else{SortFind = 0,Check = 1,Find = array()}}}[/highlight]
    Last edited by Lyinginbedmon; 06-07-2009 at 04:02 AM.

    The Olympus Technologies drones, totally not SkyNet in Gmod form.
    Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
    The gBrain Project, the drone controls system that thinks it's better than you

+ Reply to Thread
Page 3 of 75 FirstFirst 123451353 ... LastLast

LinkBacks (?)

  1. 03-01-2010, 04:44 PM
  2. 02-02-2010, 03:00 PM

Similar Threads

  1. Ultimate Rave Machine
    By Error 404 in forum Finished contraptions
    Replies: 11
    Last Post: 04-20-2009, 06:46 PM
  2. The ultimate commanders chair
    By Shadow7 in forum Ideas & Suggestions
    Replies: 7
    Last Post: 02-11-2009, 10:03 AM
  3. Ultimate Gmod Pack
    By -Gamah in forum Off-Topic
    Replies: 21
    Last Post: 08-28-2008, 05:37 AM

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