Downstairs manor status

lostcalpolydude

Developer
Staff member
This script shows you the status of things in the manor (library locked, library open, gallery key available, gallery open) and whether the upstairs manor is open when you look at the downstairs manor. Put it in the /relay folder and visit the manor to see it.
 

Attachments

  • manor.ash
    1.3 KB · Views: 118
Last edited:

fronobulax

Developer
Staff member
Index out of bounds error. Character has opened manor but never ascended in case that's an edge case. Will try and grab details tomorrow when I can try it again.
 

lostcalpolydude

Developer
Staff member
The script looks for a </table> tag to insert things after. I guess if it doesn't find that, it could just throw stuff at the very end and browsers will probably figure it out anyway. I just checked with an unascended character (I had to open the manor) and it works fine for me.
 

Bale

Minion
Nice! I added a little bit to my copy...

Code:
buffer results;
results.append( visit_url() );

int index = index_of( results, "</table>" ) + 8;
string infoString;
if ( item_amount( $item[spookyraven gallery key] ) > 0 ) infoString = "Gallery open";
else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() ) infoString = "Gallery key available";
else if ( item_amount( $item[spookyraven library key] ) > 0 ) infoString = "Library open";
else infoString = "Library locked";

if ( !results.contains_text( "manor2.php" ) ) infoString += "<br>Upstairs closed";
[B][COLOR="#0000CD"]else infoString += "<br>Upstairs open";

infoString = '<div style="text-align:center;color:blue;font-family:serif">' + infoString + '</div>';[/COLOR][/B]

insert( results, index, infoString );

results.write();
 

fronobulax

Developer
Staff member
Index 7 out of bounds (relay_manor.ash, line 13)

Different character. Browser is Firefox. Not sure what other information might help at the moment.
 

fronobulax

Developer
Staff member
Actually, it appears to be my problem but it isn't. I was experimenting to see whether it was supposed to be a relay script and just copied the wrong error message.

> call [excised]\scripts\manor.ash

Index 7 out of bounds (manor.ash, line 13)
 

lostcalpolydude

Developer
Staff member
You're not using it as a relay script then. The first part is
PHP:
results.append( visit_url() );
If you try to use it any way besides in the browser, visit_url() is going to return an empty string, I would expect (or maybe null, which probably amounts to the same thing here).

The only way you can use the script the way it's intended to be used and get the exact error message you have there is if manor.php is less than 7 characters, and if that's happening then there's something seriously wrong since you say the manor is open. Even if the page doesn't have </table> on it, the script screws up in a way that doesn't generate an error.
 

fronobulax

Developer
Staff member
Let's pretend that I really am the uninformed idiot I am acting like and back up a bit.

How do I use this? I download it and then what? Put a copy in my scripts directory? In my relay directory? Somewhere where mafia scripts are not normally found?

Given that it is in the right place, how do I run it? From the mafia scripts menu or the gCLI? Do I just visit the manor in the relay browser? Do I have to invoke it from the scripts drop down in the relay browser (where it did not appear for me which is why I performed my renaming experiment).

Do I have to set a mafia preference?

For the record, I downloaded it, placed it in scripts and ran from the scripts menu. If that is not the correct thing to do then what is? I tried variations on the above with no success so I have to be missing something pretty basic.

Thanks.
 

Erich

Member
Put it in your relay folder. Then do nothing, because it just adds info to the manor. The end!
 

fronobulax

Developer
Staff member
I put in the relay folder.

Nothing happens when I visit the manor in the relay browser.

But... that is with a character who has opened everything. When I tried with a much less experienced character and looked at the manor in the relay browser I saw
library open
upstairs closed
which seems like something has happened.

So I guess this leads to two things:

One is that the instructions could be a little clearer at least in terms of where it goes.

The second is a feature request to change the output so that all status values are always shown.

For example:

library locked/open
gallery key not found/found
gallery closed/open
upstairs closed/open
downstairs closed/open

and so on. The latter is definitely a UI type of preference but there is room on the screen and it gives me the fuzzy feeling that the script is doing something.
 

Bale

Minion
I approve of fronobulax's feature suggestion. The following is what my copy currently looks like. fronobulax, please copy/paste and try it out.

Code:
buffer results;
results.append( visit_url() );

string infoString= "Library ";
if ( item_amount( $item[spookyraven library key] ) > 0 ) infoString += "open";
else infoString += "locked";

infoString += "<br>Gallery ";
if ( item_amount( $item[spookyraven gallery key] ) > 0 ) infoString += "open";
else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() ) infoString += "key available in Conservatory";
else infoString += "key requires reading at the Library";

infoString += "<br>Upstairs ";
if ( !results.contains_text( "manor2.php" ) ) infoString += "closed";
else infoString += "open";

infoString = '<div style="text-align:center;color:blue;font-family:serif">' + infoString + '</div>';
insert( results, index_of( results, "</table>" ) + 8, infoString );

results.write();
 

lostcalpolydude

Developer
Staff member
One is that the instructions could be a little clearer at least in terms of where it goes.
I assumed that was a given, based on putting the script in the Relay Override section of the forum (though it doesn't look like there's a sticky or anything that people could check for that). At least one of the files included with any thread here should go in the relay folder, otherwise the thread should be moved somewhere else.

The second is a feature request to change the output so that all status values are always shown.
It should be impossible to get no output from this script. Your character with everything open should see "gallery open". Maybe it isn't finding a </table> tag after all, and is adding it at index 7. Can you view source and see if there's some stuff added that makes no sense near the beginning of the page source, and also if the page lacks </table>?
 

Bale

Minion
No functional change, but I like the following better.

Code:
buffer manor(buffer source) {
	string infoString= "Library ";
	if ( item_amount( $item[spookyraven library key] ) > 0 ) infoString += "open";
	else infoString += "locked";

	infoString += "<br>Gallery ";
	if ( item_amount( $item[spookyraven gallery key] ) > 0 ) infoString += "open";
	else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() ) infoString += "key available in Conservatory";
	else infoString += "key requires reading at the Library";

	infoString += "<br>Upstairs ";
	if ( !source.contains_text( "manor2.php" ) ) infoString += "closed";
	else infoString += "open";

	infoString = '<div style="text-align:center;color:blue;font-family:serif">' + infoString + '</div>';
	return insert( source, index_of( source, "</table>" ) + 8, infoString );
}

void main() {
	write(manor(visit_url()));
}
 

fronobulax

Developer
Staff member
I assumed that was a given, based on putting the script in the Relay Override section of the forum

Got it. But I have no idea what forum this is in. I just click on new posts and I get a list. So while my confusion would perhaps have been resolved if I had used a different way of accessing the initial post it is still true that the location of the post is an implicit part of the documentation.
 

Bale

Minion
Here's a fun update to make it 20% cooler:

Code:
buffer manor(buffer source) {
	string check = "<span style='color:green'>&#"+10003+";</span> ";
	string batsu = "<span style='color:red'>&#"+10007+";</span> ";
	
	string info= "<div style='text-align:center;color:blue;font-family:serif'>";
	if ( item_amount( $item[spookyraven library key] ) > 0 ) info += check+ "Library open";
	else info += batsu + "Library locked";

	info += "<br />";
	if ( item_amount( $item[spookyraven gallery key] ) > 0 ) info += check+ "Gallery open";
	else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() ) info += batsu+ "Gallery key available in Conservatory";
	else info += batsu+ "Gallery key requires reading at the Library";

	info += "<br />";
	if ( !source.contains_text( "manor2.php" ) ) info += batsu+ "Upstairs closed";
	else info += check+ "Upstairs open";

	info += "</div>";
	return insert( source, index_of( source, "</table>" ) + 8, info );}

void main() {
	write(manor(visit_url()));
}

Why is that cooler? Because it looks like this!

UGZro.png
 
Last edited:

Soluzar

Member
Here's a fun update to make it 20% cooler.
That does look cool. I changed it to be left-aligned (I really don't care for center-aligned text) but it's pretty nice.

The original idea is great, and the way it's developing is pretty cool. I don't recall being confused about the status of the mansion before, but I'm going to use this just in case.
 

Bale

Minion
I'm glad it pleases you also. I just adore those little green checks and red crosses. I rarely have confusion about the status of the mansion either, but it is completely worth it for the little checks and crosses. They make the display totally awesome.
 

lostcalpolydude

Developer
Staff member
I feel like the image for stairs going up could just be replaced by the broken stairs image if upstairs isn't open yet.
 
Top