Results 1 to 9 of 9

Thread: Source Terminal preferences

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

    Default Source Terminal preferences

    Is there a way to pull a specific preference out of a list?

    IE:
    PHP Code:
        if(get_property("sourceTerminalChips") == "TRAM,DRAM,CRAM,INGRAM,ASHRAM,DIAGRAM,SCRAM,TRIGRAM")
        print(
    "trigram 3x");
        if(
    get_property("sourceTerminalChips") == "TRAM")
        print(
    "trigram 2x"); 
    results in this:

    trigram 3x

    ... Is there a way to check for just the TRAM, or just TRIGRAM, or any other single chip?

    EDIT: It seems that mafia records them in the order they were installed
    A Clannie had this:
    DRAM,INGRAM,DIAGRAM, ASHRAM,SCRAM,TRIGRAM
    then installed a TRAM, and gets this:
    DRAM,INGRAM,DIAGRAM, ASHRAM,SCRAM,TRIGRAM ,TRAM
    Last edited by Pazleysox; 08-13-2017 at 01:50 PM.

  2. #2

    Default

    You could use
    Code:
    if(get_property("sourceTerminalChips").contains_text("TRAM"))
    to see if it's anywhere in the string.

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

    Default

    You could use
    Code:
    if(get_property("sourceTerminalChips").contains_text("TRAM"))
    to see if it's anywhere in the string.
    Originally Posted by lostcalpolydude View Post
    Such a simple fix, that I completely didn't think of.

    Thank you.

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

    Default

    PHP Code:
        if(get_property("sourceTerminalChips").contains_text("TRAM") && (get_property("sourceTerminalChips").contains_text("TRIGRAM") && (get_property("_sourceTerminalExtrudes").to_int() <= )))
            {
            
    print_html("1You can still use your Source Terminal to <font color=FF0000>Extrude</font> something");
            }
                else if (
    get_property("sourceTerminalChips").contains_text("TRAM") || (get_property("sourceTerminalChips").contains_text("TRIGRAM") && (get_property("_sourceTerminalExtrudes").to_int() <= )))
                {
                
    print_html("2You can still use your Source Terminal to <font color=FF0000>Extrude</font> something");
                }
                else if (
    get_property("_sourceTerminalExtrudes").to_int() == && (is_unrestricted($item[Source Terminal])))
                {
                
    print_html("3You can still use your Source Terminal to <font color=FF0000>Extrude</font> something");
                } 
    Even though my _sourceTerminalExtrudes == 3, I'm still getting the printout from #2

    Does anyone see where my mistake is?

  5. #5

    Default

    I expect that A || B && C is not evaluating how you expect, and that you should add more parentheses.

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

    Default

    I expect that A || B && C is not evaluating how you expect, and that you should add more parentheses.
    Originally Posted by lostcalpolydude View Post
    I figured out what you meant by not evaluating how I expect.

    Someone showed me once how to write this without so many parentheses, but I don't remember where the post is.

    EDIT:
    ...
    I wonder WHO could have been so helpful in the past? (lol)
    http://kolmafia.us/showthread.php?21...l=1#post139349
    Last edited by Pazleysox; 08-14-2017 at 01:00 PM.

  7. #7

    Default

    I did point out that you should use them when you mix && and ||.

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

    Default

    Hmm... not sure why this is happening. Bug maybe? Something I'm doing wrong? (Not sure how that's possible)

    this code does not work.
    PHP Code:
        if($item[Source Terminal].available_amount() >= && get_property("sourceTerminalGram").to_int() == 
    this code DOES work though
    PHP Code:
        if(get_property("sourceTerminalGram").to_int() == 
    The script I'm working on has a bunch of other locations where "$item[Source Terminal].available_amount() >= 1" is used, and works every location. I've even gone so far as to put this short piece of code into a script by itself, and it fails each time, until I use the second example.

  9. #9

    Default

    Maybe it stopped working because you decided to sell the Source Terminal in your inventory?
    Code:
    get_campground() contains $item[source terminal]
    is what you should be checking instead.

Posting Permissions

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