Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

HTML5 client updates - Version 2.2

2»

Comments

  • RenoirRenoir Member Posts: 30 ✭✭ - Stalwart
    edited February 2014
    @Tecton Found the Issue!

    When you're making the JSON file, it seems to fail if the root package objects 'name' key has any capital letters in it. Turn the name fully lowercase, and it works like a charm. Now I can get back to designing my system.

    EDIT: The Value of the name key, so
    { "name": "a system"} works, while {"name": "A system"} Doesn't.
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    Alright, I have a confusing question. I didn't like the IRE targetting on the HTML5 and after you guys made the Settarget stuff I had a function that actually targeted twice and I have no idea how to make this HTML5 client do that :(

    This is what I thought it would be.

    var t = client.set_variable("tar ", args[0]); client.send_direct("settarget");

    obviously the function is t, but I can't get it to work! Any ideas on what I am doing wrong?
  • TrevizeTrevize Member Posts: 1,517 @ - Epic Achaean
    edited February 2014
    @Achimrst

    Looks like you're setting a variable "tar" and sending the string "settarget" but you haven't told it what to target.

    I'd assume it should be client.send_direct("settarget " + client.get_variable("tar"))

    edit: Or even in the same script, just:
    var t = client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0]);

    Edit again: I just realized you're setting t to 'set_variable' and not 'get_variable'. Make that:
    var t = client.get_variable("tar", args[0]); client.send_direct("settarget " + t);
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    edited February 2014
    Yes that is exactly what is happening TY!

    Alright, tried all versions, only one that worked was actually the second one! yay!
  • TectonTecton The Garden of the GodsAdministrator Posts: 2,507 Admin
    Renoir said:
    @Tecton Found the Issue!

    When you're making the JSON file, it seems to fail if the root package objects 'name' key has any capital letters in it. Turn the name fully lowercase, and it works like a charm. Now I can get back to designing my system.

    EDIT: The Value of the name key, so
    { "name": "a system"} works, while {"name": "A system"} Doesn't.
    Good find, we'll get that sorted out! 

    Just a heads up - the autosipper is back online, new and improved for version 2.2.
    AchimrstMelodieTrevize
  • TrevizeTrevize Member Posts: 1,517 @ - Epic Achaean
    edited February 2014
    Achimrst said:
    Yes that is exactly what is happening TY!

    Alright, tried all versions, only one that worked was actually the second one! yay!
    Okay, I was honestly writing that while trying to do a few other things, wasn't paying a lot of attention. Those are actually all three flawed, sorry.
    Three examples of what WILL work:

    client.send_direct("settarget " + args[0]);

    var t = args[0]; client.send_direct("settarget " + t)

    client.set_variable("tar", args[0]); client.send_direct("settarget " + client.get_variable("tar"))

    The first just sets the target to the argument. The second sets a javascript variable and uses it to target. The third sets a client variable and uses it to target.

    edited for clarity and because I am too exhausted to type, apparently.

    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    edited February 2014
    Trevize said:
    Achimrst said:
    Yes that is exactly what is happening TY!

    Alright, tried all versions, only one that worked was actually the second one! yay!
    Okay, I was honestly writing that while trying to do a few other things, wasn't paying a lot of attention. Those are actually all three flawed, sorry.
    Three examples of what WILL work:

    client.send_direct("settarget " + args[0]);

    var t = args[0]; client.send_direct("settarget " + t)

    client.set_variable("tar", args[0]); client.send_direct("settarget " + client.get_variable("tar"))

    The first just sets the target to the argument. The second sets a javascript variable and uses it to target. The third sets a client variable and uses it to target.

    edited for clarity and because I am too exhausted to type, apparently.

    Um, the second one worked when I did it. I'm not on HTML5 now but I am pretty sure that the second was basically what I used and it worked correctly.

    The second being: var t = client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0]);
  • TrevizeTrevize Member Posts: 1,517 @ - Epic Achaean
    edited February 2014
    Achimrst said:
    Trevize said:
    Achimrst said:
    Yes that is exactly what is happening TY!

    Alright, tried all versions, only one that worked was actually the second one! yay!
    Okay, I was honestly writing that while trying to do a few other things, wasn't paying a lot of attention. Those are actually all three flawed, sorry.
    Three examples of what WILL work:

    client.send_direct("settarget " + args[0]);

    var t = args[0]; client.send_direct("settarget " + t)

    client.set_variable("tar", args[0]); client.send_direct("settarget " + client.get_variable("tar"))

    The first just sets the target to the argument. The second sets a javascript variable and uses it to target. The third sets a client variable and uses it to target.

    edited for clarity and because I am too exhausted to type, apparently.

    Um, the second one worked when I did it. I'm not on HTML5 now but I am pretty sure that the second was basically what I used and it worked correctly.

    The second being: var t = client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0]);
    While it works, the first part is unnecessary. It is setting a client variable, but isn't using it. Also, the t = client.set_variable is silly - it's setting t to the return value of the set_variable function... which is bound to be useless. The second (client.send_direct) is the same as the first in the last set of three examples above, and is what's actually doing something. :) Like I said, wasn't really paying as much attention as I should have been when I tried to write it.
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    Trevize said:
    Achimrst said:
    Trevize said:
    Achimrst said:
    Yes that is exactly what is happening TY!

    Alright, tried all versions, only one that worked was actually the second one! yay!
    Okay, I was honestly writing that while trying to do a few other things, wasn't paying a lot of attention. Those are actually all three flawed, sorry.
    Three examples of what WILL work:

    client.send_direct("settarget " + args[0]);

    var t = args[0]; client.send_direct("settarget " + t)

    client.set_variable("tar", args[0]); client.send_direct("settarget " + client.get_variable("tar"))

    The first just sets the target to the argument. The second sets a javascript variable and uses it to target. The third sets a client variable and uses it to target.

    edited for clarity and because I am too exhausted to type, apparently.

    Um, the second one worked when I did it. I'm not on HTML5 now but I am pretty sure that the second was basically what I used and it worked correctly.

    The second being: var t = client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0]);
    While it works, the first part is unnecessary. It is setting a client variable, but isn't using it. Also, the t = client.set_variable is silly - it's setting t to the return value of the set_variable function... which is bound to be useless. The second (client.send_direct) is the same as the first in the last set of three examples above, and is what's actually doing something. :) Like I said, wasn't really paying as much attention as I should have been when I tried to write it.
    I could tell you why I do that, but then I would have to kill you.

    No but really I like to see my target and I don't feel like making a new silly little button thing to do that when I can just set the tar variable and set my curses to: curse bleed. As opposed to setting my curses to curse @tar bleed. Then I can use the tar variable as a marker for who I set the settarget to and even change it for triggers to target two people at once :P
  • AntoniusAntonius Member Posts: 4,851 @@ - Legendary Achaean
    Doing var t = args [0] inside a function likely won't help, since t won't exist when the function finishes execution.
  • OrzaansynOrzaansyn Member Posts: 663 @@ - Legendary Achaean
    @Renoir: you may wish to use http://jsonformatter.curiousconcept.com/ to validate your JSON. I may save much time! :)
    image
  • TectonTecton The Garden of the GodsAdministrator Posts: 2,507 Admin
    Renoir said:
    @Tecton Found the Issue!

    When you're making the JSON file, it seems to fail if the root package objects 'name' key has any capital letters in it. Turn the name fully lowercase, and it works like a charm. Now I can get back to designing my system.

    EDIT: The Value of the name key, so
    { "name": "a system"} works, while {"name": "A system"} Doesn't.
    Fixed!
    OrzaansynTrevize
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    Antonius said:
    Doing var t = args [0] inside a function likely won't help, since t won't exist when the function finishes execution.
    I don't know why people are trying to tell me it won't work, it is working. I used the variable tar and made a function called: t

    in that function I put simply the script: var t = client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0]);

    There is no debating that it works, because I just hunted some rats with it!
  • AntoniusAntonius Member Posts: 4,851 @@ - Legendary Achaean
    edited February 2014
    @Achimrst: The var t = part of your code is irrelevant, it would also work if you just did:

    client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0];

    Also, the specific thing I was talking about was one of Trevize's suggestions.
  • AchimrstAchimrst NatureMember Posts: 3,608 @@ - Legendary Achaean
    Antonius said:
    @Achimrst: The var t = part of your code is irrelevant, it would also work if you just did:

    client.set_variable("tar", args[0]); client.send_direct("settarget " + args[0];

    Also, the specific thing I was talking about was one of Trevize's suggestions.
    Ah, alright. Hmmm. I will take it out although the help thing made me think I needed it. Thanks!
  • RenoirRenoir Member Posts: 30 ✭✭ - Stalwart
    Orzaansyn said:
    @Renoir: you may wish to use http://jsonformatter.curiousconcept.com/ to validate your JSON. I may save much time! :)
    The problem wasn't malformed JSON. I'm making my JSON with Javascript's JSON.stringify. It's perfectly valid. The problem, as I stated to Tecton, was that it failed with any capital letters in the reflex groups name field. It would believe that it imported successfully, but then be unable to reference if, as it's looking for the wrong key in an Object, therefore not being able to trigger any triggers, or even delete itself. Changing the came to completely lowercase solved the issue.
    Orzaansyn
Sign In to Comment.