// Macro file by Drablak // Write to thoom@me.com for comments or information regarding this file // This file is to be placed in the same folder as your main character file // You must also put the following line (removing the '//') into your main char file // include "kudzu" setglobal gh_call[23] "kudzu_macro" kudzu_macro { message "* ======================" message "* Zudzu macros" message "* file: kudzu" message "* ======================" message " " message "* Zuing *" message "'kk': plants a kudzu seedling from bag <1> or equipped bag" message "'kk n': plants a kudzu seedling from bag " message "'akz n': adds a kudzu seedling to bag " message "'mkz': manage zu (fill up first bags) ONLY WHEN SAFE" message "'ckz': count carried zu" message "'skz': count carried zu and say outloud" } /* END of GHS */ /* Plant kudzu macro To use: "kk" + return to use equiped bag (or <#1> by default) or for example "kk 3" to use bag <#3>. So while running it's easy to type 'kk' and then hit return once for each planting. It doesn't switch automatically to another bag when the first is empty, you have to add the bag number then or simply equip another bag. Each character should have a global g_zu_bag_type in their variable file, one of: setglobal g_zu_bag_type "Bag of Kudzu Seedlings" // contains 10 seeds setglobal g_zu_bag_type "Pack of Kudzu Seedlings" // contains 20 seeds setglobal g_zu_bag_type "Sack of Kudzu Seedlings" // contains 50 seeds the escaped quotes '\"' are there so that the command includes quotes around the item */ "kk" { if @text != "" "/equip \"" g_zu_bag_type "<#" @text "\"\r" else if @my.left_item >= g_zu_bag_type // already have bag equipped else "/equip \"" g_zu_bag_type "<#1\"\r" end if "/useitem \"" g_zu_bag_type "\"\r" call icon_unarmed } /* Add a kudzu to your bag (specify a bag number if you don't have a bag equipped and you don't want to use #1 which is the default) */ "akz" { if @text != "" "/equip \"" g_zu_bag_type "<#" @text "\"\r" else if @my.left_item >= g_zu_bag_type // already have bag equipped else "/equip \"" g_zu_bag_type "<#1\"\r" end if "/useitem \"" g_zu_bag_type "\" /add\r" call icon_unarmed } // remove zu "rkz" { if @text != "" "/equip \"" g_zu_bag_type "<#" @text "\"\r" else if @my.left_item >= g_zu_bag_type // already have bag equipped else "/equip \"" g_zu_bag_type "<#1\"\r" end if "/useitem \"" g_zu_bag_type "\" /remove\r" call icon_unarmed } /* Manage kudzu in your bags version 1.0 by Drablak (info or comments at thoom@me.com) To use: just type "mkz" and hit return This macro first counts how many zu seedling you have and how many bags then organizes them so that the first bags are full (as much as possible). This will work with only the first 10 kudzu bags but could be modified for more. Make sure all the bags have the default name and have not been /named, i.e. they should be called "Bag of Kudzu Seedlings <#1>" for instance. If some are named just remove the name by selecting the bag in the inventory and typing "/name" and hit return. With many bags the shuffling can take some time, this is limited by the fact a bag must be equipped to add/remove zu from it. The macro removes zu from the last bags to add to the first bags. == WARNING == This is to be used only in safe situations. This may take some time depending on number of bags and zu and more importantly : ** it's a definite balance tax loader ** And be sure to have at least one item slot free if you want to use mkz as this removes a seedling from one pack before adding it to another. I go seed by seed to minimize the space required, but you still need one spot free! */ "mkz" { call icon_unarmed set loc_kudzubags 1 set loc_kudzuseeds 0 set loc_kudzuinventory[1] 0 set loc_kudzuinventory[2] 0 set loc_kudzuinventory[3] 0 set loc_kudzuinventory[4] 0 set loc_kudzuinventory[5] 0 set loc_kudzuinventory[6] 0 set loc_kudzuinventory[7] 0 set loc_kudzuinventory[8] 0 set loc_kudzuinventory[9] 0 set loc_kudzuinventory[10] 0 label do_count_zu "/selectitem \"" g_zu_bag_type " <#" loc_kudzubags "\"\r" pause 2 if @env.textlog < "Couldn't find" goto do_report end if "/examine\r" pause 2 set my_phrase @env.textlog if my_phrase < kudzu if my_phrase < empty set loc_kudzuinventory[loc_kudzubags] 0 else if my_phrase < one set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[8] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[10] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else set my_seeds my_phrase.word[10] set loc_kudzuinventory[loc_kudzubags] my_seeds set loc_kudzuseeds + my_seeds end if set loc_kudzubags + 1 if loc_kudzubags >= 11 goto do_report end if end if goto do_count_zu label do_report set loc_kudzubags - 1 set my_msg "* I have " set my_msg + loc_kudzuseeds set my_msg + " kudzu seeds in " set my_msg + loc_kudzubags set my_msg + " bags." message " " message my_msg message " " // If we have more than one bag we try to get as many full bags as possible if loc_kudzubags > 1 set my_current_bag 1 set my_last_bag loc_kudzubags if my_last_bag == my_current_bag goto the_end end if message "+ Reorganizing seeds in bags." label do_organize if loc_kudzuinventory[my_current_bag] < 10 label do_add_zu if loc_kudzuinventory[my_last_bag] > 0 "/equip \"" g_zu_bag_type " <#" my_last_bag "\"\r" pause 2 "/useitem left /remove\r" set loc_kudzuinventory[my_last_bag] - 1 pause 1 "/equip \"" g_zu_bag_type " <#" my_current_bag "\"\r" pause 2 "/useitem \"" g_zu_bag_type "\" /add\r" pause 1 set loc_kudzuinventory[my_current_bag] + 1 goto do_organize else set my_last_bag - 1 if my_last_bag > my_current_bag goto do_add_zu else message "+ Done organizing bags!" goto the_end end if end if goto do_organize else message "* Current bag is full, optimising next one" set my_current_bag + 1 if my_current_bag < my_last_bag goto do_organize else message "+ Done organizing bags!!" goto the_end end if end if end if label the_end set my_current_bag 1 label display_bags message "Bag" my_current_bag ": " loc_kudzuinventory[my_current_bag] " zu" set my_current_bag + 1 if my_current_bag <= loc_kudzubags goto display_bags end if message " " } // Check kuzdu in bags - just count them and report in message window "ckz" { call icon_unarmed set loc_kudzubags 1 set loc_kudzuseeds 0 set loc_kudzuinventory[1] 0 set loc_kudzuinventory[2] 0 set loc_kudzuinventory[3] 0 set loc_kudzuinventory[4] 0 set loc_kudzuinventory[5] 0 set loc_kudzuinventory[6] 0 set loc_kudzuinventory[7] 0 set loc_kudzuinventory[8] 0 set loc_kudzuinventory[9] 0 set loc_kudzuinventory[10] 0 label mark "/selectitem \"" g_zu_bag_type " <#" loc_kudzubags "\"\r" if @env.textlog.word[2] == "Couldn't" goto the_end end if pause 2 "/examine \r" pause 2 set my_phrase @env.textlog if my_phrase.word[2] == "Couldn't" goto the_end end if if my_phrase >= kudzu if my_phrase >= empty set loc_kudzuinventory[loc_kudzubags] 0 else if my_phrase >= one set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[8] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[10] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else set my_seeds my_phrase.word[10] set loc_kudzuinventory[loc_kudzubags] my_seeds set loc_kudzuseeds + my_seeds end if set loc_kudzubags + 1 goto mark end if label the_end set loc_kudzubags - 1 set my_msg "* I have " set my_msg + loc_kudzuseeds set my_msg + " kudzu seeds in " set my_msg + loc_kudzubags set my_msg + " bags." message " " message my_msg message " " set my_current_bag 1 label display_bags message "Bag" my_current_bag ": " loc_kudzuinventory[my_current_bag] " zu" set my_current_bag + 1 if my_current_bag <= loc_kudzubags goto display_bags end if message " " label the_real_end } // 'Say' kuzdu in bags - count them then say it "skz" { call icon_unarmed set loc_kudzubags 1 set loc_kudzuseeds 0 set loc_kudzuinventory[1] 0 set loc_kudzuinventory[2] 0 set loc_kudzuinventory[3] 0 set loc_kudzuinventory[4] 0 set loc_kudzuinventory[5] 0 set loc_kudzuinventory[6] 0 set loc_kudzuinventory[7] 0 set loc_kudzuinventory[8] 0 set loc_kudzuinventory[9] 0 set loc_kudzuinventory[10] 0 label mark "/selectitem \"" g_zu_bag_type " <#" loc_kudzubags "\"\r" pause 2 if @env.textlog < "Couldn't find" goto the_end end if "/examine\r" pause 2 set my_phrase @env.textlog if my_phrase < kudzu if my_phrase < empty set loc_kudzuinventory[loc_kudzubags] 0 else if my_phrase < one set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[8] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else if my_phrase.word[10] == "a" set loc_kudzuinventory[loc_kudzubags] 1 set loc_kudzuseeds + 1 else set my_seeds my_phrase.word[10] set loc_kudzuinventory[loc_kudzubags] my_seeds set loc_kudzuseeds + my_seeds end if set loc_kudzubags + 1 end if goto mark label the_end set loc_kudzubags - 1 set my_msg "I have " set my_msg + loc_kudzuseeds set my_msg + " zu seedlings in " set my_msg + loc_kudzubags set my_msg + " bags." " " my_msg " \r" message " " set my_current_bag 1 label display_bags message "Bag" my_current_bag ": " loc_kudzuinventory[my_current_bag] " zu" set my_current_bag + 1 if my_current_bag <= loc_kudzubags goto display_bags end if } setglobal lines_of_code + 373