Skip to content

HTML5 Client Scripting Questions

Hello, all!  I'm Cromm, the guy behind the HTML5 client (http://client.imperian.com).

If anyone has questions about the client, how to script for it, suggestions for improvement, etc., let me know -- I'll be happy to help.

Thanks!
«1

Comments

  • edited October 2012

    You might want to post something like this in the game as an announce or whatnot.

    I know that I don't have any questions about the HTML5 client because I will never use it, and I'm far from alone in that.

    EDIT: That sound way more impolite than it was in my head. I just mean that I'm never going to play the game without my third party client and my years worth of utility/combat/bashing scripts I've got for it, and so I'll never use it for anything more serious than chatting on clans.

    "On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."

  • i've been trying to learn it but unable too. I looked through the help files. Can you help?
  • While a true introduction to Javascript programming is outside the scope of what I can do for you right now, could you perhaps describe a couple of example scripts and such that you're trying to write?

    I'll do the best I can!
  • Quick update for anyone interested: I've updated the client manual at http://client.imperian.com/help/ with examples of each built-in function (in the Scripting Guide section) as well as a start-to-finish guide in the next section (Example Reflexes and Scripts) for creating basic targeting, attack, and defense reflexes.

    Take a look and let me know if there's anything you'd like me to further discuss!
  • I use this client and I love it.

    There is one thing that this client can do that, to my best knowledge, no other client can do better:


    Basically the ability to write my own listeners to onKey, onMsgRecv, and onGMCP events gives me complete control over almost everything.

    For example, due to my habit of using the vi editor, I don't like holding down shift/control/alt keys when I activate shortcuts. With my own onKey listener, I can set aside one particular key, say escape, as a mode-switching key. Then in shortcut mode, pressing each individual key directly fires a shortcut without the need of hitting return. And in command mode, I can type commands with return in the prompt as usual.

    Similarly, onGMCP is awesome.

    The only thing that I am not completely happy about is onMsgRecv. Since the current implementation of gagging/replacement is incomplete and does not handle pattern matching with color well, I had the intention of putting all triggers in my own onMsgRecv listener. However, as of now, onMsgRecv receives not the "real" text from the server but only a "copy" of it with the color tags stripped off. While I can still use it to implement triggers to perform certain actions, I do not have complete control over what gets printed on screen since modifying a copy of the text does not change the real text. If the mechanism is changed so that the onMsgRecv listener is the first-step "filter" of the colored text (by default, it simples sends everything it receives without modification), then it would be godly.

    Some time later, I may share my custom code for this client here if there is enough interest. I know many people stick to a certain client out of habit, but I strongly recommend that new users (that is, newbies like myself *smirk*) give it a chance.
  • Just to note, Mudlet does have these similarities. They are called events, and can even be user defined rather than just game defined.

  • Very interesting notes, @Dukkha -- I'd never even thought about setting up a "command mode"!

    Your issues with onMsgRecv are actually something I'm working on heavily at the moment. The problem is that it's fairly onerous to handle gags/highlighting/replacement in an HTML environment, and checking the plain text (no ANSI codes, etc.) is FAR less intensive and simpler for new players. For the more tech-savvy, though, there is clearly a gap in functionality that I'm trying hard to bridge.

    Thanks again for your comments (you, too, @Delrayne)! Glad you're enjoying it!

    - C
  • Delrayne said:
    Just to note, Mudlet does have these similarities. They are called events, and can even be user defined rather than just game defined.
    CMUD also has events, including custom events you can raise and handle.
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • I didn't know that Mudlet and CMUD has similar event listeners. Thanks @Delrayne and @Lionas for the info.

    Anyway I speak from my experience. I am a newbie to mud (last year I put 2000+ hours in Diablo 3 and finally got burned out and decided to try mud for a change, so I really started playing mud near the end of last year, that's how new I am to this community). I didn't try CMUD because it is not available on my Mac. I tried Atlantis and Mudlet briefly and found Mudlet to be the more powerful of the two but the learning curve was quite high for me: I didn't want to invest time to learn coding in a such a specialized environment before I decide whether I want to keeping playing mud at all. I also tried TinTin++ and I loved its pure and clean console interface, but I turned away from it exactly because (as I mentioned in my previous post) I don't want to press ctrl/shift/alt all the time, and TinTin++ key event listener is not powerful enough for me to write the mode-switching easily (yes it can be done but in some crippled nonintuitive way).

    The things that make the HTML5 client special to me (and hence to many people like me) are the following: first, when I am a newbie the webpage interface lets me start playing right away without choosing and downloading a client; second, as I become slightly more experienced, the macros/triggers offered by the webpage interface give me enough power to do simple things easily; third, as I progress even more, I can start to build my own system by writing custom functions through the webpage interface. These functions are in Javascript, which is exactly the same language in which the HTML5 client is written, so the integration is seamless and the functionality is godly (if I really want to, I can update the color pattern matching functionality I complained about earlier by myself using such functions to replace existing implementation; indeed I have complete control of what I want). Moreover, and most importantly, Javascript/HTML is something that many newbies might know already if they do some web programming

    I am not arguing which client is more powerful. I am simply arguing that the HTML5 client has a gentle learning curve for newbies like me, so I would like be a strong advocate for it.
  • edited May 2013
    im like totally new to this scripting thing, but i have been looking everywhere to find out how to do something and no luck.

    pretty much im trying to track what toxins i have on a target by use of triggers. so like when i see the message for paralysis it adds paralysis to a list and when i see the cure message it removes it, could anybody help me out? im not looking for someone to do it completely for me as i want to learn. Just say tell me how to get paralysis on the list and i would work on it from there.

    im not quite sure how i would display this list either, not sure if it would be possible to make another tab on the far right by the map on the client or not.

    Thanks
  • Ok have been making ground in scripting but wondering if the HTML client is able to use "Wildcards" as i was told they are called and if so how do you use them
  • edited May 2013
    I'm trying to set up something with this:

    A sudden eruption from a distant volcano lights up the firmament and you notice a larger number of shards flying towards

    I'm thinking I need to set after the 'towards' (.*) for the wildcard regex with a \. at the end.

    The thing is, I don't know how to match @place with the wildcard, that way I can have it send to the mud "clt1 Shardfall in @place"

    Any suggestions?
  • Is it possible to create new tabs near the conversation tab to list information for you with the HTML5 client, for example how many strikes i have on my current targets llimbs? i am new to Javascript and HTML5, but i am going to attempt to learn, but i wanted to know if i could do this prior to me deciding which client i would like to stick with
  • edited June 2013
    Custom tabs are not CURRENTLY supported, but I definitely plan to add support for them in the near future!
  • My question is simple...how do I make a trigger that instead of having 2...it uses the regex like (%d) or whatever to capture the number should it change?
  • edited November 2013
    Hi! I haven't played Imperian in awhile but I came back and there is this very nice autocuring system and the html5 client is really sweet too!  I am pretty much a novice in javascript but I've managed to get a bit further than expected learning it in the last day.  I have run into a little snag however though: I was wondering if there was a way to make a key binding run a function.  I tried to run_function("bash") in the keybinding to no avail.  I echoed my output and its literally trying to just tell the mud to run_function("bash") which of course it has no idea what that means.  I could always use an alias I suppose but it would be nicer to just use a key bind.  On the same topic, can a keybind expand an alias as well?   Thanks for your help and the nice upgrade to Imperian!


    --edit: oh! As it turns out I don't know how to run a function from the alias either heh. 
  • @cromm

    For most of my IRE mudding (which is basically just Aetolia) I fall into Khizan's category, though with Mudlet rather than MM. For Imperian though, and for various reasons, I am considering trying the html client.

    I mud on a small touch screen (a 10" windows tablet). I've built quite a good GUI for this in Mudlet, though it is always a work in progress. At least in the short term though, I can't be bothered rewriting the gui for Imperian.

    Which brings me to my question:

    Is there any scope in the html5 client for customising the GUI? When "opportunities" in combat come up, such as a good time to impale for a basic example, I make a large, translucent button/label pop up over the main text. This serves both as a warning that now might be a good time to impale, and as a button I can press to make the impale happen.

    I could easy code that in as an automatic response, but I find it more fun to semi-manual my offense.

    The button wouldn't actually need to be translucent and over the main text - but is it possible for me to make a row of buttons in the gui somewhere that I can assign function calls to, and manipulate the colour/text of via scripts?

  • edited April 2014

    Hi I am new to the web client coming from mudlet and mush previous to that.The biggest issue I have with the client is when I need to run through a series of events. Because of the blocking issue with the client I am not

    sure how to step through say a def-up, I've seen the timeout function but that just fires all the commands each with say a 2500ms delay and I never get my balance back to run the others. It seems a little backwards to have

    to  increment the interval for each one like say for each one like this

    setTimeout(function(){client.send_direct("cast xyz")},5000

    setTimeout(function(){client.send_direct("cast abc")},10000


    is there away for me to fire on individual commands as I get balance?


    I'm thinking this will be useful for a bashing script so I can launch my next attack when hunting on Balance not some random timer.


    Thanks

  • We'll probably add something eventually, but for now, the timeouts are the best option if the in-game queueing isn't up for the task.
  • So there isn't a way to grab the balance from onGMCP and firing an action off that?


  • Nothing built-in, no. I'm sure you could do something with javascript there though, if you are sufficiently familiar with it.
  • edited May 2014

    so actually easy to grab balance and eq from onGMCP in the vitals


    next question Is there a way to call onGMCP using run_function but have it only get a single value? 


  • Is there any way to script in any language besides JS?

    Overall I really like the client because I play on multiple computers so its real easy to keep my system current without having to maintain a current version on multiple computers.
  • Probably not, unless your browser supports that.
  • How do you delay in the new client?

    I'm trying to set up all my ranger defences plus cloak tattoo

    so I go

    send_direct("touch cloak|nightsight|weathering|balancing on")

    Now I want to use barkskin next, but barkskin requires equilibrium, which touch cloak has removed. I need to wait for it to return before continuing with my function.


    since it's essentially the same question with different skills but I read that the new version no longer supports some of these commands. 

    Basically, I don't know what commands I should be using to set the timer or even if that's the easiest way to do it.

    Thanks!
  • The easiest way to accomplish this (in the case of a single delay) would be to use the in-game queueing system, removing the need to handle it in-client. The specifics can be found in HELP QUEUEING, but the summary is that you can QUEUE EQ/BAL/EQBAL <action>.
    Like what we're doing? Why not take a second to vote? Vote for Imperian at http://www.imperian.com/vote
  • Hey, that is easier. Thanks. Is the waiting stuff still important to know though for more complex scripts?
  • NECRO

    Any other players with .js knowledge thinking about switching to web client with updates rolling out? I'm thinking about starting a slack team to collaborate on it.

    Also @Garryn do you guys have a more detailed documentation coming with updated client release?
  • ThorimThorim California
    Necrooooo


    I can't find anyone in-game who uses the HTML client, I could use some help with a lot of things. I'm used to mudlet but Chromebook doesn't support it and the HTML client is pretty snazzy to look at.

    One thing I did on mudlet was have an echo next to room names with their vNum. If I had a location-type skill (Farsight/Mind Sense) that gave me a targets room, it would echo the vNum right next to the name. Is this possible on the HTML client?

    Another thing I want to do is add to the pre-set windows, is that possible and if so how.

    And finally, for the time being, when using TAB it targets a mob in the room and sets it as current target. I want to do the same thing with my targetting alias, that way my target's health shows up on the GUI and highlighted like it does when using TAB for targetting
  • The HTML5 nexus client is still in very active development and getting better all the time.  One big difference with mudlet, however, is the fact that people have built a lot of systems for mudlet already.  So for your given examples, these things are possible in the nexus client, but not a matter of dropping in code someone else has already written.  For example, I uploaded a script that could add custom windows like you describe, but it needs updating to work with the latest version of the client and it hasn't been a priority.  
Sign In or Register to comment.