User:Out of practice

From Kolmafia
Revision as of 07:07, 10 September 2009 by imported>Out of practice (A new page, just for me, just about me! :))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

My Details

I've been a long time KoL player (back since the summer of 04' I believe), and easily regard it as one of the most fun games I've played. Although I seem to have forgotten KoL's "casual game" status (yeah, right) in the mean time, it is definitely a fun way to pass the time. Which works out well, since while I'm here in New Zealand for the year without a powerful computer, KoL is literally the only game I can play at the moment.


KoLMafia Wiki Stuffs

I'm not the best coder by a long shot, but I've decided to help with the definition pages. If I were just a bit better at phrasing things, I'd say the ones I've written were epic! Well, they're not Nobel quality, but they are functional (and informational) for sure. Or should be. Wow, I make myself sound horrible at writing them here... xD


My Scripts and/or Scripting Examples (Here on the Wiki)

Because personalized questions are for squares: (My map_to_file() example code)

#The "What do you like?" script, v9.23b

#First, a declaration of the custom class (for use as the map's slices)
record personal_preference {
   string item_name;
   boolean like_it;
};

#Next, we fill out the .item_name field of the map slices we're using. These will be used later as a plugin for the questions.

personal_preference[int] likes_and_dislikes;
likes_and_dislikes[1].item_name = "Toffee";
likes_and_dislikes[2].item_name = "Sunshine";
likes_and_dislikes[3].item_name = "Onions";
likes_and_dislikes[4].item_name = "Sleep Deprivation";
likes_and_dislikes[5].item_name = "The Kingdom of Loathing";

#We set up a loop with a 'counter' variable, and tell it to go from "q = 1" all the way to "q = [Number of keys in the map]"
for q from 1 upto count(likes_and_dislikes) {
   
   #We create a pop-up confirmation "dialogue box", which (by its KoLMafia definition) will present the user with yes/no options
   if( user_confirm( "Do you like "+likes_and_dislikes[q].item_name+"?" ) == true ) likes_and_dislikes[q].like_it = true;
}

print( "Survey completed successfully! We appreciate your input!" , "Green" );

#Finally, we save the map (questions, answers, and all) to "user_preference.txt" in the KoLMafia\Scripts\ directory,
#While enclosing it in an if() statement, so that were the save to fail, a message notifying the user of the failure will be printed
if( map_to_file( likes_and_dislikes , "user_preference.txt" ) == false ) print( "Your completed survey failed to save." , "Red" );


Deep down, we all want KoLMafia to spontaniously break into song: (My file_to_map() example code)

#Loading (and displaying) an arbitrary map from a file
string[int] favorite_things;

if( file_to_map( "ponies_and_candycanes.txt" , favorite_things ) )
{
   print( "All of your favorite things have come here to KoLMafia to play! Yay! There's:" , "#FF6666" );
   for cycle from 1 upto (count(favorite_things)-1)
   {
      print( ""+favorite_things[cycle]+", and..." , "#FF00CC" );
   }
   print( ""+favorite_things[count(favorite_things)]+", oh my!" , "#FF00CC" );
}
else
{
   print( "Your favorite things failed to load. Apparently they don't love you back." , "Red" );
}

# Will result (in my case) in the following being printed (in bright pinks):
#
# All of your favorite things have come here to KoLMafia to play! Yay! There's:
# Sunshine, and...
# Cabbage, and...
# The Sound of Music, and...
# Nuns blowing up, and...
# Waking up bleeding in the alley, and...
# Finding out your lover is a really a transvestite, oh my!