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 12-27-2012, 04:56 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
GuiTextCtrl passed text not showing

This is just showing up "0"...

The echo right above the gui shows the correct value as well. I've also done it without destroy(), destroyonhide, and without the tween. None of that is effecting it.

PHP Code:
// Function to move in name on the screen
function showName()
{
  echo(
this.speaker);
  
Dialog_Name.destroy();
  new 
GuiTextCtrl("Dialog_Name"
  { 
    
30;
    
profile Armageddon_Text;
    
destroyonhide true;
      
    
text this.speaker;
    
    
width 128;
    
height 320;
      
    
//layer = 7;
    
zoom 0.7;
    
alpha 1;
    
    
fonttype "Palatino Linotype";
    
fontstyle "bu";
    
textshadow true;
    
shadowcolor = {606045};
    
shadowoffset = {43};
    
    
this.join("tween");
  }
  
Dialog_Control.addcontrol(Dialog_Name);
  
  
// tween the image
  
(@"Dialog_Name").tween("x"0.250110);
  
waitfor((@"Dialog_Name"), "TweenFinished"0.05);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-27-2012, 06:13 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Change...

PHP Code:
text this.speaker
to...

PHP Code:
text thiso.speaker
this.speaker is not defined in the GUI object.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 12-27-2012, 06:51 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Ok cool that was it. Can you give me a brief explanation of making variables objects and why?

Also, am I doing the addcontrol correctly? It tends to mess things up but I obviously wanted it all to be part of a control. Specifically in this weapon another brings up bitmap buttons and it seems they lose on catchevent if I hit any button or click anything, even one of the 3 buttons itself. Even the hover highlight never works at all unless I remove the addcontrol.

PHP Code:
// Function to move in message on the screen
function showOptions(temp.idC)
{
  echo(
this.options[temp.idC]);
  (
"Dialog_Choice" @temp.idC).destroy();
  new 
GuiBitmapButtonCtrl("Dialog_Choice" @temp.idC)
  {
    
150;
    
destroyonhide true;
      
      
    
text thiso.options[temp.idC];
    
//normalbitmap = "";
    //mouseoverbitmap = "";
      
    //layer = 7;
    
zoom 0.6;
    
alpha 1;
      
    
this.join("tween");
    
this.catchId temp.idC;
    
    
thiso.catchevent(this"onMouseUp""selectedOpt");
  }
  
Dialog_Control.addcontrol(@ "Dialog_Choice" @temp.idC);
  
  
// tween the image x 
  
(@"Dialog_Choice" @temp.idC).tween("x"0.5050);
  
waitfor((@"Dialog_Choice" @temp.idC), "TweenFinished"0.05);
  
  
// tween the image y
  
(@"Dialog_Choice" @temp.idC).tween("y"0.5, (@"Dialog_Choice" @temp.idC).y, (@"Dialog_Choice" @temp.idC).+ (temp.idC 300));
  
waitfor((@"Dialog_Choice" @temp.idC), "TweenFinished"0.05);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 12-27-2012, 08:28 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by sssssssssss View Post
Ok cool that was it. Can you give me a brief explanation of making variables objects and why?
The this. prefix always refers to the current object scope. When you're in a GUI "new" block (or similar, such as "with"), you're outside of the script scope. The thiso. prefix can always be used to get back to the script scope.

PHP Code:
// script of NPC Test
function onCreated() {
  
this.foo "bar";
  echo(
this.foo); // echoes "bar"
  
echo(Test.foo); // echoes "bar"
  
  
with (findPlayer("cbk1994")) {
    echo(
this.foo); // probably echoes 0 since this won't exist
    
echo(thiso.foo); // echoes "bar"
  
}

Looks like the addControl is being used correctly to me but depending on what you're trying to do it may or may not be correct. In general I would move the addControl line up to inside the control definition and just do Dialog_Control.addControl(this);
__________________
Reply With Quote
  #5  
Old 12-27-2012, 09:11 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Ok I think I get it.

And with addcontrol I was just making sure I guess its controller.addcontrol(controlled);
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


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 11:56 AM.


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