TextEntry with gumps

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

TextEntry with gumps

Post by *Edwards »

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

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

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.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Alright! I have found it ;)

Code: Select all

         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
Post Reply