+ Reply to Thread
Results 1 to 10 of 10

Thread: Getting Find() and Chat Commands To Work

  1. #1
    Wire Noob Alchemise's Avatar
    Join Date
    Oct 2008
    Posts
    18

    Default Getting Find() and Chat Commands To Work

    Okay, so I can't for the life of me figure out why it wont work. Heres the code:

    Code:
    @name Text Parse Test
    @inputs 
    @outputs Player:string Tpos:vector Target:entity
    @persist Target:entity PlayerTest:string
    interval(10)
    if((lastSaid():find("Give Cube"))){
    Player = lastSaid():sub(10, 20)
    }
    if(!Target){
    findPlayerByName(Player)
    Target = find()}
    
    Tpos = Target:pos()
    Its picking up the player name correctly, but the find function wont work. It refuses to find anything =/

    Any ideas?

  2. #2
    Banned Nicolai1's Avatar
    Join Date
    Nov 2008
    Location
    Denmark.
    Posts
    1,251

    Default Re: Getting Find() and Chat Commands To Work

    Quote Originally Posted by Alchemise View Post
    Okay, so I can't for the life of me figure out why it wont work. Heres the code:

    Code:
    @name Text Parse Test
    @inputs 
    @outputs Player:string Tpos:vector Target:entity
    @persist Target:entity PlayerTest:string
    interval(10)
    if((lastSaid():find("Give Cube"))){
    Player = lastSaid():sub(10, 20)
    }
    if(!Target){
    findPlayerByName(Player)
    Target = find()}
    
    Tpos = Target:pos()
    Its picking up the player name correctly, but the find function wont work. It refuses to find anything =/

    Any ideas?
    Uhh, I would guess you need to change the if(!Target){ line to
    if(!Target & $Target){
    Also, sometimes the $Target don't work, just multiply it

  3. #3
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: Getting Find() and Chat Commands To Work

    Quote Originally Posted by Nicolai1 View Post
    Uhh, I would guess you need to change the if(!Target){ line to
    if(!Target & $Target){
    Also, sometimes the $Target don't work, just multiply it
    You can't use $Target, it's an entity, it should be "~".
    And $Target wouldn't work either way, input deltas are always non-zero.


    Anyway, same as always, add some outputs to make sure you properly got an entity, output when it finds something, etc, etc, etc.
    (Which find()-function doesn't work?)

  4. #4
    Wire Noob Alchemise's Avatar
    Join Date
    Oct 2008
    Posts
    18

    Default Re: Getting Find() and Chat Commands To Work

    Well if Target is picked up as a proper enter, the vector Tpos will output its coords, which it doesn't. Stays stuck at the origin.

    I've tried trigger the if by an input instead to no avail, and using a constant string instead of a variable.

    Is there something wrong with me find lines?

    Code:
    findPlayerByName(Player)
    Target = find()
    Is that enough to get the entity of a player?

  5. #5
    Wire Noob Alchemise's Avatar
    Join Date
    Oct 2008
    Posts
    18

    Default Re: Getting Find() and Chat Commands To Work

    Ahh, apperently

    findPlayerByName(S)

    doesn' work. Used different terms and it worked.

    Thanks for the replies guys.

  6. #6
    Wire Sofaking Echo51's Avatar
    Join Date
    Feb 2009
    Location
    Denmark
    Posts
    1,489

    Default Re: Getting Find() and Chat Commands To Work

    if(owner():lastSaid() == "test"){#do my ass off}

    thats what i use, probaly a bit wrong, but check the manual
    Proud of my non-existant life...
    In russia, Expression 2 codes you!
    Quote Originally Posted by Snowden42 View Post
    Nooblishious? That's a signature keeper.

  7. #7
    Wire Sofaking Solece's Avatar
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA
    Posts
    673

    Default Re: Getting Find() and Chat Commands To Work

    im trying to do the same thing you are, and i am also frustrated by failure.
    Code:
    @name Companion cube v1
    @inputs 
    @outputs 
    @persist Ep:vector Commandpos:string
    @trigger all
    interval(10)
    E=entity()
    Commandb=owner():lastSaid()
    Command=owner():lastSaid():sub(1,7)
    Commandpos=owner():lastSaid():sub(8,Commandb:length())
    Et=findPlayerByName(Commandpos)
    
    if (Command=="Follow "){
    E:applyForce(Et:pos()+vec(0,0,140)-entity():pos()-E:vel()*0.1)
    }
    Can anyone help?

  8. #8
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: Getting Find() and Chat Commands To Work

    What's happening?
    As always, output debug stuff and try to figure out what's (not) happening.

  9. #9
    Wire Sofaking Solece's Avatar
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA
    Posts
    673

    Default Re: Getting Find() and Chat Commands To Work

    Quote Originally Posted by Syranide View Post
    What's happening?
    As always, output debug stuff and try to figure out what's (not) happening.
    Thats just the thing, there are no outputs or inputs, so there really isnt a way to debug.
    oh and the error is right here:
    Code:
    E:applyForce(Et:pos()+vec(0,0,140)-entity():pos()-E:vel()*0.1)
    Right between applyForce and (Et, it says im missing a bracket, but im not.

  10. #10
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: Getting Find() and Chat Commands To Work

    Quote Originally Posted by haloguy922 View Post
    Thats just the thing, there are no outputs or inputs, so there really isnt a way to debug.
    oh and the error is right here:
    Code:
    E:applyForce(Et:pos()+vec(0,0,140)-entity():pos()-E:vel()*0.1)
    Right between applyForce and (Et, it says im missing a bracket, but im not.
    No... but add outputs, and assign parts of what your expression does to output to those outputs. Like the different substrings, vectors, etc, etc. Whether it enters certain if-statements, etc, etc.

+ Reply to Thread

Similar Threads

  1. find**** commands in Expression Gate 2
    By splat2010 in forum Bug Reports
    Replies: 1
    Last Post: 12-14-2008, 07:31 AM
  2. 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
  3. & and Or commands don't work in expressions
    By Xtensity in forum Installation and Malfunctions Support
    Replies: 23
    Last Post: 05-11-2008, 04:52 PM
  4. Can't find/ Won't work Wire Mod
    By Chaosye in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 10-21-2007, 11:53 PM
  5. 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