Full Version : page command
xmlspawner >>Scripting Support >>page command


<< Prev | Next >>

ambak- 02-18-2006
is it possible to make a [page command which brings general question section gump to the player when typed and abort the help request when typed again?

ArteGordon- 02-18-2006
you can make a command that will bring up the help gump easily enough.
Just use something like this as your command code.
CODE

 public static void GenericCommand_OnCommand( CommandEventArgs e )
 {
  EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
 }


ambak- 02-18-2006
QUOTE (ArteGordon @ Feb 18 2006, 01:25 PM)
you can make a command that will bring up the help gump easily enough. 
Just use something like this as your command code.
CODE

 public static void GenericCommand_OnCommand( CommandEventArgs e )
 {
  EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
 }

is this true arte?
CODE

using System;
using System.Text;
using Server;
using Server.Items;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;

namespace Server.Scripts.Commands
{
public class GenericCommand
{
public static void Initialize()
{
 Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( GenericCommand_OnCommand ) );
}
if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if
{
 public static void GenericCommand_OnCommand( CommandEventArgs e )
 {
  EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
 }
}
}
}

ArteGordon- 02-18-2006
CODE

if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if
{


this kind of stuff must be placed inside of a method. This will not compile.

CODE

public static void GenericCommand_OnCommand( CommandEventArgs e )
{
// has to go inside here
}

ambak- 02-18-2006
here is the code
CODE

using System;
using System.Text;
using Server;
using Server.Items;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;

namespace Server.Scripts.Commands
{
public class PageatCommand
{
public static void Initialize()
{
Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( PageatCommand_OnCommand ) );
}

public static void PageatCommand_OnCommand( CommandEventArgs e )
{
 if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if
{
 EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
}
}
}
}

here is the error
CODE

- Error: Scripts\Custom\pageat.cs: CS1003: (line 25, column 8) Syntax error, '
' expected
- Error: Scripts\Custom\pageat.cs: CS1525: (line 26, column 1) Invalid express
on term '{'
- Error: Scripts\Custom\pageat.cs: CS1026: (line 26, column 2) ) expected
- Error: Scripts\Custom\pageat.cs: CS1514: (line 27, column 67) { expected

ambak- 02-19-2006
please help

ArteGordon- 02-19-2006
You have an empty 'if' statement here.

CODE

else if
{
EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
}


this is not valid. Just get rid of the 'if'

Also you refer to 'from', and there is no such variable ever defined.

ambak- 02-19-2006
how can i define this variable?

ambak- 02-19-2006
Mobile from = e.Mobile; ok smile.gif

ambak- 02-19-2006
CODE

using System;
using System.Text;
using Server;
using Server.Items;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;

namespace Server.Scripts.Commands
{
public class PageatCommand
{
public static void Initialize()
{
Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( PageatCommand_OnCommand ) );
}

public static void PageatCommand_OnCommand( CommandEventArgs e )
{
if ( from.Region is Server.Regions.Jail )
{
 Mobile from = e.Mobile;
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else
{
EventSink.InvokeHelpRequest(new HelpRequestEventArgs(e.Mobile));
}
}
}
}

CODE

- Error: Scripts\Custom\pageat.cs: CS0246: (line 21, column 7) The type or name
space name 'from' could not be found (are you missing a using directive or an as
sembly reference?)

ArteGordon- 02-19-2006
CODE

( from.Region is Server.Regions.Jail )
{
Mobile from = e.Mobile;


you refer to 'from.Region' before you have defined 'from'

ambak- 02-19-2006
ok now it works fine but this is not exactly what i want.this calls the helpgump
i want it to call the "general questions about utima online page prompt(i think this is the true words)" where the player types msg and send for help

ArteGordon- 02-19-2006
you could try this

from.SendGump( new PagePromptGump( from, PageType.Question) );

ambak- 02-19-2006
- Error: Scripts\Custom\pageat.cs: CS0246: (line 28, column 21) The type or nam
espace name 'PagePromptGump' could not be found (are you missing a using directi
ve or an assembly reference?)

ArteGordon- 02-19-2006
you will need to add a using statement to the beginning of your script. Look in helpgump.cs to see what namespace it is defined in.
Add a using statement that refers to that namespace.