Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 24

Thread: CLI Links -- easily add CLI power to your relay script

  1. #11
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,491

    Default

    Wording clarificaton please: Did it mess up ChIT when you clicked the link or when the page loaded?

    Next step to try is adding a doctype, which KoL also fails to do:

    PHP Code:
    results.replace_string("<html>""<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "+
          
    "\"http://www.w3.org/TR/html4/loose.dtd\">\n<html>"); 
    This will force IE out of "quirks" mode (making position:fixed work properly), among other things. I'm using CLI Links in BatMan RE, so it is possible to make KoL and this compatible. But if this doesn't do it, I'd probably have to install ChIT to figure it out. Nothing else jumped out at me from that code.
    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #12
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,271

    Default

    Wording clarificaton please: Did it mess up ChIT when you clicked the link or when the page loaded?
    Originally Posted by zarqon View Post
    Before I clicked the link. And after. Same problem. I'll test your solution later. Busy now. I just ascended into highschool which is kind've a descension...
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  3. #13
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,271

    Default

    Tested. That fix ALMOST works! Thanks to adding a doctype my display looks perfect.

    Now, a link in the charpane will execute the link and the reload the charpane perfectly without anything bad happening to the display.

    Unfortunately, if I put the link in a picker (one of those pop-up lists of links), then it will execute TWICE and fail to reload the charpane. I'll attach my current version of chit so that you can see this yourself. (You'd need to install the whole script from SVN because there are many other files.)

    I added CLI links in two places:
    • Check the MCD drop-down and try to change the MCD level. That won't work properly.
    • I also added a link to MCD 10 at the bottom of the Stats brick. Just for testing. It works perfectly there.
    Attached Files
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  4. #14
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,491

    Default

    Hmmm, I suspect that's due to event bubbling and could be fixed by adding stopPropagation() (or whatever it's called) to the event handler. Will update that when I get home and we can see if that solves it.

    EDIT: Have altered the click event to return false rather than merely cancel the default behavior. This will prevent the click event from bubbling up the DOM and possibly causing problems such as you describe. If that's not actually the cause of the problem, then I'll need to look at ChIT compatibility in further detail, but so far in this thread I'm 2/2 in blind debugging, so feeling unreasonably optimistic.
    Last edited by zarqon; 08-16-2013 at 08:56 AM.

  5. #15
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,271

    Default

    EDIT: Have altered the click event to return false rather than merely cancel the default behavior. This will prevent the click event from bubbling up the DOM and possibly causing problems such as you describe. If that's not actually the cause of the problem, then I'll need to look at ChIT compatibility in further detail, but so far in this thread I'm 2/2 in blind debugging, so feeling unreasonably optimistic.
    Originally Posted by zarqon View Post
    Finally got back to this. It still doesn't work for a CliLink in a picker menu. It attempts to execute the command twice and does not reload the charpane. Sadly I think I'm going to give up on adapting CliLinks for ChIT. The current method works well enough.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  6. #16
    Senior Member Fluxxdog's Avatar
    Join Date
    Nov 2009
    Posts
    1,501

    Default

    At least you gave it the ol' college try!
    --
    The worst crime you can commit against another human being is to make them think.

  7. #17
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,491

    Default

    r6 Update

    Added a "clilinknostyle" class, which functions exactly like the "clilink" class but applies no CSS to the links, allowing you to style them yourself (or leave them unstyled).
    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  8. #18
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    CLI Links

    Next, you'll be wantin' to import it into your script, and since it's jQuery, you'll also need to import jQuery. To do that, insert this in your page's <head> tag, although it will probably work anywhere in the document:
    HTML Code:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="clilinks.js"></script>
    Note that this code imports jQuery from Google before importing CLI Links. If you'd rather use a local copy, a different version, or the version that KoL already imports, you can change or omit the first <script> tag accordingly. Note that jQuery is included with ZLib, so you can simply import "jquery1.10.1.min.js" if you already have ZLib.
    Originally Posted by zarqon View Post

    Perhaps I'm a little too n00bish to be running such a powerful script. Perhaps, I just don't understand why the earth takes 24 hours to spin. Perhaps I don't understand why everyone thought there was a dark side of the moon, when every time it passes by the sun, it gets plenty of light...

    I'm not sure how to import this into my script properly. I've tried a few variations, but can't seem to get it to work... Can someone please tell me EXACTLY what command I SHOULD be using?

    import <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    import "<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>"
    import "src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    Can't get 'em to work properly.

    EDIT:
    PHP Code:
    <html><head>
    <
    script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="clilinks.js"></script>
    </html> 
    I looked through the thread some more, and I'm pretty sure this will work.

    Though, I'm not sure how to do what I'm trying to do...

    Here's what I wrote:
    PHP Code:
        if((get_property("stenchAirportAlways") == "true" || get_property("_stenchAirportToday") == "true") && item_amount($item[bag of park garbage]) > && get_property("_dinseyGarbageDisposed") == "false")
        {
        
    print_html("You can still <font color=FF0000>Dispose Dinsey Garbage</font>");
        
    print_html("<a href="place.php?whichplace=airport_stench&action=airport3_tunnels>\n<a href="choice.php?pwd&whichchoice=1067&option=6" class="clilink through">Dinsey Garbage</a>
        } 
    I'm not sure how to get the script to run 2 commands instead of a single.
    Last edited by Pazleysox; 08-12-2017 at 06:10 PM.

  9. #19
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,491

    Default

    In your edit to your post, the HTML for including the scripts looks good, although you need a closing </head> tag and are missing <body></body> tags for your content.

    As for doing a command, are you trying to execute the CLI command "Dinsey Garbage"? Because that's what your second link will do, after which it will visit choice.php. Your first link is not a CLI link, and is missing its closing </a>.

    What are you trying to do?
    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  10. #20
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    In your edit to your post, the HTML for including the scripts looks good, although you need a closing </head> tag and are missing <body></body> tags for your content.

    As for doing a command, are you trying to execute the CLI command "Dinsey Garbage"? Because that's what your second link will do, after which it will visit choice.php. Your first link is not a CLI link, and is missing its closing </a>.

    What are you trying to do?
    Originally Posted by zarqon View Post
    I've tried this:
    PHP Code:
    void main(){
    <
    html><head>
    <
    script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="clilinks.js"></script>
    </html></head> 
    Which gives this error: Script parsing error (0TEST.ash, line 1)
    and this:
    PHP Code:
    <html><head>
    <
    script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="clilinks.js"></script>
    </html></head>
    void main(){ 
    Which gives this error: Expected }, found < (0TEST.ash, line 2)

    As far as what I'm trying to do, is give the user the option to dump park garbage, with the choice adventure. In my experience of scripting, Mafia needs to be directed to the location where the choice adventure is, then you can perform the choice action, hence the 2 .php locations.

Similar Threads

  1. KoLMafia will not open links to anything including Relay Browser
    By AggiePunbot in forum Community Support
    Replies: 5
    Last Post: 07-29-2015, 07:08 AM
  2. Feature - Implemented Relay links for the untinkerer
    By Erich in forum Bug Reports
    Replies: 1
    Last Post: 01-16-2013, 04:27 AM
  3. Bug - Fixed Links broken in relay browser after Louvre automation
    By Idran in forum Bug Reports
    Replies: 10
    Last Post: 02-29-2012, 05:33 AM
  4. Replies: 1
    Last Post: 07-24-2010, 10:17 PM
  5. A request for additional topmenu links in Relay Browser
    By Cams in forum Community Support
    Replies: 5
    Last Post: 07-04-2009, 12:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •