Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   getselectedtext() (https://forums.graalonline.com/forums/showthread.php?t=63248)

talkingnoodle 01-06-2006 12:04 AM

Help!
 
NPC Code:

function Button_2.onAction() {
Main_Window.destroy();
player.chat = "Started Event: " @ List_1.getselectedtext();
}



im using GuiPopUpMenuCtrl(List_1) and I want it to set my chat to what my option was, but instead it is saying 'Started Event: 0' instead of 'Started Event: <event>'

Kronan 01-06-2006 12:22 AM

I don't quite understand why you deleted your thread from the GS2 forum, that was in the CORRECT forum for this question. But here is what I had posted there.

Your problem is because you're using getselectedtext(). That does not do what you want it to do. You want to be using gettext().

http://wiki.graal.us/GScript - Please use this, it can be your best friend when you need to look something up.

I took this right from the wiki:

Quote:

GuiButtonBaseCtrl (GuiControl):
buttontype - string
checked - boolean
groupnum - integer
text - string
gettext() - returns string
performclick()
settext(str)

talkingnoodle 01-06-2006 01:19 AM

yes but im not looking for button...im using the popupctrl and gettext() doesnt work either :/

ApothiX 01-06-2006 01:26 AM

Kronan: He is correct in using getselectedtext() to retrieve the value.

The problem may also be that you are destroying the main window, before you are attempting to read the text from it.

talkingnoodle 01-06-2006 01:28 AM

that doesnt work either...ive tried everything :/

Admins 01-09-2006 03:44 AM

This should work:
PHP Code:

function Button_2.onAction() {
  
player.chat "Started Event: " List_1.text;
  
Main_Window.destroy();


You must get the text first, before you destroy the window and its subcontrols. "text" and "getSelectedTex()" should give the same values, "getSelectedText()" is mainly for backwards compatibility. If you still don't get the text, then "List_1" is eventually not the correct name of the popup control.


All times are GMT +2. The time now is 01:33 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.