|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#3 (permalink) |
|
Forum Novice
|
Well i tried that but im guess i did it wrong bcs i got errors, this is how i used it
Code:
using System;
using Server;
using Server.Misc;
using Server.Spells;
using Server.Regions;
using Server.Items;
using Server.Gumps;
using Server.Network;
using Server.Menus;
using Server.Menus.Questions;
namespace Server.Gumps
{
public class RebookG : Gump
{
public RebookG( Mobile owner ) : base( 150, 60 )
{
Closable=true;
Disposable=true;
Dragable=true;
Resizable=false;
AddPage(0);
AddBackground(92, 69, 100, 134, 9200);
AddImage(110, 75, 15119);
AddButton(109, 158, 247, 248, 1, GumpButtonType.Reply, 0);
}
foreach ( NetState state in NetState.Instances )
{
switch ( info.ButtonID )
{
case 0:
{
break;
}
case 1:
{
Item item = new Gold();
item.Amount = 500;
item.Hue = 1500;
state.Mobile.AddToBackpack( item );
break;
}
}
namespace Server.Items
{
public class Rebook : Item
{
[Constructable]
public Rebook() : base( 7187 )
{
Weight = 0;
Movable = true;
Name = "Reward Book";
LootType = LootType.Blessed;
}
public Rebook( Serial serial ) : base( serial ) { }
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RebookG));
from.SendGump(new RebookG(this));
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer ); writer.Write( (int) 0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader ); int version = reader.ReadInt();
}
}
}
and these are the errors i got. Code:
Errors:
+ thisisit.cs:
CS1519: Line 30: Invalid token 'foreach' in class, struct, or interface memb
er declaration
CS1002: Line 30: ; expected
CS1519: Line 30: Invalid token ')' in class, struct, or interface member dec
laration
CS1519: Line 32: Invalid token ')' in class, struct, or interface member dec
laration
CS1519: Line 41: Invalid token '=' in class, struct, or interface member dec
laration
CS1519: Line 42: Invalid token '=' in class, struct, or interface member dec
laration
CS1519: Line 43: Invalid token '(' in class, struct, or interface member dec
laration
CS1519: Line 43: Invalid token ')' in class, struct, or interface member dec
laration
|
|
|
|
|
|
#5 (permalink) |
|
Forum Novice
|
what do you mean define the OnResponse method i tried to do it like this but it didnt work. How would you define it?
Code:
public override void OnResponse foreach( NetState state in NetState.Instances ) i also tried this Code:
public override void OnResponse( NetState state in NetState.Instances ) CS1026: Line 31: ; expected and CS1026: Line 31: ) expected errors |
|
|
|
|
|
#6 (permalink) |
|
Newbie
Join Date: May 2006
Location: Czech Republic
Posts: 78
|
You dont have to use namespace System.Collections.Generic. You have to place foreach cycle into method (i.e. OnDoubleClick) no just anywhere you want. You will have to gain some skills in C#. Your method can be:
PHP Code:
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|