Personal script settings (no need to edit scripts)

raorn

Member
Many scripts require editing to set some internal settings. Therefore it's hard for end user to update such scripts to a new version.

Here's mini-library for using personal script settings. How to use it?

Code:
import <scriptproperty.ash>;

string scriptname = "MyCoolScript";

boolean some_option = to_boolean(get_script_property(scriptname, "SomeOption", "false"));
int some_other_option = to_int(get_script_property(scriptname, "SomeOtherOption", "666"));
string yet_another_option = get_script_property(scriptname, "YetAnotherOption");

// My Cool Code

This code will check preferences for "script_MyCoolScript_SomeOption", "script_MyCoolScript_SomeOtherOption" and "script_MyCoolScript_YetAnotherOption" and set appropriate variables. If such property does not exist, it will be set to default value (first and second example) or to null string (third example).

Visit javascript:void(mainpane.location="script_settings.php"); url for more fun ;-)

Property format is subject to discuss.



Update 2008.03.12 17:10 GMT: web-based UI for editing custom settings (OMG!). scriptproperty.ash goes to lib/, script_settings.ash to relay/!
Update 2008.03.15 13:00 GMT: moved to HTML lib.
Update 2008.03.25 18:15 GMT: added frame to account settings page.
 

Attachments

  • scriptproperty.ash
    1.8 KB · Views: 82
  • account.ash
    370 bytes · Views: 89
  • account_settings.ash
    1.1 KB · Views: 81
  • script_settings.ash
    1.8 KB · Views: 87

raorn

Member
OMG! PONIES! I just wrote ASH web application that runs on KoLmafia Relay Server. I feel weird...

Download scripts from first post, put scriptproperty.ash to lib/ and script_settings.ash to relay/ folders. Then paste ``javascript:void(mainpane.location="script_settings.php");'' to your browser URL bar and hit Enter...

It will not send anything to KoL servers.

Screenshot (115k).
 

raorn

Member
This is fun, but it only allows simple string options to be edited. On the other hand, in relay "helpers" main() function is never used, so i decided to make simple HTML generation library (maybe something like Ruby on Rails' ActionView::Helpers class) and put script settings into script itself. This will allow to create fancy shmancy option pages. I'll post some code later.
 
[quote author=raorn link=topic=1501.msg7580#msg7580 date=1205341714]
OMG! PONIES! I just wrote ASH web application that runs on KoLmafia Relay Server. I feel weird...

Download scripts from first post, put scriptproperty.ash to lib/ and script_settings.ash to relay/ folders. Then paste ``javascript:void(mainpane.location="script_settings.php");'' to your browser URL bar and hit Enter...

It will not send anything to KoL servers.

Screenshot (115k).
[/quote]

I can see the potential in this to grow into something great! I haven't tested it yet, but the screenshot looks cool.

I can see one potential upgrade to make it more user-friendly. Add a link to the newly created page on the account menu, or in the menu pane. I myself will probably add it to my personal copy of bottommenu.
 

raorn

Member
[quote author=efilnikufecin link=topic=1501.msg7688#msg7688 date=1206332157]I can see one potential upgrade to make it more user-friendly. Add a link to the newly created page on the account menu, or in the menu pane.[/quote]

Account page looks more reasonable, since relay scripts can have it's own configuration page. I'll do it.
 
Top