Page 1 of 1


Posted: Sun Apr 05, 2009 6:41 am
by *Edwards
I can't find a way to close any gump with the CloseGump function since 098. Even my old packets aren't working. Might be something missing.

Code: Select all

use uo;

include ":gumps:gumps";
include ":gumps:gumps_ex";

program test( mobile )

        SetObjProperty( mobile, "#CloseGumpPID", GetPid() );

        //Initialize the gump
        var gump := GFCreateGump();

        GFResizePic( gump, 275, 230, GFGetCfgConst( "BackGrounds", "GOLDTRIM" ), 250, 100 );

        var close_gump := GetObjProperty( mobile, "#CloseGumpPID" );
        var result := CloseGump( mobile, close_gump, 0x10 );
        broadcast( result );

        //And now we need to know the answer...
        var input := GFSendGump( mobile, gump );
        if( input[0x10] )
                  return 0;

        return 1;
it returns "Couldn't find any scripts".

POL098 RC2

Re: CloseGump()

Posted: Sun Apr 05, 2009 8:23 am
by *Edwards
I tested differently with the help of Tomi and it works.

I created a script that shall call the gump script. So script :test:gumpTest will display what I want to mobile. 2 seconds later CloseGump of the gump pid is called to return 0x10...

Code: Select all

use uo;

program test( mobile )

        var process := start_script( ":test:gumpTest", mobile );
        var gumpid :=;
        var result := CloseGump( mobile, gumpid, 0x10 );
        Broadcast( gumpid );

        return 1;

Problem: if you call CloseGump directly from the gump' script it doesn't work and return Couldn't find script. I believe it should work at the moment you have the pid...

Re: CloseGump()

Posted: Sun Apr 05, 2009 9:12 am
by ncrsn
Well, think about it.

If you write 1. CloseGump() 2. SendDialogLayout(), there is no gump to close because you haven't send it yet. If you try 1. SendDialogLayout() 2. CloseGump(), on the other hand, send function holds script until player replies, and because of that, once you try to close the gump, it no longer exists.

Until a new method is created, you cannot close a gump from the very same process that sends it, so I don't consider this as a bug.