1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Guest, PO has ceased our separate tiering and adopted Smogon tiers for SM. More information and updates here.

    Dismiss Notice

[Client Scripting] Crystal's Client Scripts

Discussion in 'Server and Client Scripting' started by Crystal Moogle, Jul 31, 2012.

  1. Rehx

    Rehx Reaper of Justice

    Joined:
    Jun 21, 2012
    Messages:
    18
    Likes Received:
    0
    Well not entirely sure if the client script has anything to do with it, but I've just recently installed it on my client and now it seems I crash the second I log in.
     
  2. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    It happens to some people and I don't know why :<
    Just remove them then if it keeps happening.
     
  3. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    The client's functions weren't designed to be used with client scripts. You should validate almost everything with client.id, channelId, etc.
     
  4. Bamarah

    Bamarah "Baton Pass Elite"

    Joined:
    Oct 16, 2010
    Messages:
    344
    Likes Received:
    16
    I <3 this as it makes my client better! Thanks again Moogle!
     
  5. yalaa

    yalaa Mafia Theme Scripter

    Joined:
    Feb 9, 2012
    Messages:
    56
    Likes Received:
    1
    PO Trainer Name:
    x-yalaa-x
    Good scripts Crystal , i like it , continue like that ;)
     
  6. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    2.0.00 Script

    https://raw.github.com/CrystalMoogle/PO-User-Scripts/master/script.js

    Well I finally decided to finish up what I was working on and release 2.0.00!
    It needs the latest version of PO to fully work, some parts will work fine with 2.0.06/7, but it's best to just use 2.0.10.

    I've added a Pokédex command that lets you see details about a pokémon from within your client.
    It does what I feel is probably the most important, but if anyone has suggestions, then say so!
    Example screenshot:
    [​IMG][/HIDE]

    I added the ability to ignore challenges without going idle, something that was requested a lot when I first made this script

    I also greatly reduced the cluttered commandslist by putting most of them in their own sections. There's some more stuff I wanted to do with commands, but I thought it's best to just release it as is now.
    Example screenshot:
    [​IMG][/HIDE]

    I added the possibility for plugins later down the line if people want to make them. I don't really want to explain too much, but they work largely the same as PO server's plugins :x

    Probably some other things I've missed out too, but just play around with it a little and see :3


    EDIT: When you first update, you'll get a message saying something like "File not found, using old settings", that's normal, however, Kappu pm'd me saying his bot turned into undefinedundefined, if that happens, simply update again and it fixes it. I think that happens if you update through ~updatescripts rather than copy and pasting.
     
    Last edited: Jan 22, 2013
  7. Elements

    Elements BOOMER SOONER

    Joined:
    May 9, 2010
    Messages:
    1,195
    Likes Received:
    42
    PO Trainer Name:
    Elements
    excellent update! Thanks Crystal.
     
  8. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    After finally going through everything slowly, I found the cause of the crash some people were experiencing and it should be fixed now
    !
     
  9. Oh So Shoddy

    Oh So Shoddy Devil's Advocate

    Joined:
    Jul 19, 2011
    Messages:
    219
    Likes Received:
    0
    Some questions I had that others may be interested in

    (17:03) Oh So Shoddy: Help with scripts?
    (17:04) Aya: what's wrong
    (17:04) Oh So Shoddy: I should just c/p from the site right?
    (17:05) Aya: yes
    (17:05) Oh So Shoddy: Not updating though
    (17:05) Oh So Shoddy: Not that I can see
    (17:05) Aya: well try ~pokedex mismagius or something and see if it works
    (17:05) Oh So Shoddy: Oh
    (17:05) Oh So Shoddy: Crap
    (17:06) Oh So Shoddy: Was trying to do /pokedex
    (17:06) Oh So Shoddy: derp
    (17:06) Aya: lol[/HIDE]
    Be sure to use ~ (or whatever other symbol you've implemented) for script commands and not /

    (17:06) Oh So Shoddy: Uhmm
    (17:06) Oh So Shoddy: (12:05:53) ±iBOT: ERROR: SyntaxError: Unable to parse JSON string
    (17:06) Aya: !
    (17:06) Oh So Shoddy: Significant?
    (17:06) Aya: what did you do
    (17:06) Oh So Shoddy: It worked, but I got that
    (17:06) Aya: hm
    (17:06) Aya: do you get this line
    (17:06) Aya: Legal in tiers
    (17:07) Oh So Shoddy: Mhmm
    (17:07) Aya: weird
    (17:07) Oh So Shoddy: Maybe it was from a previous command I typed
    (17:07) Aya: hm, try doing it again
    (17:07) Oh So Shoddy: I'm doing it again but no trouble
    (17:07) Aya: yeah ok
    (17:07) Aya: i think it's the first time a player does it then
    (17:07) Oh So Shoddy: Ah[/HIDE]

    ~ignorechallenges on
    ±iBOT: You are ignoring all challenges

    (17:08) Oh So Shoddy: (12:08:44) ±iBOT: You are ignoring all challenges
    (17:08) Oh So Shoddy: How will this show?
    (17:09) Aya: It'll just say you're busy
    (17:09) Aya: same as if you were idle
    (17:09) Oh So Shoddy: Oh ok
    (17:09) Oh So Shoddy: Nice
    (17:09) Oh So Shoddy: I use Idle to signify actual idle/away
    (17:09) Oh So Shoddy: So this is cool[/HIDE]

    (17:16) Oh So Shoddy: Oh
    (17:17) Oh So Shoddy: What about the override in Tournaments where it unidles you
    (17:18) Oh So Shoddy: Will it do the same thing to ~ignorechallenges?
    (17:18) Aya: nope[/HIDE]
    Be sure to ~ignorechallenges off or challenge your opponent if you join any tour in #Tournaments

    (17:10) Oh So Shoddy: The scripts were moved from their last location?
    (17:10) Aya: no they're in the same place
    (17:10) Oh So Shoddy: 'cause ~updatescripts didn't work the first time
    (17:11) Oh So Shoddy: Fine now though
    (17:11) Aya: that happened to karppu too, idk why :x
    (17:11) Oh So Shoddy: ah
    (17:11) Oh So Shoddy: Well, all's well now[/HIDE]

    (17:12) Oh So Shoddy: Oh, one other thing
    (17:12) Oh So Shoddy: How does the "Legal in Tiers" determine the tiers?
    (17:12) Oh So Shoddy: Tiers.xml?
    (17:12) Aya: Yes
    (17:12) Oh So Shoddy: Ah
    (17:12) Oh So Shoddy: Froslass is being shown as legal in UU though
    (17:13) Aya: hm
    (17:13) Aya: guess it's slightly behind
    (17:16) Oh So Shoddy: Is there now way to organize tiers.xml a bit better?
    (17:16) Oh So Shoddy: Or would spaces/linebreaks mess it up?
    (17:16) Aya: Well most of it is auto-generated which is why it doesn't look too nice

    (12:20) Aya: btw, if you update again now, i added a way to force update tier info :x
    (12:21) Oh So Shoddy: You mean ~updatescripts?
    (12:21) Aya: yes
    (12:21) Aya: then you can use ~updatetierinfo which will show froslass correctly (and future bannings/unbannings)
    (12:21) Oh So Shoddy: Nice
    (12:22) Oh So Shoddy: Worked[/HIDE]
    Go ahead and ~updatescripts again to fix any tiering problems

    (12:28) Oh So Shoddy: (12:27:48) ±iBOT: Checking script version please wait. (Current Version: 2.0.01)
    (12:28) Oh So Shoddy: And this from ~versions
    (12:28) Oh So Shoddy: 1.7.01, 1.7.02, 2.0.00, 2.0.01
    (12:28) Oh So Shoddy: I thought 2.0.10?
    (12:28) Aya: PO is 2.0.10, my script isn't
    (12:28) Oh So Shoddy: Or is the script independent?
    (12:28) Aya: yes[/HIDE]
    Script version separate from PO version.
     
    Last edited: Jan 23, 2013
  10. The Dark Master

    The Dark Master Member

    Joined:
    Jun 22, 2012
    Messages:
    497
    Likes Received:
    0
    PO Trainer Name:
    d d
    Amazing! Just one thing: for some reason, everything on the ~pokedex command is showing these for weight and Low Kick/Grass Knot damage:
    Weight: undefinedkg / NaNlbs
    Damage from GK/LK: 120[/HIDE] yet the screenshot above shows it working correctly. Any suggestions?
    Example with Gastly:
    [​IMG][/HIDE]
     
  11. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    For some reason it's not reading your weight file, or at least that's what I assume it is.
    Try opening your PO folder, go to DB, then pokes, then see if weight.txt is in there
     
  12. Oh So Shoddy

    Oh So Shoddy Devil's Advocate

    Joined:
    Jul 19, 2011
    Messages:
    219
    Likes Received:
    0
    Uhmm. Can we get a ~lcpokedex command too for level 5 stats? Just thought it would be useful for LC battles. The level 100 stats can still be compared but lvl 5 would be more accurate.
     
  13. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    ~pokedex Misdreavus:5
     
  14. Oh So Shoddy

    Oh So Shoddy Devil's Advocate

    Joined:
    Jul 19, 2011
    Messages:
    219
    Likes Received:
    0
    Yeah I completely neglected looking over the entire command. Never mind me.
     
  15. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    The tier update thingy was broken and I didn't realise until now :x
    At the moment for most people when you do ~pokedex Garchomp or Genesect, it'll say the wrong tiers for them. Just ~updatescripts and then ~updatetierinfo and it should work fine again :x
     
  16. Deadly Nightshade

    Deadly Nightshade Come, fellow Englishmen

    Joined:
    Dec 5, 2012
    Messages:
    11
    Likes Received:
    0
    PO Trainer Name:
    Deadly Nightshade
    Whenever I try to use ~pokedex it says:
    (15:56:29) +ClientBot: ERROR: SyntaxError: Unable to parse JSON string
    Help?
     
  17. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    Update your scripts again, it should work again now :x (It'll say "Tier info unavailable" though for you...)
     
  18. Zoroark

    Zoroark Aka Flare Forum Moderator Server Moderator Forum Moderator Server Moderator

    Joined:
    Jan 29, 2013
    Messages:
    873
    Likes Received:
    1,161
    PO Trainer Name:
    SkyPhoenix / Zoroark
    Good Thingy scripts work perfectly and haven't crashed for me yet.
    Amazing scripts Moogle <3
    Good Job.
     
  19. GotThatPopcorn

    GotThatPopcorn Banned

    Joined:
    Jan 30, 2013
    Messages:
    177
    Likes Received:
    0
    PO Trainer Name:
    GTP
    Hey Crystal, how can I add the clickable names to my client script?
     
  20. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    You need to wait for the next version of PO
     
  21. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    These have been updated somewhat with a feature to convert youtube links into their titles and it linkifys links without http:// now (though it needs www.)
     
  22. Zoroark

    Zoroark Aka Flare Forum Moderator Server Moderator Forum Moderator Server Moderator

    Joined:
    Jan 29, 2013
    Messages:
    873
    Likes Received:
    1,161
    PO Trainer Name:
    SkyPhoenix / Zoroark
    Wait, aren't clickable names, the ones you add in your friend list? Like when I type "-friends" all my online friends appear in blue, and are clickable.
     
  23. GotThatPopcorn

    GotThatPopcorn Banned

    Joined:
    Jan 30, 2013
    Messages:
    177
    Likes Received:
    0
    PO Trainer Name:
    GTP
    No, it's something I would have liked to have in CM's client script, and will be released in the next update of hers. What it does for servers that are well populated (such as PO) you can click the person name in the chat to access their challenge/trainer info window. Has nothing to deal with the friends list I believe.
     
  24. Zoroark

    Zoroark Aka Flare Forum Moderator Server Moderator Forum Moderator Server Moderator

    Joined:
    Jan 29, 2013
    Messages:
    873
    Likes Received:
    1,161
    PO Trainer Name:
    SkyPhoenix / Zoroark
    Ahh, Now I get it.
    Yeah that would be awesome.
     
  25. zeroality

    zeroality Artificial Insanity

    Joined:
    Apr 22, 2010
    Messages:
    1,375
    Likes Received:
    1
    Well, I don't know if you're taking requests for this but I saw your other thread (haha) so here goes...

    A self-censor feature would be really neat. That was one thing I suggested for NetBattle 0.96 that Masamune really liked and implemented - even though people argued against it for no reason.

    It wouldn't affect anybody that doesn't want to use it and it would be very helpful for people who want to censor swears or even play around and replace words.

    Not sure if possible but it's an idea.

    That made me think of it.
     
  26. Elements

    Elements BOOMER SOONER

    Joined:
    May 9, 2010
    Messages:
    1,195
    Likes Received:
    42
    PO Trainer Name:
    Elements
    That should really be implemented via the client, but since you have been asking for that for years...I guess you have to take what you can get. Good idea though.
     
  27. Nightfall Alicorn

    Nightfall Alicorn Left Pokémon Online, most likely not coming back.

    Joined:
    Oct 15, 2013
    Messages:
    491
    Likes Received:
    171
    PO Trainer Name:
    Nightmare Moon
    Great script. That stalkword function helps a lot, because trainers attempt to flash me with my short name. But now they can do it either way now. Thanks Crystal. ^_^

    Also, thanks Stocke for mentioning the script. It's a life saver. ^_^
     
  28. Black Mage

    Black Mage ~Pro Mafia Player~

    Joined:
    Mar 2, 2012
    Messages:
    81
    Likes Received:
    0
    I May be SUPER early on this, but for the new version Coyotte passed, the 2.2.9, it seems to crash the scripts and it says i can't use them for the newest version :x
     
  29. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako

    I can't seem to replicate this at all :x
    Try removing and putting the scripts back in. What exactly happens when you use them?
     
  30. IceKirby

    IceKirby A.K.A. RiceKirby

    Joined:
    Apr 26, 2011
    Messages:
    2,176
    Likes Received:
    635
    PO Trainer Name:
    RiceKirby
    It's been a while since I last updated the script here so I don't know if you finished the plugin system, but I managed to make it work.
    However, the script loads the plugins from the same URL it loads the script, so I had to make some modifications so that the plugins would be read from a different URL (in my case, I set them to a local directory so I can test them easily). I wanted to suggest that the plugins URL could be made different from the script URL so both can be updated separately, as I was unable to make it load local plugins because they could only be updated with the same URL as the script.
     
  31. Zoroark

    Zoroark Aka Flare Forum Moderator Server Moderator Forum Moderator Server Moderator

    Joined:
    Jan 29, 2013
    Messages:
    873
    Likes Received:
    1,161
    PO Trainer Name:
    SkyPhoenix / Zoroark
    Ehh, I installed the scripts, deactivated safe scripts, but after installing them it wont do anything, the commands dont trigger the scripts. Its like they're not there.
     
  32. Fuzzysqurl

    Fuzzysqurl baa baa mareep I do what I want Server Owner Developer I do what I want Server Owner Developer

    Joined:
    Sep 12, 2012
    Messages:
    2,096
    Likes Received:
    967
    If you've ever opened another tab on your PO client, your scripts won't update in that "session" reliably anymore. You'll need to close the program completely, restart it, and keep your client to one tab. This could be one of the reasons nothing is happening.

    Another could be the default "trigger" is "~". So you need like ~commandslist, instead of /commandslist.
     
  33. Mr. Perry

    Mr. Perry wat

    Joined:
    Mar 31, 2012
    Messages:
    315
    Likes Received:
    280
    PO Trainer Name:
    Mr. Perry
    I had some problems with the script here, I installed and it worked fine the first time, but after my PO began to close after I try to enter a server (all the servers), and when I took the plugin, PO returned to normal.
    I tried with the new version (2.0.41) and the former, both did not work.
     
  34. Bamarah

    Bamarah "Baton Pass Elite"

    Joined:
    Oct 16, 2010
    Messages:
    344
    Likes Received:
    16
    Whenever I use ~pokedex (Name of Pokémon) I get this right before the actual info:

    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.
    (13:10:12) Script Warning in sys.baseStats(poke, stat, gen): Gen 6 unsupported.[/HIDE]


    Nothing too big but it does get annoying anytime I wanna use the command.
     
  35. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    That's not a problem with the script.
    Someone added something incorrectly to the basestat functions in the plugin itself, making it give an error when the gen is correct, rather than incorrect...

    Also I can't recreate the problem you're having Mr. Perry though I think I heard someone else having the same thing :(
     
  36. Nightfall Alicorn

    Nightfall Alicorn Left Pokémon Online, most likely not coming back.

    Joined:
    Oct 15, 2013
    Messages:
    491
    Likes Received:
    171
    PO Trainer Name:
    Nightmare Moon
    I have updated my client to 2.4.1 (newest version) and "~ytlinks on" is no longer converting YouTube address links to the titles of the clips. I've even tried it without any of my scripts added on. Don't know if it's the client update or YouTube doesn't allow your script to obtain titles anymore.

    Since I don't have a good connection to check out what people post in official main chats, I'm no longer able to have any idea what the content is or if it's appropriate. :(
     
  37. Crystal Moogle

    Crystal Moogle Ayaya~

    Joined:
    Jul 19, 2010
    Messages:
    3,204
    Likes Received:
    530
    PO Trainer Name:
    Hanako
    For some reason, the latest version crashes a lot for me, so I can't really try and test for myself :v
     
  38. Sunrise Alicorn

    Sunrise Alicorn The Prince of Dawn

    Joined:
    Feb 23, 2014
    Messages:
    2
    Likes Received:
    0
    PO Trainer Name:
    Sunrise Alicorn
    do you know how to prevent this script from overwriting my auto respond bot? if so pls let me know
     
  39. Shiny/Leafeon

    Shiny/Leafeon Try it now.

    Joined:
    May 6, 2014
    Messages:
    25
    Likes Received:
    4
    PO Trainer Name:
    Shiny/Leafeon
    I used this script for my server to get all the commands and things and it worked just fine, then I turned my computer off then back on and now I see error messages appearing saying
    "Script Check: Fatal script error on line 1840: ReferenceError: Can't find variable: client
    <global>() at scripts.js:1840" and that wasn't there the day I uploaded it.:confused:
     
  40. Duncajuwon

    Duncajuwon Active Member

    Joined:
    Dec 1, 2012
    Messages:
    234
    Likes Received:
    42
    Im on a mac
    when i put in the scripts,
    it makes the app quit unexpectedly each time i try to open po