HTML5 Client Questions and Such

2456715

Comments

  • Thank you very much. Also in relation to the (.+)\. thing where do i find more information on it and other similar ones? (like that (%d) thing)
  • Just Google 'regex' and find a basic guide, here is an online tester I use -http://www.regextester.com
  • any issues with the html5 client today?  I keep getting "unable to connect" errors through firefox and chrome on pc and nexus 7 tablet.  This is web console error:
    --
    [12:55:42.717] GET http://ironrealms.com:12006/ [0ms]
    [12:55:43.695] Firefox can't establish a connection to the server at ws://ironrealms.com:12006/. @ http://client.achaea.com/includes/js/lib/websock.js:276

    I can connect no problem via mudlet.  Whenever I connect with HTML5 client, i click 'sign in' and I get 'Connection closed.  Click here to reconnect.' on output and that error message in console.
  • Scratch that for now, I think it is because i'm trying to connect at work and the local security prevents it... 
  • edited February 2013
    Glad to be of service... ?

    :-D

    (Appears to be fine here. In Chrome, you might try ticking the "SSL" option and refreshing -- may work, may not... SSL isn't working for the moment - disregard!)
  • I have very little experience working with Javascript, but I've been playing around with the client trying to figure it out to help my novices... 

    I'm having some difficulties figuring out some  fairly basic aliases. Perhaps among the simplest that I'm not sure how to do even after reading the manual is 

    PUT x IN PACK

    the way the aliases in the client appear to work is by appending the variable to the end of the command, but in this case I want the variable in the middle of the command. I'm either too tired right now to figure it out without using @set, or it's not possible.

    Is it possible to use temporary variables in aliases? Do they use perl regex?

    and 

    Can aliases call functions?

  • Ok, I have a couple of queries on this.

    Firstly, how does the logging work, I can't seem to manage it

    Secondly, can we activate or deactivate a trigger group using a function?
    Currently I'm having to manually click on the Lightning and manually check / uncheck it.

    Thank you
  • Mannimar said:
    I have very little experience working with Javascript, but I've been playing around with the client trying to figure it out to help my novices... 

    I'm having some difficulties figuring out some  fairly basic aliases. Perhaps among the simplest that I'm not sure how to do even after reading the manual is 

    PUT x IN PACK

    the way the aliases in the client appear to work is by appending the variable to the end of the command, but in this case I want the variable in the middle of the command. I'm either too tired right now to figure it out without using @set, or it's not possible.

    Is it possible to use temporary variables in aliases? Do they use perl regex?

    and 

    Can aliases call functions?

    Aliases are simple, simple replacements -- think of them as abbreviations. You can always use the @var syntax after an alias name, but nothing in the middle.

    Instead, try a function. Assume you want what you type to be pip.

    The function name should then be pip, and the code should simply be:

    send_direct("put " + args + " in pack");

    You can then use this in several ways: 

    - Type pip gold (or whatever you like instead of gold) to put anything you type in your pack.

    - Type pip @var to put whatever the variable var is set to in your pack.

    - If you'd rather have the function always put whatever a variable is set to in your pack, replace the word "args" in my example code with:

    get_variable("variable_name")

    Does that help?
  • Tarnellem said:
    Ok, I have a couple of queries on this.

    Firstly, how does the logging work, I can't seem to manage it

    Secondly, can we activate or deactivate a trigger group using a function?
    Currently I'm having to manually click on the Lightning and manually check / uncheck it.

    Thank you
    Not sure what's wrong with the logging -- unless you're on an iPad or iPhone, it should be working fine. Click the log button once to start collecting, click it again to stop and a popup should appear offering to let you download it (be sure to allow popups for client.achaea.com).

    There's not currently a built-in function to toggle a trigger group's activation status, but here's a quick function you can place in "onLoad" and then call from anywhere (and I'll be sure to add this to the client in the next round of updates -- great suggestion!):

    // Activate or Deactivate a Trigger Group //
    var toggleTriggerGroup = function (group, isActive) {
        for (var i in client.trigger_groups)
        {
            if (client.trigger_groups[i].name == group)
            {
                // If you'd like to see that you enabled/disabled the group //
                if (isActive == true && client.trigger_groups[i].active == false)
                    print("Trigger Group <span style='color:#fff'>[</span>" + group + "<span style='color:#fff'>]</span> Enabled", "green");
                else if (isActive == false && client.trigger_groups[i].active == true)
                    print("Trigger Group <span style='color:#fff'>[</span>" + group + "<span style='color:#fff'>]</span> Disabled", "red");
                
                // Set the group's activation status //
                client.trigger_groups[i].active = isActive;
                
                // Will update the list in the triggers tab //
                display_trigger_groups();
            }        
        }
    }

    Then, to use it in your scripts/trigger code:

    toggleTriggerGroup("MyTriggers", true); // Use true to activate the group, false to deactivate it //

    Let me know if I can better explain that!

    - Cromm
  • Thank you Cromm
    That script works perfectly for me,

    and I've solved the logging, I thought the green tick meant it was logging, not start logging, so I was turning it on when I meant off and off when I meant on.
  • Is there a way to change the command separator from | to ; or anything else that doesn't need two buttons to use? Thanks in advance.
  • CardanCardan The Garden
    @Elaeejah - Under Settings (Gear icon), go to the Advanced Tab. There's an option there to specify a different command stack delimiter.
  • I'm having some issues with what I thought would be a fairly simple function. I'm trying to program something to drop selfishness, give an item to another adventurer or denizen, and bring it back up, the main issue is circumventing the delay with equilibrium, so I tried to set a timeout,

    setTimeout(function () {
        send_direct("generosity");
        send_direct("give " + args);
        send_direct("selfishness");
            }, 1000);

    The problem is it entirely ignores the second line whenever I set a timeout, but when tested without the timeout, that line's there. Well, no, that's a sub-problem. The main problem is when a timeout is involved at all it repeats constantly every second without any way I can think of to shut it down. I have to remove the function altogether to get it to stop sending to the client.

    Any ideas?

  • A few thoughts.

    1) I'm gonna just guess that you named your give function "give"... Can't see any other reason that it would continue to call itself (if this is the case, you type give, which calls the give function, which tries to send "give blah", which calls the give function, which tries to send "give blah", etc.) To fix it, I'd suggest making the send_direct call look like this: 
    send_direct("give " + args, false);

    The "false" tells send_direct to ignore functions in the command being sent.

    2) This should be what's causing the second line to fail.

    3) I'm guessing you're trying to avoid attempting to give someone something when off eq (following the generosity command). To do this, you'll need to move the send_direct("generosity") OUTSIDE of and before the setTimeout -- otherwise, you're simply waiting 1 second to send the generosity command, then immediately attempting to give (which should fail).

    Let me know if that doesn't fix it!
  • edited April 2013
    Yes and no. You hit the nail on the head for the information I didn't give (sorry about that), but it's still not working, just in a new way now. I changed the code to the following based on what you suggested,

        send_direct("generosity");
    setTimeout(function () {
        send_direct("give " + args, false);
        send_direct("selfishness");
            }, 1000);

    But now it sends the give command as 'give [object Object]', so I have absolutely no clue what it's doing now, unless I've messed up somewhere else.

    Edit: I've also tried renaming the function to hand, to not conflict with give, and took out the false modifier--Still the same issue with 'give [object Object]'.

  • Hmm. I'm not getting an error with that code.

    Can you send me the entire user function you're using here (the whole system export would be even better just to be safe).

    cromm@ironrealms.com
  • Another question, real quick. Barring linking to an external script (which I'm not sure is possible in the client yet) is there a way to bundle functions or aliases into a single section of code? Like adding multiple functions to a single snippet, or multiple aliases, for recordkeeping like Triggers can be sorted for ease.

    I'm trying to set up something to pull the inks for tattoos I might need automatically, but given the tattoo list, it's getting pretty extensive. I know I could just use aliases, or functions, or both, but I'd rather not have a huge list of either.

  • Hmm... not entirely sure what you're getting at.... Kinda sounds like the "grouping" of triggers, but the groups could encompass any parts of the system settings. That what you mean?

    Also: you can definitely pull in outside scripts! If you have somewhere to upload the file (Dropbox SHOULD work, though I haven't tested it), you can pull it in by including this in, perhaps, your onLoad function:


    That's how the reflex packages are handled, for the record. You would want to load the script only once, as making frequent connections like this would definitely slow down the client.
  • Then that will work perfectly! Yeah, the grouping of triggers, or a way to put multiple functions into a single one while still being able to call them all was pretty much what I was getting at for organizational purposes.

  • Hey Cromm
    I'm not good with javascript, but I understand there is a way to make string a value for variable. This is useful for party hunting when the leader called target.

    This is taken from Lua Regex, and I have tested it and it worked. The string is match:
    ^\(Party\)\: (\w+) says, \"Target changed to (\S+).\"$

    But I have no idea how to put (/S+) as value for a valuable, I assume the action would be

    @set tar (thetarget)

    Is there a regex that can do this, or this requires a function?
  • edited May 2013
    Hi there!

    This should be simple enough to do. I'd suggest the following tweak to your regex (changed the last \S to a \w):

    ^\(Party\)\: (\w+) says, \"Target changed to (\w+).\"$

    Then, in the script section for the trigger, you can just do something like this:

    // Optional: check to ensure the person giving the order is the current party boss //
    if (args[1] == get_variable("party_leader")) { // Delete this line if you don't want to check the party leader //

         print("PARTY TARGET SET TO: " + args[2], "white", "red");
         set_variable("tar", args[2]);

    // Delete this line if you don't want to check the party leader //

    I haven't had a chance to really test this snippet, but I can't see anything that would give you trouble -- let me know if you have any!
  • Hello,

    I have a few basic antitheft triggers, I was wondering how I to disable the antitheft trigger group with an alias so I could for for example get gold from my pack without my antitheft triggers freaking out and putting it back in again. At the moment im just manually unticking the trigger group in the main window but i'm sure there must be a better way

    Thank you
  • TectonTecton The Garden of the Gods
    Hi Bwyd,

    If you scroll up this thread a little, you'll find a post (by Cromm) on trigger groups with some sample code to show you how to do it!
  • That's correct, and you can certainly use the code above if you want to do something custom like display a message with it (as is done in the example provided).

    If you JUST want to enable/disable a group with no message printed, it's since been added to the client code itself, and you can simply call:

    toggle_trigger_group("MyTriggers", true); // Enabled //

    // or //

    toggle_trigger_group("MyTriggers", false); // Disabled //
  • Thank you Tecton & Cromm! :)
  • Not sure if this is the right spot to ask this question, however since it has to do with HTML5 Client, I figured I would ask it here.

    I have mudlet and tried using it but I don't know much about Lua and scripting in general. So I went and decided to try out the client. So far, I like the lay out of the GUI. It is very nice, so great job on that part. The thing I am wondering about is how well does it hold up in combat?

    I worked with Nexus and got a decent basic script running on that for basically hunting but if I wanted to jump into the arena or raid, I was SOL. Can the client stand up to Mudlet and Mush and Cmud or am I going to pretty much use it just for hunting and simple things and have to get a system for Mudlet if I want to become a good combatant?

    If this is the wrong spot to ask, I apologize and if you point me in the right direction I will re-post this in the appropriate thread.

    Thank you
  • It isn't, and won't for the near future of browser technology, be as FAST as Mudlet or virtually any other standalone, devoted client software.

    However -- unless you're fighting in the highest of high tiers of combat on a regular basis, I don't -think- you'll run into much that you can't do and do well. The functionality is there or will be added soon when compared to Mudlet, for instance, but Mudlet will be faster and more efficient in general, simply because it's built FOR mudding, whereas the HTML client is built ON TOP OF a web browser's systems first.

    Even then, you'll need VERY good scripting (or to pay someone who scripts well) to maximize the capabilities of Mudlet versus HTML5 -- for the most basic scripting, you won't see any appreciable difference.

    TL;DR - For basic combat needs, you'll be able to script just about anything you need (if not everything). If you intend to compete at the highest tiers of combat, you almost certainly need a devoted client like Mudlet and a LOT of scripting experience or a LOT of credits to pay people that already have it.

    Hope that helps!

  • It does help a lot. It lets me know where I can take the client in terms of scripts I want to work on trying to create and what to expect and having some realistic standards instead of going into this thinking it can run as well as the stand alone clients.

    For example, I can create a basic curing setup in the Client for hunting, something to keep my alive while I work on gaining dragon. I can also work on something for doing tonics and balms and minerals to make gold with.

    I also understand now that if I want to get into the highest of combat, I need to start seriously studying Lau and Mudlet or find a way to make a ton of credits in the game and pay some one to do it for me.

    Thanks for the info. Greatly appreciated.
  • Omg @Cromm You handle HTML5?! Which means you can help me figure out what's wrong with my baby?! I play on an iPad and I can't connect to Achaea via client.achaea.com -at all-. It either closes Chrome or Safari out, or it redirects me to 'client.achaea.com/v1' and doesn't load.
    (XXXX): Peak says, "You worry me."
  • Yep! We're working on that very issue! No one can recreate it! :(

    In the meantime, I've just removed the automatic redirect -- you should be able to play with the new version assuming it was originally working for you.

    Please let me know if not. Thanks!
Sign In or Register to comment.