PDA

View Full Version : OnDialogResponse - list - inputtext


Mojzesz
28/08/2011, 11:40 AM
Hello.
I am having a very annoying issue, that makes few features of my script just impossible. So, without further ado, I'll just show you what I mean.
I've got some dynamic things in my script, and when player uses "/things", it displays a ShowPlayerDialog list like this:
UID Thing desc.
22 Small thingie
232 Very big thing, this is kinda long, but not too much and it should work goddamit!
At OnDialogResponse I use this:
switch( dialogid )
{
case DIALOGID_LIST:
{
if( !response )
return 1;

new
thingUID = strval( inputtext ),
thingInfo[ 200 ]
;

// When player clicks on any listitem, the chosen item text is being stored into inputtext[ ].
// As you may see, I am getting a UID variable from this text.

format( thingInfo, 200, "Thing UID: %d\nThing description: %s",
thingUID, Thing[ thingUID ][ thingDesc ] );

ShowPlayerDialog( playerid, DIALOGID_INFO, DIALOG_STYLE_MSGBOX, "Thingies",
thingInfo, "Back", "" );
}
}
It works fine for the first item, because the listitem text is pretty short. After choosing it, you can see the small dialog window with text:
Thing UID: 22
Thing description: Small thingie
But, when player chooses the second item ("Very big thing..."), window text looks like this:
Thing UID: 0
Thing description:
So, when the listitem text is longer than some amount of characters, it is not stored in inputtext.
Is there any way to fix this?
Thanks for reading the topic. Help, please.

[MG]Dimi
28/08/2011, 08:49 PM
Wait wait wait. You want to get inputtext[] from DIALOG_STYLE_LIST?

PrawkC
28/08/2011, 09:06 PM
@Dimi
in a list inputtext is the name of the listitem.

Mojzesz
30/08/2011, 01:05 PM
Right. And I am getting a value from this inputtext. But the problem is, when list name is too long, inputtext becomes empty...

mick88
30/08/2011, 01:54 PM
try to print() the content of inputtext. If there's anything before the number, the strval() will return 0. There's a chance you put some unnecessary character between list items.