|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#3 (permalink) |
|
Forum Novice
|
a Gump, I was using the form as an example :P I couldn't think of a uo gump that used them. Heck I never knew how to do them in sphere either :P
I have no code for that part, I have it set up as normal buttons in a select case but that does not do what I want at all. Meh, I'll post it anyway. Here is the section for the buttons: [code:1] //Set, gSet, mSet Xpos = 210; Ypos = 73; width = 100; height = 100; AddAlphaRegion( Xpos, Ypos, width, height ); Xpos += 10; Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "Set: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 100, GumpButtonType.Reply, 0 ); Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "mSet: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 101, GumpButtonType.Reply, 0 ); Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "gSet: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 102, GumpButtonType.Reply, 0 ); [/code:1] Here is the Select case: The select case is unmade but I get that part [code:1]using System; using Server; using Server.Accounting; using Server.Gumps; using Server.Items; using Server.Network; using Server.Targeting; using Server.Targets; using Server.Mobiles; using Server.Prompts; namespace Server.Gumps { public class WipeBookGump : Gump { private WipeBook m_book; public WipeBookGump( Mobile from, WipeBook book) : base( 30, 30 ) { //AddButton( 10, 60, 2117, 2118, 0, GumpButtonType.Page, 2 ); // Go to Page 2 string title = "Utility"; m_book = book; AddPage( 0 ); AddPage( 1 ); int Xpos = 0; int Ypos = 0; int width = 788; int height = 280; AddBackground( Xpos, Ypos, width, height, 5120 ); AddBackground( Xpos + 10, Ypos + 40, width - 388 , height - 100, 5054 ); Xpos = 475; Ypos = 6; width = 300; height = 262; AddBackground( Xpos, Ypos, width , height, 5054 ); Xpos = 30; Ypos = 5; AddLabel( Xpos, Ypos, 33, title ); //Gather Information Area Xpos = 30; Ypos = 53; width = 300; height = 15; AddButton( Xpos - 17, Ypos , 2117, 2118, 1, GumpButtonType.Reply, 0 ); // Item AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Item: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, ((Account)((Mobile)from).Account).GetTag("WBI tem") ); Ypos +=20; width = 150; AddButton( Xpos - 17, Ypos, 2117, 2118, 2, GumpButtonType.Reply, 0 ); // Z AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Z: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, "34" ); Ypos +=20; AddButton( Xpos - 17, Ypos, 2117, 2118, 3, GumpButtonType.Reply, 0 ); // Hue AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Hue: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, "0x345" ); Ypos +=20; AddButton( Xpos - 17, Ypos, 2117, 2118, 4, GumpButtonType.Reply, 0 ); // Inc X / Y AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Inc X/Y: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, "3" ); Ypos +=20; AddButton( Xpos - 17, Ypos, 2117, 2118, 5, GumpButtonType.Reply, 0 ); // Attributes AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Attributes: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, "0x34" ); Ypos +=20; AddButton( Xpos - 17, Ypos, 2117, 2118, 6, GumpButtonType.Reply, 0 ); // Move AddAlphaRegion( Xpos, Ypos, width + 10, height ); AddLabel ( Xpos, Ypos, 10, "Move: " ); AddTextEntry( Xpos + 80, Ypos, width, height, 0x480, 0, "5" ); //Set, gSet, mSet Xpos = 210; Ypos = 73; width = 100; height = 100; AddAlphaRegion( Xpos, Ypos, width, height ); Xpos += 10; Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "Set: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 100, GumpButtonType.Reply, 0 ); Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "mSet: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 101, GumpButtonType.Reply, 0 ); Ypos += 15; AddLabel ( Xpos + 10, Ypos, 10, "gSet: " ); AddButton( Xpos, Ypos + 3, 2117, 2118, 102, GumpButtonType.Reply, 0 ); //Perform Action Area Xpos = 480; Ypos = 12; AddButton( Xpos, Ypos, 2117, 2118, 200, GumpButtonType.Reply, 0 ); // Item AddLabel( Xpos + 20, Ypos, 53, "Set Color" ); Ypos += 15; AddButton( Xpos, Ypos, 2117, 2118, 201, GumpButtonType.Reply, 0 ); // Item AddLabel( Xpos + 20, Ypos, 53, "Set Color" ); } public override void OnResponse( NetState sender, RelayInfo info ) { Mobile from = sender.Mobile; switch( info.ButtonID ) { case 1: { from.Target = new WipeBookTargGet( from, m_book ); break; } case 2: { //from.Target = new WipeBookTargGet( ); break; } case 3: { break; } case 100: //mSet { from.Target = new WipeBookTarg( 0x07a1, true ); break; } case 200: { from.Target = new WipeBookTarg( 0x07a1, false ); break; } case 201: { from.Target = new WipeBookTarg( 0x83ea, true ); break; } } } } } namespace Server.Targets { public class WipeBookTargGet : Target { private WipeBook m_book; public WipeBookTargGet( Mobile from, WipeBook book ) : base( 12, false, TargetFlags.None ) { m_book = book; } protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is Item ) { Item targ = (Item)targeted; string sTarg = targ.GetType().Name; ((Account)from.Account).SetTag("WBItem&quo t;, sTarg); from.SendGump( new WipeBookGump( from, m_book ) ); } } } public class WipeBookTarg : Target { private int m_TVal; private bool m_Multi; public WipeBookTarg( int tval, bool multi ) : base( 12, false, TargetFlags.None ) { m_TVal = tval; m_Multi = multi; } protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is Item ) { Item targ = (Item)targeted; if ( m_TVal >= 0 ) { targ.Hue=m_TVal; from.PlaySound( 0x23F ); } else { string sTarg = targ.ToString(); } } else if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; targ.Hue=m_TVal; from.PlaySound( 0x23F ); } if ( m_Multi ) from.Target = new WipeBookTarg( m_TVal, true ); } } } namespace Server.Items { public class WipeBook : Item { [Constructable] public WipeBook() : this( null ) { } [Constructable] public WipeBook( string name ) : base( 0xFBE ) { Name = "Wipe-n-Clean"; Weight = 1.0; } public WipeBook( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } public override void OnDoubleClick( Mobile from ) { if ( from.InRange( GetWorldLocation(), 1 ) ) { from.CloseGump( typeof( WipeBookGump ) ); from.SendGump( new WipeBookGump( from, this ) ); } } } } [/code:1] |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Naples,FL
Age: 32
Posts: 1,552
|
You can use AddCheck or AddRadio that will add respectively a check box type control or a radio type control. Same as they work on forms only 1 radio can be true all other will go to false when picked while more then one checkbox can be true.
You can find the syntax for them in your runuo docs folder docs\types\Gump.html |
|
|
|
|
|
#6 (permalink) |
|
Forum Novice
|
ok so
AddGroup( int group ) AddRadio( int x, int y, int inactiveID, int activeID, bool initialState, int switchID ) So would I do something like: AddGroup(1) { AddRadio( 20, 30, 2060, 2061, 0, int switchID ) AddRadio( 20, 30, 2060, 2061, 0, int switchID ) AddRadio( 20, 30, 2060, 2061, 0, int switchID ) } AddGroup(2) { AddRadio( 20, 30, 2060, 2061, 0, int switchID ) AddRadio( 20, 30, 2060, 2061, 0, int switchID ) AddRadio( 20, 30, 2060, 2061, 0, int switchID ) } That work fine? (I realize that the coords are the same and that 2060, and 2061 probably aren't buttons._ What exactly is switch ID? if I set it to 100, would I reference that in the select case the same way I would for a button? [code:1] public override void OnResponse( NetState sender, RelayInfo info ) { Mobile from = sender.Mobile; switch( info.ButtonID ) { case 1: { from.Target = new WipeBookTargGet( from, m_book ); break; } case 2: { //from.Target = new WipeBookTargGet( ); break; } case 3: { break; } case 100: //mSet { from.Target = new WipeBookTarg( 0x07a1, true ); break; } case 200: { from.Target = new WipeBookTarg( 0x07a1, false ); break; } case 201: { from.Target = new WipeBookTarg( 0x83ea, true ); break; } } }[/code:1] |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Naples,FL
Age: 32
Posts: 1,552
|
I haven't worked with groups so not sure how that would work, but let say you just had a set of radio button. The switch id is to refernce them in onresponse similar to normal buttons but with the difference that you don't refer to them as button ids and they return a bool value so you can't use a switch.
Lets say you had those buttons from before AddRadio( 20, 30, 2060, 2061, 0, 1 ) AddRadio( 20, 30, 2060, 2061, 0, 2 ) AddRadio( 20, 30, 2060, 2061, 0, 3 ) To see which is selected in your onresponse you'd use [code:1]if (info.IsSwitched(1)) //they picked 1 if (info.IsSwitched(2)) //they picked 2 if (info.IsSwitched(3)) //they picked 3 [/code:1]Hope that helps a bit, I suck at explaining things ![]() |
|
|
|
|
|
#8 (permalink) |
|
Forum Novice
|
Yeah, I couldn't find an example of AddGroup in the default scripts, but I found them for radio. I don't need groups but I was just curious.
Thanks for the help, I can now continue :P Actually out of curiosity, say in a gump, when you hold your mouse over a certain background, could you make a lil pop up text thing? Kind of like when you hold your mouse over an item it says the name and it's stats. Could you have something pop up in a gump (not by pushing anything, I guess like a mouseover) to perhaps explain what something does? Like a tool tip I suppose. I know it's sorta possible because I saw it in the virtue gump, but what it says seems to be hardcoded. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|