Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Radio Buttons (GUI) (https://forums.graalonline.com/forums/showthread.php?t=67908)

Omini 08-06-2006 09:29 PM

Radio Buttons (GUI)
 
Can anyone show me an example of how the Radio Buttons work? (That's what they're called right? Radio Buttons? Like the buttons used at the bottom of a reply/new thread to choose the Post Icon?)

I've done a forum search--but couldn't find anything.

I searched the following pages:
http://wiki.graal.net/index.php/Crea..._.27weapons.27
http://wiki.graal.net/index.php/Crea.../Script/Client

Also with a search of "Radio buttons", "Radio" and "Radiobuttons" on the wikipedia.

I'd just like an example of how they would work, like so if you had 2 only one could be selected at a time (and what ever one is selected is read from a clientr.string). I just need the basics though, I can do the rest.

Yen 08-07-2006 08:18 PM

Deal with them the same as a regular checkbox control.
Make a new GuiRadioCtrl for each button in the group.
Set their 'groupnum' variables to the same values. Only one button with the same groupnum can be checked at a time.
You can then read which is checked by going through each GUI and reading 'GUI.checked'

Omini 08-07-2006 09:19 PM

I have no idea how to use checkboxes either. But would the GuiRadioCtrl look something like this?

PHP Code:

new GuiRadioCtrl("RadioButton1") {
  
20;
  
20;
  
width 32;
  
height 32;
  
groupnum 1;
}

new 
GuiRadioCtrl("RadioButton2") {
  
60;
  
20;
  
width 32;
  
height 32;
  
groupnum 1;
}

new 
GuiRadioCtrl("RadioButton3") {
  
20;
  
60;
  
width 32;
  
height 32;
  
groupnum 2;
}

new 
GuiRadioCtrl("RadioButton4") {
  
60;
  
60;
  
width 32;
  
height 32;
  
groupnum 2;


Would that be it? Or is there anything else that I missed out?



Edit:

I've tried it and it works. Thanks for your help Yen.

Also - am I right in understanding that to read it, you've said GUI.checked? Would that be like this :

PHP Code:

if (RadioButton1.checked == true) { } 

Or is it something else?

Angel_Light 08-08-2006 12:24 AM

Yeah that looks correct

Omini 08-09-2006 07:17 PM

I still don't know how to read if the radio button is selected or not.

Here's the radio button part.

PHP Code:

new GuiRadioCtrl("MsgOptionsRadio_Main1") {
      
80;
      
54;
      
width 16;
      
height 16;
      
groupnum 1;
    } 

That's everything I have concerning that Radio Button (so if I'm missing a control or anything, let me know please)

Checking it, I've tried loads, but it can't read it.

I have it that reading it occurs after the player pushes a Button.

PHP Code:

if (MsgOptionsRadio_Main1.select == true) {
    echo(
"Correct");
  } else {
    echo(
"WTF?!");
  } 

Every time I try it, it just echos 'WTF?!'.

Please tell me what it is I'm missing.

ForgottenLegacy 08-10-2006 01:17 PM

It's 'checked' or 'selected', 'select' is not an attribute.

Omini 08-10-2006 07:06 PM

I believe I also tried those 2, but I'll try again.

*tries*

Ok so I've tried every one of the following and still no luck:
if ("MsgOptionsRadio_Main1".checked == "true") {
if (MsgOptionsRadio_Main1.checked == "true") {
if ("MsgOptionsRadio_Main1".checked == true) {
if (MsgOptionsRadio_Main1.checked == true) {
if (MsgOptionsRadio_Main1.selected == "true") {
if ("MsgOptionsRadio_Main1.selected" == "true") {
if (MsgOptionsRadio_Main1.selected == true) {
if ("MsgOptionsRadio_Main1.selected" == true) {



Any suggestions?

ForgottenLegacy 08-12-2006 04:04 AM

You don't need to have the names of buttons in quotes, because it's all one word with no spaces and no mathematical symbols. 'true' is a constant defined as nonzero, and it's a keyword, so it doesn't need to be in quotes.

First off, paste the part of the script you have the part where you check the status of the radio button. Is it in a timeout loop? If not, is it in an onAction block? If not, then explain how you're doing it.

Omini 08-12-2006 02:34 PM

Quote:

Originally Posted by ForgottenLegacy
You don't need to have the names of buttons in quotes, because it's all one word with no spaces and no mathematical symbols. 'true' is a constant defined as nonzero, and it's a keyword, so it doesn't need to be in quotes.

First off, paste the part of the script you have the part where you check the status of the radio button. Is it in a timeout loop? If not, is it in an onAction block? If not, then explain how you're doing it.


I don't have anything for it... but when I test the NPC and click on the radio button, it gets selected--so I assumed you didn't need anything for it.


All times are GMT +2. The time now is 04:58 AM.

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