+ Reply to Thread
Results 1 to 10 of 10

Thread: [Helo] E2 Chat command

  1. #1
    Wire Noob yuriman's Avatar
    Join Date
    Feb 2009
    Posts
    23

    Cool [Helo] E2 Chat command

    how do you make so the expression 2 gate picks upp chat commands like

    !open 1 to ex open a door or
    !dial ABCDEFG to dial with a gate from chat

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

    Default Re: [Helo] E2 Chat command

    runOnChat(1) and lastSaid()

    Look under Chat in the wiki.

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

    Default Re: [Helo] E2 Chat command

    If I understood correctly, you are looking for it to recognize a command then take a sub-string of that as input. The way to do this is:

    [highlight=e2]
    @outputs Door
    @persist LastSaid:string Open
    runOnChat(1)
    LastSaid=owner():lastSaid()
    if(LastSaid:left(5)=="!open") {Open=LastSaid:sub(7,Text:length()):toNumber()}
    if(Open) {Door=1} else {Door=0}
    [/highlight]

    This is saying first of all that LastSaid is the last thing that the chip's owner said. Then it says with the
    [highlight=e2]
    if(LastSaid:left(5)=="!open")
    [/highlight]
    that if the first 5 characters from the left of LastSaid are !open, then do the next action which is
    [highlight=e2]
    {Open=LastSaid:sub(7,Text:length()):toNumber()}
    [/highlight]
    This says that Open equals the sub-string from character 7 to the end of the text. If you were to type !open 1 then Open would equal 1, if you were to type !open 574263 then open would equal 574263. Hope this helped.

  4. #4
    billywitchdoctor.com Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    Default Re: [Helo] E2 Chat command

    Why has everyone coppied my chat dialing stargate?

  5. #5
    Wirererer malum's Avatar
    Join Date
    Feb 2009
    Posts
    217

    Default Re: [Helo] E2 Chat command

    I prefer explode(" ") anyway -_-

  6. #6
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: [Helo] E2 Chat command

    Quote Originally Posted by Whosdr View Post
    Why has everyone coppied my chat dialing stargate?
    What? That was only me. :P This guy probably didn't even know you had one.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  7. #7
    Wire Noob yuriman's Avatar
    Join Date
    Feb 2009
    Posts
    23

    Default Re: [Helo] E2 Chat command

    i saw one on garrysmod.org http://www.garrysmod.org/downloads/?a=view&id=68419
    thanks i will try

  8. #8
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: [Helo] E2 Chat command

    Quote Originally Posted by yuriman View Post
    i saw one on garrysmod.org Chat Controlled Stargate Download!
    thanks i will try
    Well mine's better. And Whosdr's too.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  9. #9
    Wire Noob yuriman's Avatar
    Join Date
    Feb 2009
    Posts
    23

    Default Re: [Helo] E2 Chat command

    i cant make the E2 work when im writing
    !door 1 the output wont change

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

    Default Re: [Helo] E2 Chat command

    Quote Originally Posted by yuriman View Post
    i cant make the E2 work when im writing
    !door 1 the output wont change
    Please explain further. Do you mean to say that when you place the chip and you say your command the output value will not change? Maybe you forgot to put the strings in quotes, or maybe you forgot to make your output equal your persist. Make sure runOnChat(1) is in there.

+ Reply to Thread

Similar Threads

  1. Chat help please :)
    By ArmyofOne in forum Expression 2 Discussion & Help
    Replies: 10
    Last Post: 04-16-2009, 08:52 PM
  2. E2 Chat activation
    By warrior08 in forum Expression 2 Discussion & Help
    Replies: 7
    Last Post: 04-15-2009, 05:04 PM
  3. CPU Chat System Help
    By Zachar543 in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 5
    Last Post: 08-08-2008, 01:02 AM
  4. Chat Sensors
    By Pete in forum Ideas & Suggestions
    Replies: 7
    Last Post: 04-11-2007, 06:29 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