Multiple TextEntries

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Zik
Novice Poster
Posts: 41
Joined: Sun Feb 07, 2010 9:39 am
Location: Ukraine

Multiple TextEntries

Post by Zik »

worked it out with a help of samplegump.scr, but that wasn't easy, someone could make a nice faq on this topic. Thx to Distro pkg creators ;)
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Multiple TextEntries

Post by Yukiko »

It might be helpful to others if you posted your solution here.
User avatar
andenixa
Grandmaster Poster
Posts: 105
Joined: Tue Nov 09, 2010 1:33 am

Re: Multiple TextEntries

Post by andenixa »

Assuming you are using new gumps by Austin. Feed your text_entries to a dictionary:


var gump := GFCreateGump(10, 40, 200, 240);
GFResizePic(gump, 0, 0, 2600, 0, 0 ); // just a background

var text_etries := dictionary{};

GFGumpPic( gump, x, y-1, 0x98d ); // medium sized background
text_etries["myLine"] := GFTextEntry( gump, x+7, y, 93, 25, 900, "" ); // actual text entry

GFGumpPic( gump, x, (y += 25)-1, 0x98d ); // medium sized background
text_etries["anotherLine"] := GFTextEntry( gump, x+7, y, 93, 25, 900, "" ); // another text entry

GFGumpPic( gump, x, (y += 25)-1, 0x98d ); // medium sized background
text_etries["suparLine"] := GFTextEntry( gump, x+7, y, 93, 25, 900, "" ); // yet one more text entry

var res := GFSendGump( gump, who );

// reading the lines
foreach line_name in (text_etries.keys())
text_etries[line_name].text := GFExtractData(res, text_etries[line_name].keyid);
endforeach

// now access your lines like:

if(text_etries["myLine"] .text=="whatever") // first line value
// proffit
endif
Zik
Novice Poster
Posts: 41
Joined: Sun Feb 07, 2010 9:39 am
Location: Ukraine

Re: Multiple TextEntries

Post by Zik »

Thank you a lot!
A few questions appeared about this part
andenixa wrote: // reading the lines
foreach line_name in (text_etries.keys())
text_etries[line_name].text := GFExtractData(res, text_etries[line_name].keyid);
endforeach
1) I didnt find .text and .keyid members for dictionaries or in the gump pkg's includes'. Function GFTextEntry() returns txt_id to text_etries[line_name]. How can .keyid member find out which key this text entry is in the res ?
And should i declare text_etries.+text member?

2) In this construction (y += 25)-1 , what does += do ? Also you never declared x and y.

I tried hard to find answers myself, but unfortunately didn't :(
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Multiple TextEntries

Post by Yukiko »

Zik wrote: 2) In this construction (y += 25)-1 , what does += do ?
I can answer that question. The operator += means increment the value on the left side of the operand by the value on the right side of the operand. So if y=4 then y += 25 would add 25 to y thus changing y's value to 29. Other operators similar to the += that are now present in POL are -=, *=, /= and %=. Racalac's eScript Reference and Guide has not yet been updated to reflect the addition of these "new" operands. Check the core-changes.txt file for the most up-to-date information on changes to the eScript language as well as changes to POL Core itself.
Zik
Novice Poster
Posts: 41
Joined: Sun Feb 07, 2010 9:39 am
Location: Ukraine

Re: Multiple TextEntries

Post by Zik »

Thank you, Yukiko!
Post Reply