+ Reply to Thread
Results 1 to 7 of 7

Thread: Numbers to Screen? Help please

  1. #1
    Wire Noob xljplx's Avatar
    Join Date
    Dec 2009
    Posts
    17

    Post Numbers to Screen? Help please

    ok well im trying to make a chip that does this

    when i say a number (1-999999999) it will display it on the Screen.

    heres what i have so far, but somone told me im doing it wrong.

    someone help? please? D:

    oh and if someone can make me a chip that does the same but on a textscreen (with words)
    Code:
    @name -screen inc/dec
    @inputs 
    @outputs Screen
    @persist 
    @trigger 
    runOnChat(1)
    
    if(owner():lastSaid() == "reset")
    { Screen = 0
    }
    
    if(owner():lastSaid() == "1")
    { Screen = 1
    }
    
    if(owner():lastSaid() == "2")
    { Screen = 2
    }
    
    if(owner():lastSaid() == "3")
    { Screen = 3
    }
    
    if(owner():lastSaid() == "4")
    { Screen = 4
    }
    
    if(owner():lastSaid() == "5")
    { Screen = 5
    }
    
    if(owner():lastSaid() == "6")
    { Screen = 6
    }
    
    if(owner():lastSaid() == "7")
    { Screen = 7
    }
    
    if(owner():lastSaid() == "8")
    { Screen = 8
    }
    
    
    if(owner():lastSaid() == "9")
    { Screen = 9
    }
    
    if(owner():lastSaid() == "10")
    { Screen = 10
    }


    Owner of FlashBang Gaming

  2. #2
    Lifetime Supporter Nikita's Avatar
    Join Date
    May 2009
    Posts
    769

    Default Re: Numbers to Screen? Help please

    This code should just feel wrong because when there is something you have to repeat with little or no change, there is probably a function to make it shorter.

    In this case, there exists a function called S:toNumber() that will convert a text string to a number.

    Also, you should use lastSpoke() == owner() so that the expression only runs when a the player who said something is the owner.

  3. #3
    Wire Noob xljplx's Avatar
    Join Date
    Dec 2009
    Posts
    17

    Default Re: Numbers to Screen? Help please

    can you write the expression code? :l


    Owner of FlashBang Gaming

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

    Default Re: Numbers to Screen? Help please

    We don't hand out code here, try it yourself, then if you mess up come back here, show us what you have and tell us what went wrong. Then we'll help you out.

    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

  5. #5
    Wire Noob xljplx's Avatar
    Join Date
    Dec 2009
    Posts
    17

    Default Re: Numbers to Screen? Help please

    well im new to e2 and i would liek to find out how to this.


    Owner of FlashBang Gaming

  6. #6
    Wire Noob xljplx's Avatar
    Join Date
    Dec 2009
    Posts
    17

    Default Re: Numbers to Screen? Help please

    oh and i did try the code thats why i put it up.

    and i didnt understand what the other guy said.


    Owner of FlashBang Gaming

  7. #7
    Wire Amateur BrownMasterV's Avatar
    Join Date
    Nov 2009
    Location
    U.S.A.
    Posts
    42

    Default Re: Numbers to Screen? Help please

    When you have runOnChat, you need chatClk() for the chip to be able to update
    Also, to make the code much simpler (you don't need all the if-statements) , just use toNumber, which converts whatever your lastSaid was to a number.
    Try this:
    Code:
    @outputs Screen
    runOnChat(1)
    if(chatClk()) {
        if(owner():lastSaid()=="reset") {
            Screen = 0
        }
        else {
            Screen = owner():lastSaid():toNumber()
        }
    }
    Tested, works.

+ 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