Source Terminal preferences

Pazleysox

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

IE:
PHP:
	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:

lostcalpolydude

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

Pazleysox

Member
PHP:
	if(get_property("sourceTerminalChips").contains_text("TRAM") && (get_property("sourceTerminalChips").contains_text("TRIGRAM") && (get_property("_sourceTerminalExtrudes").to_int() <= 2 )))
		{
		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() <= 1 )))
			{
			print_html("2You can still use your Source Terminal to <font color=FF0000>Extrude</font> something");
			}
			else if (get_property("_sourceTerminalExtrudes").to_int() == 0 && (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?
 

Pazleysox

Member
Last edited:

Pazleysox

Member
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:
	if($item[Source Terminal].available_amount() >= 1 && get_property("sourceTerminalGram").to_int() == 0 )

this code DOES work though
PHP:
	if(get_property("sourceTerminalGram").to_int() == 0 )

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.
 

lostcalpolydude

Developer
Staff member
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.
 
Top