.ASH command to look at user preferences

Pazleysox

Member
I know that session_logs() can look at my logs for information from my previous sessions, but is there a way to look up info in your personal settings?

ie: settings\pazsox_prefs.txt

I have need for some of the information in there for a script I want to write, but don't know how to get the script to look there. I know already how to use cotains_text(), to get the info I want.

-Paz
 

Pazleysox

Member
You can use get_property() to get a specific setting. Veracity just added a bunch more functions, listed here.

ok, I've found everything Veracity added. I even found the Get_property() page. It's interesting what this can do! I'm trying to figure out how to read what the get_property() returns. I've used the command "get (property)" in the cli, and it returns the info I'm looking for, but I don't know how to get it in the script.

IE:
Code:
get_property ("guyMadeOfBeesCount")
if [guyMadeOfBeesCount] == 0
{print ("It's 0");}
else {print ("It's other than 0");}

I'm sure it's pretty simple...
 

lostcalpolydude

Developer
Staff member
Code:
if ( get_property( "guyMadeOfBeesCount" ) == 0 )
{
	print( "It's 0" );
}

Also, get_property() returns a string. Apparently "0" == 0 returns true, but to_int( get_property( "guyMadeOfBeesCount" ) ) is probably a better idea in general.
 

ckb

Minion
Staff member
Also, get_property() returns a string. Apparently "0" == 0 returns true, but to_int( get_property( "guyMadeOfBeesCount" ) ) is probably a better idea in general.

This. I have gotten into trouble because of this. Use this:
Code:
to_int( get_property( "guyMadeOfBeesCount" ) ) == 0
OR:
Code:
get_property( "guyMadeOfBeesCount" ) == "0"
 

Theraze

Active member
Just be aware that the first can give you inaccurate results.
> ash (to_int( get_property( "guyMadeOfBeesCount" ) ) == 0)

Returned: true

> ash (to_int( get_property( "guyMadeOfBeesCounted" ) ) == 0)

Returned: true

> ash (to_int( get_property( "fluffyBunniesAreBees" ) ) == 0)

Returned: true
When we check against the second, we get a different result.
> ash (get_property( "guyMadeOfBeesCount" ) == "0")

Returned: false

> ash (get_property( "guyMadeOfBeesCounted" ) == "0")

Returned: false

> ash (get_property( "fluffyBunniesAreBees" ) == "0")

Returned: false
And when we look...
> ash (get_property( "guyMadeOfBeesCount" ))

Returned:
So use the first when you're checking values above 0. Use the second when you're checking 0 values or ones that might be wrong. Use the third to make sure whatever you're checking is real for that character. FYI, the login screen doesn't have GMOB counts. :)
 

xKiv

Active member
IIRC, this is because comparing string with int "upgrades" the int to another string.
So if the string is "0", then "0" == 0 becomes "0" == "0" which is true.
If the property does not currently have a value, the string is empty, and get_property(...) == 0 becomes "" == "0", which is not true.

This becomes even more funny when you are testing comparison. 13 > 3, but "13" < 3 because "13" < "3".
 

Pazleysox

Member
PHP:
string [int] log = session_logs(3);
foreach day in log
{
	print( "Parsing day " + day + "..." ); 
	if ( log.contains_text( "engagement ring" )) 
	{print ("You have killed Lot's Wife");}
	else {print ("You have not killed Lot's Wife");}
}
returns this:
Code:
Parsing day 0...
You have not killed Lot's Wife
Parsing day 1...
You have not killed Lot's Wife
Parsing day 2...
You have not killed Lot's Wife

Even though I have killed lot's wife 1 day ago...
 

Theraze

Active member
You are aware that you're checking the same thing (log) three times, without any difference? From the looks of things, you'd need to do log[day].contains_text to actually get a specific subset of session log...
 

Pazleysox

Member
Thanks Theraze, worked like a dream!

I know there's a command to write when a user last ascended, or how many days they've been in current run. How can I incorporate that?

string [int] log = session_logs([days in this ascension]);
 

Pazleysox

Member
Thanks Theraze (again)! That's exactly what I was looking for. I've got it working properly (now that I understand what they were looking at. lol)
 
Last edited:

Pazleysox

Member
Very disheartening when you want to write a script, but can't get it to do what you want... :(

Here's my code:
PHP:
int days = my_daycount();
string name = my_name();
print("It has been "+ days +" day(s) since "+ name +"'s current ascension began.");

string [int] log = session_logs( my_name(), 6);
foreach day in log

{
	print( "Parsing " + day + " day(s) ago" ); 
	if ( log[day].contains_text( "engagement ring" ))
	{print ("You have killed Lot's Wife", "Green");}
	else {print ("You have not killed Lot's Wife", "red");}

the line: "string [int] log = session_logs( my_name(), 6);" The 6 is irrelevant. It's just a place holder, so i can look back 6 days, rather than my_daycount(), which will only look back 1 day (and won't help at all)


here's my output:
Code:
Parsing 0 day(s) ago
You have not killed Lot's Wife
Parsing 1 day(s) ago
You have killed Lot's Wife
Parsing 2 day(s) ago
You have not killed Lot's Wife
Parsing 3 day(s) ago
You have killed Lot's Wife
Parsing 4 day(s) ago
You have killed Lot's Wife
Parsing 5 day(s) ago
You have not killed Lot's Wife

How can I get just 1 output, instead of 6? The "You have killed Lot's Wife" will eventually be taken out, as will the "Parsing X day(s) ago" It's just in there for ease of viewing.
 
Last edited:

Theraze

Active member
Use a boolean to detect if you've done it.
Code:
int days = my_daycount();
string name = my_name();
boolean deadwife = false;
print("It has been "+ days +" day(s) since "+ name +"'s current ascension began.");

string [int] log = session_logs( my_name(), days);
foreach day in log
{
    print( "Parsing " + day + " day(s) ago" ); 
    if ( log[day].contains_text( "engagement ring" ))
        deadwife = true;
}

if (deadwife) {print ("You have killed Lot's Wife", "Green");}
else {print ("You have not killed Lot's Wife", "red");}
 
Top