+ Reply to Thread
Results 1 to 10 of 10

Thread: Issues with first() and duped()

  1. #1
    Wire Amateur thirty9th is on a distinguished road thirty9th's Avatar
    Join Date
    Nov 2007
    Posts
    70

    Default Issues with first() and duped()

    Hey guys, having a few more minor issues with my drone project.

    In my efforts to optimize my code, I have found that putting running things when the chip is duped or on first() completely breaks the whole thing.

    For instance, this code works perfectly, printing the message whenever I spawn or update the code.

    e2 Code:
    1. ##### INITIAL #####
    2. if (first() | duped()) {
    3. print("(+++) 39BOT SYSTEMS ACTIVATED")
    4. print("(+++) DESIGNED AND PROGRAMMED BY SIR. 39")
    5. print("(+++) PLEASE ENJOY YOUR EXPERIENCE")
    6. }
    7. runOnTick(1)
    8. E = entity():isWeldedTo()
    9. Owner = E:owner()
    10. E:setMass(5)

    However, this code will still print the message, but will NOT set runOnTick, E, Owner or perform setMass.

    e2 Code:
    1. ##### INITIAL #####
    2. if (first() | duped()) {
    3. print("(+++) 39BOT SYSTEMS ACTIVATED")
    4. print("(+++) DESIGNED AND PROGRAMMED BY SIR. 39")
    5. print("(+++) PLEASE ENJOY YOUR EXPERIENCE")
    6. runOnTick(1)
    7. E = entity():isWeldedTo()
    8. Owner = E:owner()
    9. E:setMass(5)
    10. }

    Can only certain functions be performed in first() or duped()?

    It seems to me quite inefficient to continually set runOnTick and define the other entities, and I would like to only do it once, when the chip is spawned or refreshed. However, some error here is making that impossible.

  2. #2
    Wire Sofaking Wizard of Ass has a spectacular aura about Wizard of Ass has a spectacular aura about Wizard of Ass's Avatar
    Join Date
    May 2009
    Location
    Germany Bremerhaven
    Posts
    1,068

    Default Re: Issues with first() and duped()

    ...
    e2 Code:
    1. ##### INITIAL #####
    2. if (first() | duped()) {
    3. print("(+++) 39BOT SYSTEMS ACTIVATED")
    4. print("(+++) DESIGNED AND PROGRAMMED BY SIR. 39")
    5. print("(+++) PLEASE ENJOY YOUR EXPERIENCE")
    6. runOnTick(1)
    7. E = entity():isWeldedTo()
    8. Owner = E:owner()
    9. E:setMass(5)
    10. }

    Can only certain functions be performed in first() or duped()?

    It seems to me quite inefficient to continually set runOnTick and define the other entities, and I would like to only do it once, when the chip is spawned or refreshed. However, some error here is making that impossible.
    I think you can only run timers and intervals in a if(first())
    just put the runOnTick under the if(first()) statement.
    Otherwise it will only runOnTick in the first time the e2 gets executed that means it only will be executed once...

  3. #3
    Wirererer SoundKiller777 is on a distinguished road SoundKiller777's Avatar
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    186

    Default Re: Issues with first() and duped()

    The problem involving the variables may be that they have not been defined on either the @outputs or @persist line, apologies if they have I couldn't see it in the code you supplied.

  4. #4
    Wire Amateur thirty9th is on a distinguished road thirty9th's Avatar
    Join Date
    Nov 2007
    Posts
    70

    Default Re: Issues with first() and duped()

    Thanks, Wizard. Your suggestion fixed it.

    Yea, Sound, I did define all the variables properly.

    Thanks for the suggestion, though.

  5. #5
    Wirererer SoundKiller777 is on a distinguished road SoundKiller777's Avatar
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    186

    Default Re: Issues with first() and duped()

    Apologies, didn't mean to insult your skills just checking.

  6. #6
    Wire Amateur thirty9th is on a distinguished road thirty9th's Avatar
    Join Date
    Nov 2007
    Posts
    70

    Default Re: Issues with first() and duped()

    Hehe, didn't mean it that way.

  7. #7
    Lurker pl0x is an unknown quantity at this point pl0x's Avatar
    Join Date
    Aug 2008
    Posts
    247

    Default Re: Issues with first() and duped()

    runOnTick(1) does work in a first() or duped() if statement, idk why it wasn't working for you though.

  8. #8
    Wire Sofaking nescalona is on a distinguished road nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,335

    Default Re: Issues with first() and duped()

    Seems to me that runOnTick(1) should ONLY be used if (first() | duped()).

  9. #9
    Wirezard

    Matte is just really nice Matte is just really nice Matte is just really nice Matte is just really nice Matte is just really nice Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,151

    Default Re: Issues with first() and duped()

    Why? The people who do it, do it mostly because its no need set runOnTick() to one each execution.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr


    Wire FPGA

  10. #10
    Wire Sofaking nescalona is on a distinguished road nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,335

    Default Re: Issues with first() and duped()

    Right, that's what I mean.

+ Reply to Thread

Similar Threads

  1. Wire Explosives Exploding when duped
    By ICDWILL117 in forum Technical Support
    Replies: 4
    Last Post: 08-18-2008, 02:53 AM
  2. Wire Tools working when Adv. Duped?
    By Cpt. Archie in forum Wiremod Lua Coding
    Replies: 5
    Last Post: 06-29-2008, 05:35 PM
  3. Duped weld latches won't work
    By Kirk in forum Bug Reports
    Replies: 10
    Last Post: 06-16-2008, 10:20 PM
  4. Duped weld latches wont work
    By kebab123 in forum Bug Reports Archive
    Replies: 0
    Last Post: 02-08-2008, 07:39 AM
  5. My Holo Emitters arent getting duped!
    By tstorlien in forum Technical Support
    Replies: 0
    Last Post: 09-01-2007, 05:31 PM

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