/lookup [player]

Discussion in 'Server and Client Scripting' started by supertrunks8, Sep 18, 2011.

  1. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    I made a command to show you the info of a Player.

    Note: the player must online. *

    lets say i do /lookup Huria

    it would show
    Code (text):
    1.  
    2. (17:15:43) *** Huria's Infomation ***
    3. (17:15:43) Trainer Name: Huria
    4. (17:15:43) Name Color: #aa00ff
    5. (17:15:43) IP Address: 127.0.0.1
    6. (17:15:43) Auth Level: 3
    7. (17:15:43) ID: 33
    8. (17:15:43) Alts: nesan,pokégerman,huria,huriax
    9. (17:15:43) Clauses: 72
    10. (17:15:43) Rating: 1000
    11. (17:15:43) Current Tier: LC Wifi
    12. (17:15:43) Gen: 5
    13. (17:15:43) Battling: false
    14. (17:15:43) Enabled Ladder: true
    15. (17:15:43) Registered: true
    16. (17:15:43) Highest Auth: 3
    17.  
    yeah a pretty cool command c:

    the javascript command:

    Code (javascript):
    1.  
    2. if(command == "lookup") {
    3. var ip = sys.ip(tar);
    4. var alts = sys.aliases(ip);
    5. var tier = sys.tier(tar);
    6. if (tar == undefined) {
    7. sys.sendMessage(src, "+Bot: Sorry, this person doesn't exist!");
    8. return;
    9. }
    10. sys.sendMessage(src, "*** " + commandData + "'s Infomation *** ");
    11. sys.sendMessage(src, "Trainer Name: " + commandData + " ");
    12. sys.sendMessage(src, "Name Color: " + sys.getColor(tar) + " ");
    13. sys.sendMessage(src, "IP Address: " + sys.ip(tar) + " ");
    14. sys.sendMessage(src, "Auth Level: " + sys.auth(tar) + " ");
    15. sys.sendMessage(src, "ID: " + sys.id(sys.name(tar)) + " ");
    16. sys.sendMessage(src, "Alts: " + alts + " ");
    17. sys.sendMessage(src, "Clauses: " + sys.getClauses(tar) + " ");
    18. sys.sendMessage(src, "Rating: " + sys.ladderRating(tar) + " ");
    19. sys.sendMessage(src, "Current Tier: " + sys.tier(tar) + " ");
    20. sys.sendMessage(src, "Gen: " + sys.gen(tar) + " ");
    21. sys.sendMessage(src, "Battling: " + sys.battling(tar) + " ");
    22. sys.sendMessage(src, "Enabled Ladder: " + sys.ladderEnabled(tar) + " ");
    23. sys.sendMessage(src, "Registered: " + sys.dbRegistered(sys.name(tar)) + " ");
    24. sys.sendMessage(src, "Highest Auth: " + sys.maxAuth(sys.ip(tar)) + " ");
    25. return;
    26. }
    27.  
    so yeah hope you guys like it :D

    Feel free to command.
     
  2. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Why have clauses...?
     
  3. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Idk it's just another little info on the player ._. or well team.
     
  4. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Can't you just create one thread for all of these?
    Its very annoying.
     
  5. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    wait wat? whats annoyin?
     
  6. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    TUO proposes you to make a thread like "-Arceus-'s scripting snippets & commads" instead of making a new thread for everything.

    I'm fine with either.

    And on topic:
    Good command, similar to PO's /whois. You might want to reuse your "ip" variable instead of calling sys.ip three times, because you already stored it – it's just a nitpick, there's no need to make it a variable if you are just going to call sys.ip every time you need the ip address.
     
  7. Kalashnikov

    Kalashnikov Despite the code quality

    Joined:
    Apr 4, 2011
    Messages:
    434
    Likes Received:
    0
    What's the point of spaces at the ends of the lines?
    You might want to show the actuall colour instead of its hex representation and actual clauses instead of the vector (learn about bit-wise operators)
    And I don't think this info should be shown to every user.
     
  8. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Oh sorry for not creating 1 thread for all of this. Next time i will just make 1thread for like 3-4 commands/thingys.
     
  9. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    sys.getClauses() returns the clauses of the parameter tier, if you pass it a user ID the behavior is undefined.
     
  10. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    I agree with TUO, adding clauses in it is just a waste of space. You'll see someone's clauses when they challenge you, you don't really need another way to see their clauses.
     
  11. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    It was already pointed out by coyotte that .getClauses(id) doesn't do anything meaningless.
     
  12. Morty.

    Morty. Learning Scripting

    Joined:
    Jan 12, 2014
    Messages:
    32
    Likes Received:
    0
    PO Trainer Name:
    Morty
    Script Error line 6019: SyntaxError: too few arguments in call to tier(); candidates are
    tier(int,int)
    <anonymous>(src = 593, message = '/lookup w a r r', chan = 0) at scripts.js:6019
    <global>() at -1

    :c does not work
     
  13. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    This was written for the old version for PO.
    The sys.tier argument takes two arguments now (as it says).
    sys.tier(id, team)
    You need to edit the script slightly to accommodate that. Easiest way is just replace sys.tier(tar) with sys.tier(tar, 0)
    It'll only return tier for the first team in this case, but it'll work at least.
    If you want more teams, you'll have to do a bit more editing.
     
  14. Morty.

    Morty. Learning Scripting

    Joined:
    Jan 12, 2014
    Messages:
    32
    Likes Received:
    0
    PO Trainer Name:
    Morty
    q.q I just change what you said. I dont know anything about scripting :/ only what I have learned by myself.
    BTW :/ do you know of someone who can teach me a bit?