Admin Vorspire said:send the scripts to do with this, to my email.. all of them, gumps, commands etc, and ill take a look.. easier than reading a confusing thread :/
No.
Admin Vorspire said:send the scripts to do with this, to my email.. all of them, gumps, commands etc, and ill take a look.. easier than reading a confusing thread :/
private static void ToolKit_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if( from.HasGump( typeof( GMToolKit ) ) )
{
from.SendMessage( "GM Tool-Kit is open, closing..." );
from.CloseGump( typeof( GMToolKit ) );
}
else
{
from.SendMessage( "GM Tool-Kit is already closed..." );
}
if ( from.HasGump( typeof( GMMiniKit )) )
{
from.SendMessage( "GM Mini-Kit is open, closing..." );
from.CloseGump( typeof( GMMiniKit ) );
}
else
{
from.SendMessage( "GM Mini-Kit is already closed..." );
}
return;
}
And I'm trying to hold off using 'backup' checks until it's determined that it's the only possible way. The from.CloseGump( Type type ) should do it. Once I've exhausted this possiblity, I'll use the boolean checks.Phantom said:If you use the CloseGump method there is no way its not closed.
So you have an issue with your code, that says its open...
Admin Vorspire said:Try this for the command:
Code:private static void ToolKit_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; if( from.HasGump( typeof( GMToolKit ) ) ) { from.SendMessage( "GM Tool-Kit is open, closing..." ); from.CloseGump( typeof( GMToolKit ) ); } else { from.SendMessage( "GM Tool-Kit is already closed..." ); } if ( from.HasGump( typeof( GMMiniKit )) ) { from.SendMessage( "GM Mini-Kit is open, closing..." ); from.CloseGump( typeof( GMMiniKit ) ); } else { from.SendMessage( "GM Mini-Kit is already closed..." ); } return; }
I removed the bools, and tested this with different gumps.. it works like a charm
private static void ToolKit_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if( from.HasGump( typeof( GMToolKit ) ) )
{
from.SendMessage( "GMToolKit is open, now closing..." );
from.CloseGump( typeof( GMToolKit ) );
}
else if( from.HasGump( typeof( GMMiniKit ) ) )
{
from.CloseGump( typeof( GMMiniKit ) );
from.SendMessage( "GMMiniKit is open, now closing..." );
}
else
from.SendGump( new GMToolKit() );
}
private static void GMToolKit_OnCommand( CommandEventArgs e)
{
Mobile from = e.Mobile;
if( from.HasGump( typeof( GMToolKit)) )
{
from.SendMessage( "GM Tool-Kit is open, closing..." );
from.CloseGump( typeof( GMToolKit) );
}
if ( from.HasGump( typeof( GMMiniKit )) )
{
from.SendMessage( "GM Mini-Kit is open, closing..." );
from.CloseGump( typeof( GMMiniKit ) );
}
else
{
from.SendMessage( "GM Mini-Kit is closed, opening..." );
from.SendGump( new GMMiniKit() );
}
return;
}
}
}
That code makes no sense.Admin Vorspire said:Ok here:
Code:private static void GMToolKit_OnCommand( CommandEventArgs e) { Mobile from = e.Mobile; if( from.HasGump( typeof( GMToolKit)) ) { from.SendMessage( "GM Tool-Kit is open, closing..." ); from.CloseGump( typeof( GMToolKit) ); } if ( from.HasGump( typeof( GMMiniKit )) ) { from.SendMessage( "GM Mini-Kit is open, closing..." ); from.CloseGump( typeof( GMMiniKit ) ); } else { from.SendMessage( "GM Mini-Kit is closed, opening..." ); from.SendGump( new GMMiniKit() ); } return; } } }
state.Mobile.CloseGump( typeof( GMMiniKit ) );
daat99 said:That code makes no sense.
Why do you add a return at the end of the method ???
Try to add this line to the case 0 in the OnResponce of the gumps (use similar line for toolkit):
Code:state.Mobile.CloseGump( typeof( GMMiniKit ) );
from.CloseGump( typeof( GMMiniKit ) );
Wrong, he complained that it always show the message when he use the command, there is no loop there.Admin Vorspire said:he complains that it keeps looping through the messages, adding a return; will assure that will never happen.. also, adding a return; stabilizes the code further, in my eyes :/
the code i have wrote makes perfect sense and will do exactly what he wants it to do, you have to trust me on that.. but only he can verify it, if im wrong then i appologise :/
ORIGINAL: I also recommend (if you havent already done so) to never close the GMMiniKit gump when the button to open the GMToolKit gump is pressed.. or it can start looping just make sure that the GMMiniKit gump is NEVER closed unless the GM uses the GMToolKit Command ^^
Just removefrom all of the button cases in your gump scriptsCode:from.CloseGump( typeof( GMMiniKit ) );
It makes no difference which is exactly why it makes no sence.Admin Vorspire said:it really makes no difference if its there or not then ( return; )
Please post the updated scripts as you have them now.mdavis93 said:1) The MiniKit will only close by the toolkit command. I will have it set to "Closable=false"
2) The gump closes fine when a button is clicked
3) When the toolkit command is used and one of the two gumps are open, it's suppose to wipe the gump. The next time you use the command it should see that neither gump exists to you and open the ToolKit gump
4) It doesn't open the gump. It loops saying "GMToolKit" ( or "GMMiniKit", whichever the command closed) is open.. closing now. (this code is only located in the toolkit command handler
Admin Vorspire said:seriously, did you use my code at all?
Did you tired the code I gave you?mdavis93 said:No.
Your code only closes the gump. I need it to close the gump that is open, and then stop. If neither gump is open, I need it to open the ToolKit gump. Your code doesn't do that.