I am have a Server running RunUO V2.1 and I am trying to make a NPC who will trade SOS scrolls for Fishing Nets but I have run into a problem in the Gump being used for the trade.

After hours of trying variations on this . . my scripting ability is simply not up to the task.

Can anyone see a way to solve this?

Here are the errors on my latest attempt:
Code:
Errors:
+ Customs/Fish Net Trader/FishNetTraderGump01.cs:
    CS0118: Line 77: 'Server.Items.SOS' is a 'type' but is used like a 'variable'
    CS0246: Line 80: The type or namespace name 'fs' could not be found (are you missing a using directive or an assembly reference?)
    CS0118: Line 94: 'Server.Items.SOS' is a 'type' but is used like a 'variable'
    CS0246: Line 97: The type or namespace name 'fs' could not be found (are you missing a using directive or an assembly reference?)

and . . Here is the offending section of the Gump script that generated the above errors:
Code:
      public override void OnResponse( NetState state, RelayInfo info )
      {
             Mobile from = state.Mobile;

            if (info.ButtonID == 0)
            {
                //Special Nets:
                if (from.Backpack.ConsumeTotal (typeof (SpecialFishingNet), 9))
                {
                    SOS fs = SOS as Item; //LINE # 77
                    fs.Level = 2;

                    from.AddToBackpack(new fs()); //LINE # 80
                    from.SendMessage( "Thank you. Here is your SOS scroll." );
                }
                else
                {
                    from.SendMessage( "Hmm . . Seems you do not have enough Special Nets to trade." );
                }
            }

            if (info.ButtonID == 1)
            {
                //Fabled Nets:
                if (from.Backpack.ConsumeTotal (typeof (FabledFishingNet), 1))
                {
                    SOS fs = SOS as Item; //LINE # 94
                    fs.Level = 5;

                    from.AddToBackpack(new fs()); //LINE # 97
                    from.SendMessage( "Thank you. Here is your Ancient SOS scroll." );
                }
                else
                {
                    from.SendMessage( "Hmm . . Seems you do not have enough Fabled Nets to trade." );
                }
            }

            if (info.ButtonID == 2)
            {
                from.SendMessage("Well if you change you mind you know where to find me.");
            }
    }

Help is greatly appreciated - Many Thanks
 
C#:
    SOS fs = SOS as Item; //LINE # 77
The problem is you aren't creating a new Item but instead trying to convert the Type into another Type

C#:
    from.AddToBackpack(new fs()); //LINE # 80
and here you are trying to initialize a variable like it would be a type

SOS is the type
to initialize a type you use the "new" keyword:
C#:
SOS sosVariable = new SOS();

Here is how you would do it in your code:
C#:
SOS fs = new SOS(); //LINE # 77
fs.Level = 2;

from.AddToBackpack(fs); //LINE # 80
from.SendMessage( "Thank you. Here is your SOS scroll." );
 
Thank you SkyFly for the fast reply and for the very clear lesson on my problem. I learned something today and am greatful

*bows*
 
Back