Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Spam graffiti on Lyle's tracks. He asked for it! */
- int choice_number_by_text(string page_text, string identifier)
- {
- /* Stolen from Ezandora's lylefarm.ash */
- foreach s in $strings[?,(,)]
- identifier = identifier.replace_string(s, "\\" + s); //FIXME remove/escape other grepables
- string [int][int] matches = page_text.group_string("value=\"?([0-9]*)\"?><input [ ]*class=button type=submit value=\"" + identifier);
- int choice_id = matches[0][1].to_int();
- return choice_id;
- }
- boolean run_choice_by_text(string page_text, string identifier)
- {
- int choice_id = choice_number_by_text(page_text, identifier);
- if ( choice_id <= 0 )
- return false;
- run_choice(choice_id);
- return true;
- }
- void main(string message, int chisels_to_use) {
- print_html("Going to Lyle's");
- buffer page_text =
- visit_url("place.php?whichplace=town_right&action=townright_lyle");
- print_html("Loaded Lyle's");
- if ( !page_text.contains_text("Grab a Chisel.") ) {
- print_html("No option to use a chisel available. We are done!");
- run_choice_by_text(page_text, "\"No Thanks.\"");
- return;
- }
- int grab_choice_id = choice_number_by_text(page_text, "Grab a Chisel.");
- print_html("grab a chisel option: " + grab_choice_id);
- string url = "choice.php?whichchoice=1263&pwd&option=" + grab_choice_id;
- page_text = visit_url(url, true, false);
- if ( !page_text.contains_text("Chisel It") ) {
- print_html("No Chisel It option -- no clue what's happening!");
- return;
- }
- while ( chisels_to_use-- > 0 ) {
- buffer new_page = visit_url("choice.php?whichchoice=1268&option=1&pwd=" + my_hash() + "&m=" + url_encode(message), true, true);
- print_html(chisels_to_use + " left");
- waitq(1); // Don't hammer the servers, one chisel a second
- }
- print_html("Done.");
- }
Advertisement
Add Comment
Please, Sign In to add comment