Please, if we can skip over the fact that this system is old and difficult and why would I even want to use it in the first place :) I'm just experimenting and this script and the server I'm trying to put in on are in no way in the final form.

So this is the Magician Spell system devised a long time ago and shared on the now defunct RunUO forums. I have messed with it for a long time, quite possibly broken it, BUT I'm at least close to getting it to compile so I can run the server and see firsthand what effect my edits have had. I have one error left to overcome and I need help. Here is the full script although I think the bulk of it is unnecessary, the part throwing the error is in bold on line 77::

using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Network;
using Server.Spells;
using Server.Spells.Magician;
using Server.Prompts;
using Server.Mobiles;
using Server.Gumps;

namespace Server.Gumps
{
public class MagicianSpellbookGump : Gump
{
private MagicianSpellbook m_Book;
private Mobile m_Dark;
private MagicianSpell[] spells;

private ArrayList UniversalSpells;
private ArrayList AbjurationSpells;
private ArrayList ConjurationSpells;
private ArrayList DivinationSpells;
private ArrayList EnchantmentSpells;
private ArrayList EvocationSpells;
private ArrayList IllusionSpells;
private ArrayList NecromancySpells;
private ArrayList TransmutationSpells;

int gth = 0x903;

private int Chap1Page = 0;
private int Chap2Page = 0;
private int Chap3Page = 0;
private int Chap4Page = 0;
private int Chap5Page = 0;
private int Chap6Page = 0;
private int Chap7Page = 0;
private int Chap8Page = 0;
private int Chap9Page = 0;


private void AddBackground()
{
AddPage( 0 );

AddImage( 75, 6, 0x8AC, 0 );
// AddImage( 255, 10, 0x8AD, 0x48B );



// AddLabel( 140, 45, gth, "Ohm - Earth" );
// AddLabel( 140, 60, gth, "Ess - Air" );
// AddLabel( 140, 75, gth, "Crur - Fire" );
// AddLabel( 140, 90, gth, "Sepa - Water" );
// AddLabel( 140, 110, gth, "Kes - One" );
// AddLabel( 140, 125, gth, "Sec - Whole" );
// AddLabel( 140, 140, gth, "En - Call" );
// AddLabel( 140, 155, gth, "Vauk - Banish" );
// AddLabel( 140, 170, gth, "Tia - Befoul" );
// AddLabel( 140, 185, gth, "Ante - Cleanse" );

}

public bool HasSpell( int spellID, MagicianSpellbook book )
{
return book.HasSpell( spellID );
}


public MagicianSpellbookGump( Mobile from, MagicianSpellbook book ) : base( 150, 200 )
{

m_Book = book;
m_Dark = from as Mobile;

int[] spellnums = spells.Length;

spells = new MagicianSpell[spellnums.Length];

for (int j = 0; j < spellnums.Length; j++ )
{
Spell spell = SpellRegistry.NewSpell( spellnums[j], m_Dark as Mobile, null );
spells[j] = spell as MagicianSpell;
}

if(spells.Length > 1)
spells = this.SpellSort(spells);

UniversalSpells = new ArrayList();
AbjurationSpells = new ArrayList();
ConjurationSpells = new ArrayList();
DivinationSpells = new ArrayList();
EnchantmentSpells = new ArrayList();
EvocationSpells = new ArrayList();
IllusionSpells = new ArrayList();
NecromancySpells = new ArrayList();
TransmutationSpells = new ArrayList();
for (int j = 0; j < spells.Length; j++)
{
switch(spells[j].SpellSchool)
{
case SpellSchool.Universal:
{
UniversalSpells.Add(spells[j]);
break;
}
case SpellSchool.Abjuration:
{
AbjurationSpells.Add(spells[j]);
break;
}
case SpellSchool.Conjuration:
{
ConjurationSpells.Add(spells[j]);
break;
}
case SpellSchool.Divination:
{
DivinationSpells.Add(spells[j]);
break;
}
case SpellSchool.Enchantment:
{
EnchantmentSpells.Add(spells[j]);
break;
}
case SpellSchool.Evocation:
{
EvocationSpells.Add(spells[j]);
break;
}
case SpellSchool.Illusion:
{
IllusionSpells.Add(spells[j]);
break;
}
case SpellSchool.Necromancy:
{
NecromancySpells.Add(spells[j]);
break;
}
case SpellSchool.Transmutation:
{
TransmutationSpells.Add(spells[j]);
break;
}
default:
break;
}
}

AddBackground();
AddPage( 1 );
AddLabel( 155, 17, 0x4C1, "Wizard Tome" );
AddHtml( 140, 39, 123, 172, "Welcome, Master " + from.Name + ". I am your magical tome, here to do your bidding. For a quick jump to a chapter, use the magical stones on the next page." , false, false );
int sbtn = 0x93A;
int dby = 20;
AddButton( 396, 14, 0x89E, 0x89E, 17, GumpButtonType.Page, 2 );

int i = 2;

i = Index( i );
Chap1Page = i;

i = Chapter1( i );
Chap2Page = i;

i = Chapter2( i );
Chap3Page = i;

i = Chapter3( i );
Chap4Page = i;

i = Chapter4( i );
Chap5Page = i;

i = Chapter5( i );
Chap6Page = i;

i = Chapter6( i );
Chap7Page = i;

i = Chapter7( i );
Chap8Page = i;

i = Chapter8( i );
Chap9Page = i;

i = Chapter9( i );

AddPage( i );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );

AddPage( 1 );

AddLabel( 315, dby, gth, "Universal" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap1Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Abjuration" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap2Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Conjuration" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap3Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Divination" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap4Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Enchantment" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap5Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Evocation" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap6Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Illusion" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap7Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Necromancy" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap8Page );
dby = dby + 20;

AddLabel( 315, dby, gth, "Transmutation" );
AddButton( 295, dby + 3, sbtn, sbtn, 0, GumpButtonType.Page, Chap9Page );



UniversalSpells.Clear();
AbjurationSpells.Clear();
ConjurationSpells.Clear();
DivinationSpells.Clear();
EnchantmentSpells.Clear();
EvocationSpells.Clear();
IllusionSpells.Clear();
NecromancySpells.Clear();
TransmutationSpells.Clear();
}

public MagicianSpell[] SpellSort( MagicianSpell[] spells )
{
MagicianSpell tempspell = spells[0];

for( int i=0; i<spells.Length-1; i++ )
{
for(int j=i+1; j<spells.Length; j++)
{

if(spells.Circle > spells[j].Circle)
{
tempspell = spells;
spells = spells[j];
spells[j] = tempspell;
}
}
}

return spells;
}

public string ComputeLevel(SpellCircle circle)
{
return ComputeLevel((int)circle + 1);
}

public string ComputeLevel( int level )
{
switch( level )
{
case 1:
{
return "Level One";
}
case 2:
{
return "Level Two";
}
case 3:
{
return "Level Three";
}
case 4:
{
return "Level Four";
}
case 5:
{
return "Level Five";
}
case 6:
{
return "Level Six";
}
case 7:
{
return "Level Seven";
}
case 8:
{
return "Level Eight";
}
default:
{
return "";
}
}
}

public int Index( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 174, 17, 0x4C1, "Index" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 155, 37, gth, "Spell Index" );
AddHtml( 140, 59, 123, 132, "The following is a short introduction to casting spells. You must first prepare a spell. This is the most important step.", false, false );
AddHtml( 295, 37, 123, 88, "To do this, use the following magical symbol, or use the magical words [PrepareSpell.", false, false );
AddButton( 295, 157, 0x5004, 0x5004, 1000, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To prepare" );
AddLabel( 345, 177, gth, "click symbol" );
i++;

AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 174, 17, 0x4C1, "Index" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddHtml( 140, 37, 123, 160, "Preparation is important, but it takes time to prepare a spell. Also, preparing a spell will only ready one instance of the spell. Prepare more to cast more often.", false, false );
AddHtml( 295, 37, 123, 160, "The higher the spell level, the longer the preparation time will take. Some spells may require reagents of some sort. The reagents are listed on each particular spell page.", false, false );
i++;

AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 174, 17, 0x4C1, "Index" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddHtml( 140, 37, 123, 160, "Lastly, make note of each school's opposite school. Specialist wizards will not be able to learn any of their opposite school's spells, however can learn all of their", false, false );
AddHtml( 295, 37, 123, 160, "specialist school's strongest spells. Any non-specialist wizard can learn up to Level Six of any school, not counting Universal. Be wise in your decision to specialize.", false, false );
i++;

return i;
}

public int Chapter1( int i )
{

AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Universal" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 150, 37, gth, "Universal Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the universal spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "None" );
AddHtml( 295, 37, 123, 160, "Universal spells combine elements of several schools, affect magic directly, or involve very basic magic concepts. Available to all types of wizards.", false, false );
i++;

for( int j = 0; j < UniversalSpells.Count; j++)
{
MagicianSpell mspell = UniversalSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Universal" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
//AddLabel( 295, 57, gth, "Ginseng" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );

AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter2( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Abjuration" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 150, 37, gth, "Abjuration Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Abjuration spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Transmutation" );
AddHtml( 295, 37, 123, 160, "Abjuration spells ward, protect, dispel, or are generally defensive for the wizard.", false, false );
i++;

for( int j = 0; j < AbjurationSpells.Count; j++)
{
MagicianSpell mspell = AbjurationSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Abjuration" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter3( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 168, 17, 0x4C1, "Conjuration" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 145, 37, gth, "Conjuration Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Conjuration spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Divination" );
AddHtml( 295, 37, 123, 160, "Conjuration spells summon entities from other planes, create new temporary objects from thin air, or create passageways to other far away places.", false, false );
i++;

for( int j = 0; j < ConjurationSpells.Count; j++)
{
MagicianSpell mspell = ConjurationSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 168, 17, 0x4C1, "Conjuration" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter4( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Divination" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 150, 37, gth, "Divination Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Divination spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Conjuration" );
AddHtml( 295, 37, 123, 160, "Divination spells provide information, knowledge, or awareness to the wizard. This school personifies ultimate knowledge.", false, false );
i++;

for( int j = 0; j < DivinationSpells.Count; j++)
{
MagicianSpell mspell = DivinationSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Divination" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter5( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 166, 17, 0x4C1, "Enchantment" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 146, 37, gth, "Enchantment Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Enchantment spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Evocation" );
AddHtml( 295, 37, 123, 160, "Enchantment spells affect the minds or behavior of others, either through subtle or overt means. The intelligence of the wizard consumes the target.", false, false );
i++;

for( int j = 0; j < EnchantmentSpells.Count; j++)
{
MagicianSpell mspell = EnchantmentSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 166, 17, 0x4C1, "Enchantment" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter6( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Evocation" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 150, 37, gth, "Evocation Spells" );
AddHtml( 140, 59, 123, 132, "This chapter contains all the Evocation spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Enchantment" );
AddLabel( 140, 177, 0x455, "Conjuration");
AddHtml( 295, 37, 123, 160, "Evocation spells manipulate energy, and pure magical force. This is the most offensive-based school of all.", false, false );
i++;

for( int j = 0; j < EvocationSpells.Count; j++)
{
MagicianSpell mspell = EvocationSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Evocation" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter7( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Illusion" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 150, 37, gth, "Illusion Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Illusion spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Necromancy" );
AddHtml( 295, 37, 123, 160, "Illusion spells affect the senses of others, by creating false sensory input in the minds of others, or by creating semi-real objects created from shadows.", false, false );
i++;

for( int j = 0; j < IllusionSpells.Count; j++)
{
MagicianSpell mspell = IllusionSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Illusion" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter8( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 166, 17, 0x4C1, "Necromancy" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 145, 37, gth, "Necromancy Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Necromancy spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Illusion" );
AddHtml( 295, 37, 123, 160, "Necromancy spells manipulate life force, the flesh of organic beings, energies from the negative plane, and all things to do with the undead.", false, false );
i++;

for( int j = 0; j < NecromancySpells.Count; j++)
{
MagicianSpell mspell = NecromancySpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 170, 17, 0x4C1, "Necromancy" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}

public int Chapter9( int i )
{
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 161, 17, 0x4C1, "Transmutation" );
AddLabel( 315, 17, 0x4C1, "Introduction" );
AddLabel( 140, 37, gth, "Transmutation Spells" );
AddHtml( 140, 59, 123, 88, "This chapter contains all the Transmutation spells you know, master.", false, false );
AddLabel( 140, 137, gth, "Opposite Schools:");
AddLabel( 140, 157, 0x455, "Abjuration" );
AddHtml( 295, 37, 123, 160, "Transmutation spells alter or enhance the properties of objects, creatures, or physical laws of reality. Unlike illusions, these effects are real, if only temporary.", false, false );
i++;

for( int j = 0; j < TransmutationSpells.Count; j++)
{
MagicianSpell mspell = TransmutationSpells[j] as MagicianSpell;
AddPage( i );
AddButton( 396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, i+1 );
AddButton( 123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, i-1 );
AddLabel( 161, 17, 0x4C1, "Transmutation" );
AddLabel( 311, 17, 0x4C1, this.ComputeLevel(mspell.Circle) );
AddLabel( 150, 37, gth, mspell.Name );
AddHtml( 140, 59, 123, 88, mspell.Desc, false, false );
AddLabel( 295, 37, gth, "Reagents:" );
AddHtml( 295, 59, 123, 88, mspell.ReagentsDesc, false, false );
AddButton( 295, 157, 0x8DD, 0x8DD, mspell.SpellNumber, GumpButtonType.Reply, 1 );
AddLabel( 345, 157, gth, "To cast," );
AddLabel( 345, 177, gth, "click symbol" );
i++;
}

return i;
}



public override void OnResponse( NetState state, RelayInfo info )
{
if ((info.ButtonID >= 300)&&(info.ButtonID <=360))
{
Spell spell = SpellRegistry.NewSpell( info.ButtonID, state.Mobile, null );
spell.Cast();
}
}
}
}

The error shown is "Cannot implicitly convert type 'int' to 'int[]'. I researched that but looking above I don't understand where the script sets an 'int' that is in conflict with this 'int[]' OR if it's in lines 81 for (int j = 0; j < spellnums.Length; j++ ) and/or 99 (for (int j = 0; j < spells.Length; j++)) - as I suspect, how to explicitly convert/cast to fix the error. I've played with this for a while in ignorance and gotten nowhere. I'm finally reaching out for help in the hope of moving past this.
 
Last edited:
.Length is an int

int[] is and array containing int


this only would work for Length..
Code:
int spellnums = spells.Length;

Just a blind guess after a 2 second look but have you tried..?
Code:
int[] spellnums = spells;

Not sure if this helps any, but I thought I'd throw it out there just in case.. :)
I truly have no idea.. I didn't look long..
 
The error shown is "Cannot implicitly convert type 'int' to 'int[]'. I researched that but looking above I don't understand where the script sets an 'int' that is in conflict with this 'int[]' OR if it's in lines 81 for (int j = 0; j < spellnums.Length; j++ ) and/or 99 (for (int j = 0; j < spells.Length; j++)) - as I suspect, how to explicitly convert/cast to fix the error.

If you try it again in -debug mode, it will tell us the exact line number of the error.
 
OK, I had another look, try this in line 77 in place of what you have:

int[] spellnums = book.Spells;

or

int[] spellnums = book.Spells.Keys;
 
just to point out why it throws an error.

Code:
int[] spellnums = spells.Length;
first you try to set the array to an int value.
secondly you try to access the not initialized spells length

Code:
spells = new MagicianSpell[spellnums.Length];
And here you want to set the spells to the previously set int arrays length.
This is kind of an circular expression.
 
would you be willing to release the other scripts that go with this system?

I'm the creator of the Magicianspell system. I didn't code it very efficiently at the time but that's probably true for any of our first scripting projects. I could find time to update it a tad and release it here at ServUO but from what I see @HalfMercy has edited it quite a bit.

Hey @HalfMercy , send me a pm if you have questions or need help with your version.
 
After a long time away from the game and this forum, I was really excited to come back and read these replies! Thanks to everyone who made suggestions! PyrO, the way you wrote your response really made me understand that I just didn't understand what a proper array was at all. Which isn't surprising - this script was my first experience with one.

I spent hours online reading and tinkering with it and eventually got the server started with this on line 77:

int[] spellnums = new int[64];

I want to say that the Spellbook Gump is not working properly even with that edit: All spells appear on the very first page as "Bad Spell". But I learned how to properly declare and initialize an array; that's a success in my book.
 
I learned how to properly declare and initialize an array; that's a success in my book.

As you can probably tell from my signature, I agree with this statement 100%.

Would you consider posting all relevant files attached to this thread? I would be curious to see the MagicianSpellBook and the "working" (aka compiling) gump script. We might be able to continue the success trend a bit further.
 
Thanks Lokai! I'd be glad to share those files! I'll post a .rar of the original unedited scripts in their entirety. Mine are somewhat different in that I took out a few spells that I felt were unnecessary, being duplicates of existing spells, and I also tried to remove all references to the Multilinguist/Polyglot package embedded into this. For some reference:

web.archive.org/web/20160211041135/http://www.runuo.com/community/resources/wizards-and-sorcerers-spell-system.100/

and

webcache.googleusercontent.com/search?q=cache:pmSiw8JVLRAJ:www.runuo.com/community/threads/wizards-and-sorcerers-spell-system.534186/+&cd=1&hl=en&ct=clnk&gl=us
[doublepost=1486882590][/doublepost]I'm not sure if it's absolutely vital or not but I dug up the Multilinguist's package also, although I am not currently using it.
 

Attachments

  • Multilinguists 3.03.zip
    64.8 KB · Views: 13
Last edited:
I did some more digging and found the original .rar that the system came in, so I deleted the archive from the previous post and will post the true original here. It's important because it also contains edits to other files like Playermobile, etc. I'll sift through it and also make and upload a .rar with all of the corresponding files I am using.
 

Attachments

  • Wizards and Sorcerers 0.4.zip
    256 KB · Views: 16
  • MagicianEdited.rar
    159 KB · Views: 15
Try this file in place of the one you are using now. Let me know how it goes. I am not able to test.
 

Attachments

  • MagicianSpellbookGump.cs
    24 KB · Views: 11
I used your file and it returned these errors:

Errors:
+ Items/Equipment/Spellbooks/MagicianSpellbookGump.cs:
CS1061: Line 81: 'System.Collections.Generic.List<int>' does not contain a definition for 'Length' and no extension method 'Length' accepting a first argument of type 'System.Collections.Generic.List<int>' could be found (are you missing a using directive or an assembly reference?)
CS1061: Line 83: 'System.Collections.Generic.List<int>' does not contain a definition for 'Length' and no extension method 'Length' accepting a first argument of type 'System.Collections.Generic.List<int>' could be found (are you missing a using directive or an assembly reference?)

I looked at your new version and my old version side by side; I'll be honest - I'm doing a lot more trying to understand what I'm looking at than understanding what I'm looking at. So I'll tell you what I was thinking, which may be quite wrong and ridiculous but at least you'll know where I'm coming from.

The original line 79 is:

spells = new MagicianSpell[spellnums.Length];

So I figured that's saying that there might be a variable number of spells in the book - anywhere from 1 to 64 - and this line determines exactly how many there are. But then when I rewrote line 77 from the original:

int[] spellnums = spells.Length; (which, if I understand any of this, didn't work because 'int' either needs to be an integer OR the non-integer data has to be cast to an integer at some point, and neither one of these things was true)

to

int[] spellnums = new int[64];

This is a fixed number, not variable, so I'm saying here that there are always 64 spells. Which is wrong. Not that this has anything to do with why I'm seeing "Bad Spell". Maybe. Lol

When using [props on the Magician Spellbook (Wizard Tome), I notice that the Content and SpellCount parameters both read 0. That's regardless of how many spells are in the book and whether they're added by dropping a scroll in or using [allspells. Using [dupe on my Wizard Tome with 60 spells in it created a duplicate with 0 spells.
 
Last edited:
Sorry, List uses Count not Length. Change it to Count, and it should work.

The idea is that the only reason for the spellnums in the first place was to load all of the Magician spells in the following loop. Those spellnums are from 300 to 359. That's why I loaded them into a List. You can also use an Array, but it would probably have to be coded with all 60 spellnumbers manually, like "new int[] { 300, 301, 302, 303, 304 ... }

Just declaring it as an array of 60 or 64 numbers would not be sufficient, as you would not have the actual numbers being passed to the next loop, it would pass a 0 for each element of the array.
 
Thanks for the continued help, Lokai! It took me a while to get to it but I finally did today. At first I just did a find/replace on all Length to Count. Then it failed to compile and told me that on four lines I was missing an assembly reference. I went through again and changed those specific four lines back to Length and it compiled. But when I made a Wizard Tome and added a spell to it, it still showed up as 'Bad Spell' and trying to cast it crashed the server.

You can also use an Array, but it would probably have to be coded with all 60 spellnumbers manually, like "new int[] { 300, 301, 302, 303, 304 ... }

I actually knew this and forgot - I started thinking to myself about what a pain it would be, wondered if there were an easier way to do it, and then mentally meandered off to other things. For what it's worth I'm going to go back and edit the previous version to make it proper and see what that does, if anything.
 
Maybe I should explain what happens when magicians learn a spell in the old 0.4 version. This may help you figure out what is going on in those scripts. When you drop a magician spell scroll onto a magician spellbook, the spell is not saved in the book directly. It's saved on the playermobile through the polyglotmobile script. Every time a player opens a magician spellbook, the book is filled with the spells known from the playermobile using it, and then the custom spellbook gump is displayed using the info from the book. This wonky way of learning magician spells may be part of your problem, whatever you are trying to do.
 
Thank you for that explanation, ViWinfii! I want to make sure I ask this up front - you said "in the old 0.4 version". Is there a newer version? I've Googled "Wizards & Sorcerors" and "ViWinfii" and specifically checked runuo and servuo and haven't found one but I'd love to see one if it'll make this easier!

The only thing I'd really like to do is incorporate some of these spells into the game and try them out. However, based on what you said, I know that it would be easier for me to start again from the beginning than continue trucking on with the editing I did even before posting here. I couldn't get the server to compile using it as directed in the original package but I could go back through a second time with a much better understanding.
 
There's not a newer version yet. I hope to get back into it and update this and other projects eventually when I can.
 
It's saved on the playermobile through the polyglotmobile script.

I was discovering this. I was also wondering why HalfMercy was trying to get this working without that and the SpellHolder script. That seems to be where the array of spells that the player knows is constructed.

In any case, creating the array of ALL the integers should work if that was the only problem in the script, but something tells me we are missing some other connection also.

If I can get a test server up and running again, I will drop this in and give it a try, to see if I can figure it out.
 
Lol... I can explain why very easily, Lokai. Two basic reasons - one, my noobish ineptitude is actually much worse than anyone here imagines and two, all the errors that were thrown when I tried using the system as-is had to do with the polyglot business.
 
I was able to get this (mostly) working. If you are using the latest ServUO, unaltered, I can give you the scripts you would need to replace.

Here is what works:
  • Server compiles
  • Server saves and restarts fine
  • All spells added to the book are remembered and present in the book on restart
  • Scrolls and Spellbook do not work if you are not a Wizard or Sorcerer class
  • Scrolls cast and have effect when you are Wizard or Sorcerer class
  • Spellbook opens, and shows index, and detailed instructions and pages for each spell you know
  • SpellPreparation command brings up the gump, and lets you try to prepare spell
    • Correctly knows if you have required reagents or not
    • Correctly takes reagents if you prepare the spell requiring them
Here is what is not quite right:
  • No feedback to the user if they successfully prepare a spell, no special effects or text or anything
  • Still unable to cast spell from book after successfully preparing the spell
  • Prepare gump has strange way of displaying the spells. All of them show "null" except one. After you prepare that one, it no longer appears in the list. Sometimes something else will be there, and sometimes not. It seems very inconsistent.
This is an example of a minor annoyance, but there are others:
  • Have to close and re-open the book to get back to beginning, or page through manually (and it's potentially a very long book.) I would have a bookmark dangling down that would take you back to the index
All in all, the system still needs a good deal of tweaking.
 
The new version I'm working on is almost completely drop and run, independent of the vanilla spell system. It's been a long process, but the version you guys have was written by me back in 2003. If you'd like, I can upload what I currently have but know it isn't recommended to be used yet on a live shard.

Thanks for the feedback Lokai, some of these issues I've addressed a little. The gump for preparing spells probably should be completely remade cuz it's ugly as F, but I tweaked it some to show better info and it will let you know through a SendMessage when a spell has been prepared. I'm working (not finished) on an gump that will let admins change the preparation times for each spell level and change whether or not wizards are required to use mana to cast. I was also looking into using spell icon gumps for casting individual spells like vanilla spellbooks. Adding a bookmark to the spellbook is a good idea too but I haven't made it to that one yet.
 
I would greatly appreciate you posting your edited scripts, Lokai! I never wanted all the features that came with this system but I would like to try out a working version and see how it was coded.
 
The new version I'm working on is almost completely drop and run, independent of the vanilla spell system. It's been a long process, but the version you guys have was written by me back in 2003. If you'd like, I can upload what I currently have but know it isn't recommended to be used yet on a live shard.

Thanks for the feedback Lokai, some of these issues I've addressed a little. The gump for preparing spells probably should be completely remade cuz it's ugly as F, but I tweaked it some to show better info and it will let you know through a SendMessage when a spell has been prepared. I'm working (not finished) on an gump that will let admins change the preparation times for each spell level and change whether or not wizards are required to use mana to cast. I was also looking into using spell icon gumps for casting individual spells like vanilla spellbooks. Adding a bookmark to the spellbook is a good idea too but I haven't made it to that one yet.

I understand about partially done scripts. I have a few of those still myself.

I would greatly appreciate you posting your edited scripts, Lokai! I never wanted all the features that came with this system but I would like to try out a working version and see how it was coded.

Sure. It is actually pretty much all of ViWinfii's original files, plus the one's edited for ServUO. Yes, including the PolyGlotMobile. I was finding that every time I tried to get the spellbook to work without the missing scripts, it kept unraveling at one point or another.
 

Attachments

  • Customs.zip
    268 KB · Views: 27
Back