Code: Select all
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