Freeslot Snippet for SmaugWiz 2.02 -------------------------------- This snippet allows you to find the next available slot number to use with your skills and spells. I've found it to be a lot handier than going through your skills and finding out which are used by hand. It comes with a command that you can use online. If your slot nums aren't in order and have gaps, as in 1-10 are used, then 25-30 etc. this can be a real timesaver. Installation ------------ In Skill.h - In Class CSkillTable find the following - short GetSlot (int sn) { return m_sk [sn]->m_Slot; } directly under it add the following - //return the next available slot number short GetFreeSlot (); In Smaug.h - add the appropriate do_fun declaration for do_freeslot with the rest of the declarations (keep them alphabetical for easier reference)- DECLARE_DO_FUN(do_freeslot); In Skills.cpp - Add the appropriate do_fun declarations for do_freeslot, they look like this, again make sure they're alphabetically ordered with the rest- //find a free slot num if (!str_cmp (name, "do_freeslot")) return do_freeslot; and //find a free slot num if (skill == do_freeslot) return "do_freeslot"; find the following code - // Sort the skill table with qsort void CSkillTable::Sort () { gpDoc->LogString ("Sorting skill table...", LOG_BOOT); qsort (&m_sk [1], m_Top-1, sizeof (CSkill*), (int (*) (const void *, const void *)) skill_comp); } Directly after that add the following code - //uses the following skilltable function to find the next //unused slot number void do_freeslot (CCharacter *ch, char *argument) { short slot = SkillTable.GetFreeSlot (); if (slot == -1) ch->SendText ("Couldn't find an availoble slot number.\n\r"); else ch->SendTextf ("Next available slot number: %d\n\r", slot); return; } //Will return the next unused slot number or -1 if one isn't found //Might not be the best code for the job, but it works and it will //find free slot numbers in gaps in the slots as well. short CSkillTable::GetFreeSlot () { int curr_slot = 1; BOOL bFreeSlotFound = FALSE; BOOL bCurrSlotFound = FALSE; while (!bFreeSlotFound) { //start looking for slot 1 loop through the whole skill //table and if we find it, increase curr_slot and look for //it next, return the first number we don't find for (int sn = 0; sn < GetCount (); sn++) { int slot = GetSlot (sn); if (slot == curr_slot) { bCurrSlotFound = TRUE; break; } } if (bCurrSlotFound) { bCurrSlotFound = FALSE; ++curr_slot; } else { bFreeSlotFound = TRUE; } if (curr_slot > 30000) break; } if (bFreeSlotFound) return curr_slot; else //didn't find one for some reason return -1; } Clean, recompile and use cedit to add the freeslot command online and you're all set. The command is, of course, intended for immortals as a time saver so make sure the level is set to 51 or higher depending on your mud's level system and what level immortals need to be to create skills/spells. This code is free to use and distribute, modifications to make the code better for all are welcomed. You who use this code do so at your own risk, it has been tested and compiled on a highly modified SmaugWiz 2.02 codebase, but it should compile fine with the stock code. I offer no support, if you don't understand some of the instructions for installation, you shouldn't try to install it. If anything breaks it's all on you. Good luck and enjoy :)