Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   More gui trouble. -.- (https://forums.graalonline.com/forums/showthread.php?t=73758)

oo_jazz_oo 04-30-2007 03:06 AM

More gui trouble. -.-
 
Ok, I could never do this. ><
When you press a button, if a certain text in the gui says like "password" then something happens....
I have tried alot of stuff, so, can someone help me? x.x

HTML Code:

//#CLIENTSIDE
function onCreated(){
passwin.destroy();
}
function onWeaponFired(){
new GuiWindowCtrl("passwin") {
  profile = GuiBlueWindowProfile;
  x = 10;
  y = 10;
  canclose=true;
  canmove=true;
  canminimize=false;
  canmaximize=false;
  canresize=false;
  destroyonhide=true;
  width = 160;
  height = 120;
  text = "";
 
  new GuiMLTextCtrl("passs") {
  profile = GuiBlueMLTextProfile;
  x = 10;
  y = 30;
  width = 140;
  height = 10;
  text = "<center>Password:</center>";
}
 
  new GuiTextEditCtrl("password12") {
  profile = GuiBlueTextEditProfile;
  x = 10;
  y = 50;
  width = 140;
  height = 20;
  text = "";
}

 new GuiButtonCtrl("button1") {
  profile = GuiBlueButtonProfile;
  x = 30;
  y = 80;
  width = 100;
  height = 20;
  text = "Submit";
 }
 
}
}

function button1.onAction(){
if (thiso.password12 == "password"){
player.chat = "!";
}
}


Rapidwolve 04-30-2007 03:10 AM

What? I don't understand what you're trying to say.

oo_jazz_oo 04-30-2007 03:12 AM

Ok, you put "password" in the text space, click submit, and something happens.
In this case, the player says !.

zokemon 04-30-2007 03:14 AM

Why are you doing thiso.password12?
password12 is an object of it self. It does not belong to the npc o_o
You should just do password12 and you might see more of what you are looking for (what ever that is? x_x)

Andy0687 04-30-2007 03:14 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1304442)
Ok, you put "password" in the text space, click submit, and something happens.
In this case, the player says !.

PHP Code:

function button1.onAction() {
 if (
password12.text == "password") {
  
player.chat "!";
 }



Rapidwolve 04-30-2007 03:15 AM

PHP Code:


//#CLIENTSIDE
function onCreated(){
passwin.destroy();
}
function 
onWeaponFired(){
new 
GuiWindowCtrl("passwin") {
  
profile GuiBlueWindowProfile;
  
10;
  
10;
  
canclose=true;
  
canmove=true;
  
canminimize=false;
  
canmaximize=false;
  
canresize=false;
  
destroyonhide=true;
  
width 160;
  
height 120;
  
text "";
  
  new 
GuiMLTextCtrl("passs") {
  
profile GuiBlueMLTextProfile;
  
10;
  
30;
  
width 140;
  
height 10;
  
text "<center>Password:</center>";
}
  
  new 
GuiTextEditCtrl("password12") {
  
profile GuiBlueTextEditProfile;
  
10;
  
50;
  
width 140;
  
height 20;
  
text "";
}

 new 
GuiButtonCtrl("button1") {
   
profile GuiBlueButtonProfile;
   
30;
   
80;
   
width 100;
   
height 20;
   
text "Submit";
 }
  
}
}

function 
button1.onAction(){
if (
password12.text == "password"){
player.chat "!";
}


That should work, but heres another way you can "catch" the onAction

PHP Code:


//#CLIENTSIDE
function onCreated(){
passwin.destroy();
}
function 
onWeaponFired(){
new 
GuiWindowCtrl("passwin") {
  
profile GuiBlueWindowProfile;
  
10;
  
10;
  
canclose=true;
  
canmove=true;
  
canminimize=false;
  
canmaximize=false;
  
canresize=false;
  
destroyonhide=true;
  
width 160;
  
height 120;
  
text "";
  
  new 
GuiMLTextCtrl("passs") {
  
profile GuiBlueMLTextProfile;
  
10;
  
30;
  
width 140;
  
height 10;
  
text "<center>Password:</center>";
}
  
  new 
GuiTextEditCtrl("password12") {
  
profile GuiBlueTextEditProfile;
  
10;
  
50;
  
width 140;
  
height 20;
  
text "";
}

 new 
GuiButtonCtrl("button1") {
   
profile GuiBlueButtonProfile;
   
30;
   
80;
   
width 100;
   
height 20;
   
text "Submit";
   
thiso.catchevent(this"onAction""CheckPassword");
 }
  
}
}

function 
CheckPassword()
{
  if (
password12.text == "password")
    
player.chat "!";



oo_jazz_oo 04-30-2007 03:19 AM

Quote:

Originally Posted by zokemon (Post 1304444)
Why are you doing thiso.password12?
password12 is an object of it self. It does not belong to the npc o_o
You should just do password12 and you might see more of what you are looking for (what ever that is? x_x)

Because I was just trying everything I could, and I didnt change it when I posted it. :)

Thanks andy and rapid. :P

zokemon 04-30-2007 07:32 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1304450)
Because I was just trying everything I could, and I didnt change it when I posted it. :)

Thanks andy and rapid. :P

I don't get thanks? I solved 50% of your problem :(
You just needed to change thiso.password12 to password12.text

Andy0687 04-30-2007 07:45 AM

Quote:

Originally Posted by zokemon (Post 1304507)
I don't get thanks? I solved 50% of your problem :(
You just needed to change thiso.password12 to password12.text

By reading your solution he would have tried

if (password12 == "password") which wouldnt have worked.

Quote:

You should just do password12 and you might see more of what you are looking for (what ever that is? x_x)

zokemon 04-30-2007 12:15 PM

Quote:

Originally Posted by Andy0687 (Post 1304509)
By reading your solution he would have tried

if (password12 == "password") which wouldnt have worked.

Still 50% of the answer like I said ;)
I just didn't get what he was asking :o


All times are GMT +2. The time now is 06:38 PM.

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