Relay browser add-on: bottom menu

I have long wanted to put a bottom menu to kol, but did not want to bad enough to put a huge effort into writing a greasemonkey script to do it. Since Holatuwol posted this message: http://kolmafia.us/index.php/topic,730.msg3497.html#msg3497 It became really easy for me to do.

I added a bottom menu to the relay browser with only 4 links so far. 1 will get you to this sight, 1 will take you to the kingdom of loathing wiki, 1 will take you directly to the mall search page with the last search, and finally my favorite will refresh the charpane whenever you think it need be with only a quick click instead of right-click, select "this frame", find "reload frame" left click.

Anyway, the base leg-work is done, and if someone wanted to add to the list of items, or remove some it's rather simple to do. I started with the top menu, so there are a lot of commented lines which are left for future references.

Edit: I forgot to mention, main.html will also cause chat to start on it's own when the relay browser is started.
 

Attachments

  • bottommenu.html
    2.1 KB · Views: 147
  • main.html
    660 bytes · Views: 191
I'm interested in going further with the bottom menu in that I would like to create a hardcore checklist similar to this but have check boxes which the user would be able to check and uncheck. The checklist would load in the main pane (adventure pane) but the problem is keeping the checked state across sessions. The thought crossed my mind of writing a script to maintain this, and execute the url for the cli command to do this, but scripts do not have an easy way of saving and retrieving data to and from a file. Does anyone have any suggestions that will fit this purpose?
 
[quote author=Ethelred link=topic=738.msg3571#msg3571 date=1170556488]
Sounds like a good use for get and set property to me.
[/quote]

It would be except that I need to read it in html and that would be near impossible since the files changed by get and set property are not in the html folder and the method of accessing the files is limited to the html folder. I'll point out that this isn't a kolmafia script we are talking about here, but actual html files for the relay browser.
 

holatuwol

Developer
If you really want to use scripting to do it...

int [item] my_data;

my_data[ $item[spices] ] = $item[spices].item_amount();
my_data[ $item[seal tooth] ] = $item[seal tooth].item_amount();

# By default, all maps are written to the "datamaps"
# folder in the "scripts" folder, so you need to go
# back two directories to enter the real HTML folder.

my_data.map_to_file( "../../html/items.txt" );


In the next release of KoLmafia, you won't have to use the ".." trick to get things to work (though it still will).  In case you were wondering how to invoke CLI commands via your own web pages, read through the source of cli.html.

I should add that your solution would require a little bit of AJAX, which isn't necessarily the most intuitive thing to code (reading through a Greasemonkey script will tell you that much).  I should also add, that if you want to submit a CLI command somewhere in your HTML files, the URL KoLmafia needs to see is one that looks like this:

/KoLmafia/submitCommand?cmd=call my_script(spices)

You could then have a script called "my_script.ash" which looks a little like this.

void main( item toggle )
{
   string new_value = "true";
   string property_name = "_checkbox_" + toggle;

   if ( get_property( property_name ) == "true" )
       new_value = "false";

   set_property( property_name, new_value );
}


At some level, it's probably easier to just write a Greasemonkey script to handle checklists, and then combine that with knowledge of how KoLmafia allows you to invoke scripts and change files dynamically, in order to do what you're doing.
 
I think that just a page which uses cookies with a long wait till the expire date would be best, however I would like to make it handle more than 1 character on the same machine so I will probably need to do some more thinking on it. Cookies looks like the best way to go though.
 
Top