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

Thread: Clickable CLI links ?

  1. #11
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    220

    Default

    print_html may be useful.
    Originally Posted by heeheehee View Post
    Nope... Unless I'm missing the command that makes the link useful, other than copy/paste, which the "print" command works just fine

  2. #12
    Senior Member AlbinoRhino's Avatar
    Join Date
    May 2008
    Posts
    681

    Default

    PHP Code:
    print_html("Link here: <a href=\"http://kol.coldfront.net/thekolwiki/index.php/Deck_of_Every_Card_(Effects_Table)\">Deck effects</a>"); 

  3. #13
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    220

    Default

    PHP Code:
    print_html("Link here: <a href=\"http://kol.coldfront.net/thekolwiki/index.php/Deck_of_Every_Card_(Effects_Table)\">Deck effects</a>"); 
    Originally Posted by AlbinoRhino View Post
    Absolutely perfect! I'll release the script in a few days after some more testing.

  4. #14
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    220

    Default

    Next question:

    I found this script somewhere (I don't remember where), so it's been mostly written by others, and updated by someone else, then updated again by me.

    There's a bunch of checks in the script already , but I want to add a new check, and don't know where to get the information from.

    PHP Code:
        if(get_property("_witchessBuff") == "false")
        {    print(
    "You can still get your Witchess Puzzle Buff""red");    }
        if(
    contains_text(body,"telescope")&&!to_boolean(get_property("telescopeLookedHigh"))) 
        {    print(
    "You can still use your telescope buff today""red");    }
        if(
    contains_text(body,"_free.gif"))
            {    print(
    "You haven't used all of your free disco rests""red");    } 
    I just pulled a few random checks from the script, the above commands do work, and there is a visit_url in place to point the script in the correct direction to find these items. (written by others)

    I wanted to put in a check for "License to Chill", I understand what the commands are doing, and HOW they work, but don't know how, or where to find the information on how to check if the license has been used, or not used.

  5. #15
    Senior Member AlbinoRhino's Avatar
    Join Date
    May 2008
    Posts
    681

    Default

    Next question:

    I found this script somewhere (I don't remember where), so it's been mostly written by others, and updated by someone else, then updated again by me.

    There's a bunch of checks in the script already , but I want to add a new check, and don't know where to get the information from.

    PHP Code:
        if(get_property("_witchessBuff") == "false")
        {    print(
    "You can still get your Witchess Puzzle Buff""red");    }
        if(
    contains_text(body,"telescope")&&!to_boolean(get_property("telescopeLookedHigh"))) 
        {    print(
    "You can still use your telescope buff today""red");    }
        if(
    contains_text(body,"_free.gif"))
            {    print(
    "You haven't used all of your free disco rests""red");    } 
    I just pulled a few random checks from the script, the above commands do work, and there is a visit_url in place to point the script in the correct direction to find these items. (written by others)

    I wanted to put in a check for "License to Chill", I understand what the commands are doing, and HOW they work, but don't know how, or where to find the information on how to check if the license has been used, or not used.
    Originally Posted by Pazleysox View Post

    PHP Code:
    if ( !get_property("_licenseToChillUsed").to_boolean() ) { ??? } 
    I suspect that many of the checks in that old script can be replaced by checks of mafia properties rather than visiting pages and looking for text. Most once per day activities have an associated mafia property that can be checked like the above. To find the property name you want, use the "prefref" command in the CLI. For instance, "prefref chill".

  6. #16
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    220

    Default

    PHP Code:
    if ( !get_property("_licenseToChillUsed").to_boolean() ) { ??? } 
    I suspect that many of the checks in that old script can be replaced by checks of mafia properties rather than visiting pages and looking for text. Most once per day activities have an associated mafia property that can be checked like the above. To find the property name you want, use the "prefref" command in the CLI. For instance, "prefref chill".
    Originally Posted by AlbinoRhino View Post
    Looking at the script, this is correct. I was testing out my new found knowledge of the PREFREF today, and it's very useful! Is there a BIG advantage to updating the whole script from this:
    PHP Code:
        string body visit_url("clan_viplounge.php?action=pooltable");
        if(
    is_unrestricted("pool table") && contains_text(body,"You approach the pool table")&&!contains_text(body,"quite a bit")) 
        {    
    print_html("You can still <font color=FF0000>Play Pool</font> today");    } 
    to this:
    PHP Code:
        if ( get_property ("_poolGames") <= )
        {    
    print_html("You can still <font color=FF0000>Play Pool</font> today");    } 
    I'm going to update the script to the new way regardless, because I like it, and I need something to do (lol), but I'm thirsty for knowledge.

    Also, I'm trying to figure out how to do a check for clovers.

    Here's how the script does it now. I've been looking at the prefref command for clovers, before and after the hermit has been visited...

    PHP Code:
        string body visit_url("/hermit.php");
        
        if(
    contains_text(body,"left in stock")) {
            
    print_html("You can still get <font color=FF0000>Clovers</font> from the Hermit today");
        } 

  7. #17
    Developer
    Join Date
    Apr 2010
    Posts
    4,051

    Default

    The BIG advantage is that you get the result without requesting a server update, so fewer hits against KoL and faster speed.

    The disadvantage is it would potentially get out of sync with KoL and be wrong (though that'd usually be a mafia bug to be reported or because you visited outside mafia or with a text changing effect active).

  8. #18
    Senior Member AlbinoRhino's Avatar
    Join Date
    May 2008
    Posts
    681

    Default

    I think you'll have to stick with the page visit to check the hermit. Even if mafia collects them all during breakfast, it is possible that a hermit script has been used afterward and there is another clover available at the end of the day.

    Also, get_property() returns a string. To compare against an int you would want to use:

    if ( get_property ("_poolGames").to_int() <= 2 )

    or

    if ( to_int(get_property ("_poolGames")) <= 2 )

    whichever you prefer.

  9. #19
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    220

    Default

    Also, get_property() returns a string. To compare against an int you would want to use:

    if ( get_property ("_poolGames").to_int() <= 2 )

    or

    if ( to_int(get_property ("_poolGames")) <= 2 )

    whichever you prefer.
    Originally Posted by AlbinoRhino View Post
    I coded the
    if ( get_property ("_poolGames").to_int() <= 2 ) with, and without the .to_int(), and I get the same results either way. Is this supposed to happen? What is the down side of not using the .to_int()?
    EDIT: It seems that the .to_init() only works when a number is returned...

    Also, I'm trying to figure out a way to see if the spacegate has been used yet or not. I'm running into a ton of trouble getting it coded properly.

    Here's a few things I've tried:
    PHP Code:
        if (get_property("spacegatehazards").to_int == "toxic atmosphere" || get_property("spacegatehazards") == "high gravity" || get_property("spacegatehazards") == "magnetic storms" || get_property("spacegatehazards") == "irradiated" || get_property("spacegatehazards") == "high winds")
        { print(
    "spacegate open"); }

        if (
    get_property("spacegatehazards") == "toxic atmosphere")
        { print(
    "spacegate open"); }
        if (
    get_property("spacegatehazards").to_int == "toxic atmosphere")
        { print(
    "spacegate open"); }
        if (
    get_property("spacegatehazards") == "")
        { print(
    "spacegate not open"); } //this worked...  wait a second!  I think I have it now! 
    ok. Typing this all out lead me to this:
    PHP Code:

        
    if (get_property("_spacegateHazards") == ""
        {    print (
    "your space gate is not open");    }
        else if (
    get_property("_spacegateTurnsLeft") >= 20)
        {    print (
    "your space gate is open, and you have turns left");    } 
    Which seems to have worked, though my gate is open.

    EDIT2: It seems mafia does track turns, but only after the terminal's URL has been accessed. I know how I can work with this now.
    Last edited by Pazleysox; 08-03-2017 at 01:31 PM.

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

    Default

    How can I pull the information from a get_property, and then display it in a print("");?

    IE:
    else if (get_property("_spacegateTurnsLeft") >= 20)
    { print ("your space gate is open, and you have " + spacegateTurnsLeft + " turns left"); }

Posting Permissions

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