Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-06-2006, 09:29 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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.
__________________



Reply With Quote
  #2  
Old 08-07-2006, 08:18 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
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'
Reply With Quote
  #3  
Old 08-07-2006, 09:19 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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?
__________________




Last edited by Omini; 08-07-2006 at 10:07 PM..
Reply With Quote
  #4  
Old 08-08-2006, 12:24 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Yeah that looks correct
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 08-09-2006, 07:17 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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.
__________________



Reply With Quote
  #6  
Old 08-10-2006, 01:17 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
It's 'checked' or 'selected', 'select' is not an attribute.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #7  
Old 08-10-2006, 07:06 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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?
__________________



Reply With Quote
  #8  
Old 08-12-2006, 04:04 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to 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.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #9  
Old 08-12-2006, 02:34 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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.
__________________



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:00 PM.


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