It is currently Wed Oct 15, 2008 10:48 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: TextEntry with gumps
PostPosted: Tue May 27, 2008 7:19 am 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 103
Location: Montreal, Canada
Just got stuck when I tried to extract data from my textentries. For exemple, I extract informations from a config files to display and I want to be able to set a value accordingly to the informations given.

Sorry for the visual exemple:
-------------------------------------
-
- MyName (TextEntry)
- MyLastName (TextEntry )
- My Favorite Color ( TextEntry)
-
-------------------------------------

Code:
var config := ReadConfigFile( ":Main:Players" );
   var elem := config["Settings"];
   var script_list := GetConfigStringArray( elem, "Elem" );
   var num_options := script_list.Size();

   var y_pos := 110;
   foreach entry in ( script_list )

                GFTextLine( gump, 45, y_pos, 1153, entry );
                GFResizePic( gump, 250, y_pos, GFGetCfgConst("Backgrounds", "GOLDTRIM" ), 190, 28 );
                GFTextEntry( gump, 255, y_pos+4, 190, 28, 2100 );

      y_pos += 20;

      SleepMS(2);
   endforeach


The main idea is to extract the GFTextEntry into an array and then I can save all the data in a new config file. The next exemple doesn't work and I'm wondering why:

Code:
var config := ReadConfigFile( ":Main:Players" );
   var elem := config["Settings"];
   var script_list := GetConfigStringArray( elem, "Elem" );
        var data := array;

   var y_pos := 110;
   foreach entry in ( script_list )

                GFTextLine( gump, 45, y_pos, 1153, entry );
                GFResizePic( gump, 250, y_pos, GFGetCfgConst("Backgrounds", "GOLDTRIM" ), 190, 28 );
                data.append( GFTextEntry( gump, 255, y_pos+4, 190, 28, 2100 ));

      y_pos += 20;

      SleepMS(2);
   endforeach

var input := GFSendGump( mobile, gump );
var result := GFExtractData( input, Data );
Broadcast( result );


I'm getting an error with result... at the moment I extract the text entries I will be alright but now I'm stuck.

Edited: From one side I understand why my "append()" doesn't work but I can't think of a way to extract it. In other words, I want to extract all the GFTextEntry for reading.

_________________
Image
FantasiaShard.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 11:46 am 
Offline
User avatar

Joined: Fri Dec 28, 2007 11:19 pm
Posts: 103
Location: Montreal, Canada
Alright! I have found it ;)

Code:
         var size := data.Size();
         
         var i;
         for( i:=1; i <= size; i+=1 )
                var result := GFExtractData( input, data[i] );
                if( result )
              Broadcast( result );
                endif
    endfor

_________________
Image
FantasiaShard.com


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl