PenUltima Online

It is currently Sat Aug 30, 2008 6:51 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Gump Pages..
PostPosted: Sun May 25, 2008 2:35 am 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 91
Location: Montreal, Canada
I'm getting headache again! I'm trying to figure why I cannot change to page 3 for exemple because I know the script still running but it doesn't display anything.

Code:
var page := 0;

program command( mobile )

        while( Send_Command( mobile ))
                SleepMS(10);
        endwhile

        return 1;
endprogram

function Send_Command( mobile )

        //Initialize the gump
        var gump := GFCreateGump();
        GFClosable( gump, 0 );
       
        Broadcast( "CommandPage: "+page );
       
        //Load Main Background
   GFResizePic( gump, 0, 0, GFGetCfgConst( "Defaults", "BackGround" ), 500, 525 );

        GFResizePic( gump, 15, 15, GFGetCfgConst( "Defaults", "ForeGround" ), 470, 25 );
   GFTextMid( gump, 15, 17, 470, 1720, "Npc Creation" );

        //BackgroundAreas
   GFResizePic( gump, 15, 45, GFGetCfgConst( "Defaults", "ForeGround" ), 470, 470 );
        GFTextMid( gump, 15, 60, 470, 1720, "Page 1: Global Settings" );
       
        //Help Button
        GFAddButton( gump, 30, 60, 2131, 2131, GF_CLOSE_BTN, 0xA00 );

        //Send Previous-Next-Cancel-Apply Buttons
        GFPage( gump, page );
       
        Action_Button( gump );
        Page_Selector( gump, mobile );
       
        var input := GFSendGump( mobile, gump );
        if( input[0xA00] )
                 return OpenBrowser( mobile, "http://"+SHARD_IP+":5000/brainAI/index.html" );
        elseif( input[0xA01] ) //Cancel Button
                 return 0;
        elseif( input[0xA02] ) //Apply Button
                 return 0;
        elseif( input[0xA03] ) //Previous Button
                 Move_Page( "Previous" );
        elseif( input[0xA04] ) //Next Button
                 Move_Page( "Next" );
        endif
       
        return 1;
endfunction

function Action_Button( byref gump )

         case( page )
                 0: //Cancel or Next Button
                             GFAddButton( gump, 28, 482, 4017, 4018, GF_CLOSE_BTN, 0xA01 );
                             GFTextLine( gump, 60, 482, 1153, "Cancel" );
                 
                             GFAddButton(gump, 445, 482, 4005, 4006, GF_CLOSE_BTN, 0xA04 );
                             GFTextLine( gump, 400, 482, 1153, "Next" );
                             break;
                             
                 1:2:3:4:5:6: //Previous or Next Button
                            GFAddButton( gump, 28, 482, 4014, 4015, GF_CLOSE_BTN, 0xA03 );
                            GFTextLine( gump, 60, 482, 1153, "Previous" );

                            GFAddButton( gump, 445, 482, 4005, 4006, GF_CLOSE_BTN, 0xA04 );
                            GFTextLine( gump, 400, 482, 1153, "Next" );
                            break;

                 7: //Previous or Apply Button
                            GFAddButton( gump, 28, 482, 4014, 4015, GF_CLOSE_BTN, 0xA03 );
                            GFTextLine( gump, 60, 482, 1153, "Previous" );

                            GFAddButton(gump, 445, 482, 4012, 4013, GF_CLOSE_BTN, 0xA02 );
                            GFTextLine( gump, 400, 482, 1153, "Apply" );
                            break;
         endcase

         return gump;
endfunction

function Move_Page( action )

         if( action == "Previous" )
                 page -= 1;
         elseif( action == "Next" )
                 page += 1;
         endif
endfunction


For exemple, I'm able to click next on page 0 to go through page 1 and then when I click my next button again it goes to page 2 yeah but only the background appeir without the next and previous button. Where am I wrong?

_________________
Image
FantasiaShard.com


Last edited by *Edwards on Sun May 25, 2008 3:38 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 3:29 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 206
What is the function of Page_Selector(gump, mobile)?


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 3:36 am 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 91
Location: Montreal, Canada
Oh, even if I remove that function it doesn't work.

_________________
Image
FantasiaShard.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 7:33 am 
Offline

Joined: Thu Feb 02, 2006 8:33 am
Posts: 273
What does Page 3 display? A lot of information?
Cause if the data size gets to high the gump won't display.
Perhaps that is the reason in your case.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 8:03 am 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 91
Location: Montreal, Canada
Well, for now they all display the samething, a blank page with cancel and next button for the main page, previous and next for the page 2 to 6, and the page 7 shall display previous and save button. As it is now, the gump stop displaying things when I get to page 2 :\.

_________________
Image
FantasiaShard.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 10:39 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 206
The problem is that you add the buttons into their correct pages but create a new gump every time page is switched.

Technically you first see gump's pages 0 and 1 every time a new one is shown.

So try this.

Code:
var page := 0;

program command( mobile )

        while( Send_Command( mobile ))
                SleepMS(10);
        endwhile

        return 1;
endprogram

function Send_Command( mobile )

        //Initialize the gump
        var gump := GFCreateGump();
        GFClosable( gump, 0 );
       
        Broadcast( "CommandPage: "+page );
       
        //Load Main Background
   GFResizePic( gump, 0, 0, GFGetCfgConst( "Defaults", "BackGround" ), 500, 525 );

        GFResizePic( gump, 15, 15, GFGetCfgConst( "Defaults", "ForeGround" ), 470, 25 );
   GFTextMid( gump, 15, 17, 470, 1720, "Npc Creation" );

        //BackgroundAreas
   GFResizePic( gump, 15, 45, GFGetCfgConst( "Defaults", "ForeGround" ), 470, 470 );
        GFTextMid( gump, 15, 60, 470, 1720, "Page 1: Global Settings" );
       
        //Help Button
        GFAddButton( gump, 30, 60, 2131, 2131, GF_CLOSE_BTN, 0xA00 );

        //Send Previous-Next-Cancel-Apply Buttons
        GFPage( gump, 1 );
       
        Action_Button( gump );
        Page_Selector( gump, mobile );
       
        var input := GFSendGump( mobile, gump );
        if( input[0xA00] )
                 return OpenBrowser( mobile, "http://"+SHARD_IP+":5000/brainAI/index.html" );
        elseif( input[0xA01] ) //Cancel Button
                 return 0;
        elseif( input[0xA02] ) //Apply Button
                 return 0;
        elseif( input[0xA03] ) //Previous Button
                 Move_Page( "Previous" );
        elseif( input[0xA04] ) //Next Button
                 Move_Page( "Next" );
        endif
       
        return 1;
endfunction

function Action_Button( byref gump )

         case( page )
                 0: //Cancel or Next Button
                             GFAddButton( gump, 28, 482, 4017, 4018, GF_CLOSE_BTN, 0xA01 );
                             GFTextLine( gump, 60, 482, 1153, "Cancel" );
                 
                             GFAddButton(gump, 445, 482, 4005, 4006, GF_CLOSE_BTN, 0xA04 );
                             GFTextLine( gump, 400, 482, 1153, "Next" );
                             break;
                             
                 1:2:3:4:5:6: //Previous or Next Button
                            GFAddButton( gump, 28, 482, 4014, 4015, GF_CLOSE_BTN, 0xA03 );
                            GFTextLine( gump, 60, 482, 1153, "Previous" );

                            GFAddButton( gump, 445, 482, 4005, 4006, GF_CLOSE_BTN, 0xA04 );
                            GFTextLine( gump, 400, 482, 1153, "Next" );
                            break;

                 7: //Previous or Apply Button
                            GFAddButton( gump, 28, 482, 4014, 4015, GF_CLOSE_BTN, 0xA03 );
                            GFTextLine( gump, 60, 482, 1153, "Previous" );

                            GFAddButton(gump, 445, 482, 4012, 4013, GF_CLOSE_BTN, 0xA02 );
                            GFTextLine( gump, 400, 482, 1153, "Apply" );
                            break;
         endcase

         return gump;
endfunction

function Move_Page( action )

         if( action == "Previous" )
                 page -= 1;
         elseif( action == "Next" )
                 page += 1;
         endif
endfunction


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 12:24 pm 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 91
Location: Montreal, Canada
Thanks a lot for your help, it works.

_________________
Image
FantasiaShard.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl