+ Reply to Thread
Results 1 to 9 of 9

Thread: Need someone to perfect my security system [E2 Semi-Beginner]

  1. #1
    Wire Noob icedout's Avatar
    Join Date
    Jul 2010
    Posts
    5

    Question Need someone to perfect my security system [E2 Semi-Beginner]

    Ok well.. I haven't made a post on Wiremod forum ever so yeah.. Well anyway I am new to E2 and I saw a tut on youtube on how to make a toggle-able security system but he used an add chip, greater than chip, and an multiply chip. So I was like "Hey.. A new project!" So what I did was transform that into 1 E2 chip and made it to where "/on" activates it and "/off" deactivates it. So I thought it was pretty neat.. But I also wanted hints to show up telling u how to use it well.. thats where I'm lost.. When it's spawned, everything is great, but when I die, it spams the hints 3 times.. As a beginner I need someone to tell me what i did wrong >< Any help is greatly appreciated. Thanks in advance!

    Code:
    @name Security Chip
    @inputs Ranger1 Ranger2 Ranger3 Ranger4
    @outputs Explode Indicator
    interval(20)
    
    if(first()|duped()){
        Owner=entity():owner()
        F=Owner
        hint("~Security System~",10)
        hint("Type /on to Activate",10)
        hint("Type /off to Deactivate",10)
        hint("Made by Iced Out",10)
        gSetGroup("Security")
    }
    
    Add=Ranger1+Ranger2+Ranger3+Ranger4
    
    if (owner():lastSaid()=="/on") {Indicator=1}
    if (owner():lastSaid()=="/off") {Indicator=0}
    if (Indicator==1 & Add>0) {Explode=1}
    if (Indicator==1 & Add<0) {Explode=0}
    if (Indicator==0 & Add>0) {Explode=0}
    if (Indicator==0 & Add<0) {Explode=0}
    if (Indicator==0 & Add==0) {Explode=0}
    if (Explode==1 & Indicator==1) {reset()}
    -----------------------------------------------
    This was from another chip I had that
    I didn't code.. So I'm pretty sure that
    this is the problem area..
    -----------------------------------------------
    Code:
    if(first()|duped()){
        Owner=entity():owner()
        F=Owner
        hint("~Security System~",10)
        hint("Type /on to Activate",10)
        hint("Type /off to Deactivate",10)
        hint("Made by Iced Out",10)
        gSetGroup("Security")
    }
    ----------------------------------------------

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

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    reset() causes your chip to reset, and thus run the first statement again.
    Your lastsaid is still "/on" and you are still in the rangers. That's why it explodes again.

    Code:
    @name Security Chip
    @inputs Ranger1 Ranger2 Ranger3 Ranger4
    @outputs Explode Indicator Owner:entity
    # interval(20)                         <- pointless
    
    if(first()|duped()){
        Owner=entity():owner()
        runOnChat(1)
        # F=Owner                          <- pointless
        hint("~Security System~",10)
        hint("Type /on to Activate",10)
        hint("Type /off to Deactivate",10)
        hint("Made by Iced Out",10)
        # gSetGroup("Security")            <- pointless
    }
    
    if ( chatClk(Owner) ) {
        LastSaid = Owner:lastSaid()
        if ( LastSaid == "/on") {
            Indicator=1
        }
        elseif ( LastSaid == "/off") {
            Indicator=0
        }
    }
    
    Explode = 0
    
    if (Indicator) {
        Explode = ( Ranger1 | Ranger2 | Ranger3 | Ranger4 )
        Indicator = !Explode
    }
    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.

  3. #3
    Wire Noob icedout's Avatar
    Join Date
    Jul 2010
    Posts
    5

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Sorry that I didn't explain what I wanted to happen :P So basically I was trying to make it to where /on keeps it on even after people walk through it.. So lets say I walk through it and I die.. Now I can just walk right on through because it automatically deactivated. That't not what I intended. I was trying to make it to where if someone sets it off, the E2 resets itself so that it can still explode without me typing /on again and again. Just type in /on and it blows up everytime someone walks through until i type in /off. Sorry about not clarifying myself. Would be greatly appreciated if you could kindly tell me how to make it toggle like that. (if you understand what I mean lol.. Kinda confusing..) Thanks PS: I'm going to give you credit in the 'hints' part

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

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Code:
    @name Security Chip
    @inputs Ranger1 Ranger2 Ranger3 Ranger4
    @outputs Explode Indicator Owner:entity
    # interval(20)                         <- pointless
    
    if(first()|duped()){
        Owner=entity():owner()
        runOnChat(1)
        # F=Owner                          <- pointless
        hint("~Security System~",10)
        hint("Type /on to Activate",10)
        hint("Type /off to Deactivate",10)
        hint("Made by Iced Out",10)
        # gSetGroup("Security")            <- pointless
    }
    
    if ( chatClk(Owner) ) {
        LastSaid = Owner:lastSaid()
        if ( LastSaid == "/on") {
            Indicator=1
        }
        elseif ( LastSaid == "/off") {
            Indicator=0
        }
    }
    
    
    if (Indicator &  ( Ranger1 | Ranger2 | Ranger3 | Ranger4 ) ) {
        Explode = !Explode
    } 
    else {
        Explode = 0
    }
    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.

  5. #5
    Wire Noob RCT3Manie's Avatar
    Join Date
    Feb 2010
    Location
    The Netherlands
    Posts
    15

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Oke here is your solusion:

    Code:
    @name Security Chip
    @inputs Ranger1 Ranger2 Ranger3 Ranger4
    @outputs Explode Indicator
    @persist Add O:entity
    
    if(first()){
        O=entity():owner()
        hint("~Security System~",10)
        hint("Type /on to Activate",10)
        hint("Type /off to Deactivate",10)
        hint("Made by Iced Out",10)
        Delayer=curtime()
        runOnTick(1000)
        Indicator=0
        Explode=0
    }
    
    #This will create a loop
    if(tickClk()){
        Add=Ranger1+Ranger2+Ranger3+Ranger4 #Refresh the Add
        if(curtime()-Delayer>2){
            if (O:lastSaid()=="/on") {
                Indicator=1
                #Is there a /on ? Yes? Indicator=1
            }
            if (O:lastSaid()=="/off") {
                Indicator=0
                #Is there a /on ? No?
                #Is there a /off ? Yes? Indicator=0
            }
            Delayer=curtime() #Refresh the delayer
        }
    }
    
    
    
    if (Indicator==1 & Add>0) {Explode=1}
    elseif (Indicator==1 & Add<0) {Explode=0}
    elseif (Indicator==0 & Add>0) {Explode=0}
    elseif (Indicator==0 & Add<0) {Explode=0}
    elseif (Indicator==0 & Add==0) {Explode=0}
    elseif (Explode==1 & Indicator==1) { 
        Explode=0
        Add=0
        #Like a reset
    }
    if it's not good? sorry
    if it's in the good direction? Your welcome

    Edit:
    Bull you was faster xD
    Last edited by RCT3Manie; 08-21-2010 at 04:10 AM. Reason: Bull was faster xD

  6. #6
    Wire Noob icedout's Avatar
    Join Date
    Jul 2010
    Posts
    5

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    I love you.. lol.. anyways, thanks alot works great! Oh and btw, I use to just scan the forum and I always seen u and I was like wow.. anyways I was suprised when it was you that replied to my very first post. Made me feel good .

  7. #7
    Wire Noob RCT3Manie's Avatar
    Join Date
    Feb 2010
    Location
    The Netherlands
    Posts
    15

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Quote Originally Posted by icedout View Post
    I love you.. lol.. anyways, thanks alot works great! Oh and btw, I use to just scan the forum and I always seen u and I was like wow.. anyways I was suprised when it was you that replied to my very first post. Made me feel good .
    You mean bill then ^_^

  8. #8
    Wire Noob icedout's Avatar
    Join Date
    Jul 2010
    Posts
    5

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Lol yeah.. Didn't even notice u posted till just now :P Sorry about that.. Thanks anyways though

  9. #9
    Wire Noob RCT3Manie's Avatar
    Join Date
    Feb 2010
    Location
    The Netherlands
    Posts
    15

    Default Re: Need someone to perfect my security system [E2 Semi-Beginner]

    Quote Originally Posted by icedout View Post
    Lol yeah.. Didn't even notice u posted till just now :P Sorry about that.. Thanks anyways though
    Your welcome ^_^

+ Reply to Thread

Tags for this Thread

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