Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-12-2012, 03:04 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
GuiTextEditCtrl assigning and showing variables help

How do I make a gui text a string?
Where as client.intro = 5;
Dev_Client_Var = "client.intro";

function Dev_Client_OK.onAction(){
(""@"player."@Dev_Client_Var.text) = 15;
}

I want player.client.intro = 15;
But I can't seem to do it..
It either says 5, or 0..

I've been messing around with it... Not sure what to do.

PHP Code:
function Dev_Client_OK.onAction(){
//player.Dev_Client_Var.text = 15;
  
player.chat "player."@Dev_Client_Var.text;
  
sleep(1); 
  
player.chat "player."(""@Dev_Client_Var.text);
  
sleep(1);
//(""@Dev_Client_Var.text = Dev_Client_NewVar.text; 

Yet I can't even get this to show it as a string.
player.client.intro = 15;
instead it is basically doing 5 = 15... Which doesn't make sense.
Attached Thumbnails
Click image for larger version

Name:	Screen shot 2012-04-11 at 8.49.46 PM.png
Views:	129
Size:	12.3 KB
ID:	54491  
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-12-2012 at 07:58 AM..
Reply With Quote
  #2  
Old 04-12-2012, 09:03 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Have you tried something like this?
PHP Code:
  player.(@Dev_Client_Var.text); 
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 04-12-2012, 12:19 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
You've set Dev_Client_Var to client.intro, so why are you doing Dev_Client_Var.text?
PHP Code:
//#CLIENTSIDE

function onCreated() {
  var = 
"hello";
  
player.chat = var;
  
//not player.chat = var.text

edit:
Wait, is Dev_Client_Var a GUI text ctrl?

PHP Code:
new GuiTextCtrl("Dev_Client_Var") {
  
//all this x and y crap
  
var = client.intro;
}

new 
GuiButtonCtrl("Dev_Client_OK") {
  
//all this x and y crap
}

function 
Dev_Client_OK.onAction() {
  
//Are you trying to make it trad Dev_Client_Var.var?
  
player.chat "player." Dev_Client_Var.var;

I'm trying to understand what you're trying to do here but what you just posted didn't make a lot of sense to me.
__________________
Reply With Quote
  #4  
Old 04-12-2012, 02:22 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by Emera View Post
You've set Dev_Client_Var to client.intro, so why are you doing Dev_Client_Var.text?
PHP Code:
//#CLIENTSIDE

function onCreated() {
  var = 
"hello";
  
player.chat = var;
  
//not player.chat = var.text

edit:
Wait, is Dev_Client_Var a GUI text ctrl?

PHP Code:
new GuiTextCtrl("Dev_Client_Var") {
  
//all this x and y crap
  
var = client.intro;
}

new 
GuiButtonCtrl("Dev_Client_OK") {
  
//all this x and y crap
}

function 
Dev_Client_OK.onAction() {
  
//Are you trying to make it trad Dev_Client_Var.var?
  
player.chat "player." Dev_Client_Var.var;

I'm trying to understand what you're trying to do here but what you just posted didn't make a lot of sense to me.
Yes, it is a GUI text ctrl, I was helped by the first part with Thyme (looking back I wouldn't have been able to do it my self) Took him about 20 minutes to figure it out. Now I'd like the input of the GUI to be able to set the variable...

You input the variable name in the left input i.e.: "client.intro"
then in the right input you would put in the number or array
i.e.: 5 or {6,4,2} or "testing"...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #5  
Old 04-12-2012, 02:36 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Devil_Lord2 View Post
Yes, it is a GUI text ctrl, I was helped by the first part with Thyme (looking back I wouldn't have been able to do it my self) Took him about 20 minutes to figure it out. Now I'd like the input of the GUI to be able to set the variable...

You input the variable name in the left input i.e.: "client.intro"
then in the right input you would put in the number or array
i.e.: 5 or {6,4,2} or "testing"...
client.intro = controlname.text;
__________________
Reply With Quote
  #6  
Old 04-12-2012, 03:33 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Visual Example

If no one can understand this, I don't know what people will.
I tried to have it just equal 15 (so I really didn't have to keep typing it)
This should show visually what I'm trying to do.

Input1 assigns Input2 to itself.
PHP Code:
input1 Client Variable
input2 
Client NewVar

Type in 
"client.intro" to input1  (Automatically adds player.)
input1 client.intro;

Type in "15" to input2
input2 
15;

input1 input2;
input1 "player.client.intro" 15
   
However:
player.client.intro != 15;  
Something is going wrong, and it isn't assigning or seeing player.client.intro as a real variable.. 

Later I'll have to do:
if (input1 == null){
return;
}
So that if there is no such thing as client.intro, it wouldn't do anything.



I've tried this too:
PHP Code:
function Dev_Client_OK.onAction(){
  
temp.obj = new TStaticVar();
  
temp.obj.newVar "player."@Dev_Client_Var.text;
  
player.chat "Input box: "@obj.newVar;
  
sleep(3);
  @
obj.newVar 15;
  
player.chat "@obj.newVar:"SPC obj.newVar SPC "should be 15";
  
sleep(3);
  
player.chat "In reality it is:" SPC player.client.intro;
  
temp.obj.destroy();

Basically you see "Input box: player.client.intro" then
"@obj.newVar: player.client.intro should be 15", then
"In reality it is: 5" since my client.intro is 5 and hasn't
changed.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-12-2012 at 05:27 PM.. Reason: Hopefully this should help greater.
Reply With Quote
  #7  
Old 04-12-2012, 06:13 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
I don't really understand but I think you could just do for the input null part:
PHP Code:
  if(!input) return; 
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #8  
Old 04-12-2012, 06:24 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by Gunderak View Post
I don't really understand but I think you could just do for the input null part:
PHP Code:
  if(!input) return; 
The only reason why I can't do this ... well I can do it but still need the other part is
someone might put client.peanuts = 12 in the input..

Well if the variable 'peanuts' does not exist, it probably shouldn't be used lol...




So it will still have an input but that isn't the question right now but is for the second part, thank you for attempting to help!! Not quite what I was going for though.

I might have to have it search through the clients current strings/variables that exist...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-12-2012 at 07:03 PM..
Reply With Quote
  #9  
Old 04-12-2012, 11:22 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You're looking for makevar. Avoid using 'var' by itself as a variable name.

I.e.

PHP Code:
function setVar(varivalue) {
  
makevar(vari) = value;

then in your code when the button is clicked..

PHP Code:
function Dev_Client_OK.onAction(){
  
setVar(Dev_Client_Var.textDev_Client_NewVar.text);

__________________
Quote:
Reply With Quote
  #10  
Old 04-12-2012, 11:26 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
I need to spread rep before I positive rep you again. Thank you so freaking much.
I don't think the problem was exactly others couldn't understand it, I think they just couldn't do it therefor not comprehending what was supposed to be done.

The video it self should have explained it... regardless you've done it!
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



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 08:21 PM.


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