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-05-2011, 12:05 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
gui and catchevent question

In my scrolls I use a textctrl and set it's modal to false so I can get the event from just the scroll behind. textctrl won't return the events when I test it (modal is false) but still does block the scrollctrl preventing me from catching onmousedown

PHP Code:
//Snippet
        
new GuiScrollCtrl"Keyboard_" temp."_" temp.b)
        {

          
useOwnProfile  true;
          
profile        "GuiScrollProfile";
          
profile.border 4;
          
profile.bitmap "guiglife_keyscroll.png";
          
position       = {( temp.== && temp.0)? ( 24 44 temp.b): ( temp.== && temp.0)? ( 40 44 temp.b): ( temp.== && temp.0)? ( 48 44 temp.b): ( 44 temp.b), 44 temp.a};
          
extent         = {( temp.key == ">>")? 64: ( temp.key == "<<")? 64: ( temp.key == "Backspace")? 128: ( temp.key in "Upper""Lower"})? 80:( temp.key == "Enter")? 156:( temp.key == "Shift")? 88:( temp.key == "Space")? 1484040};
          
vscrollBar     hscrollBar "alwaysOff";
          
thiso.catchEventthis"OnMouseDown""KeyboardDown");
        
          new 
GuiTextCtrl"Keyboard_" temp."_" temp."_Text")
          {
          
            
useownProfile        true;
            
position             = { -2, -14};
            
width                = ( "Keyboard_" temp."_" temp.b).width
            
text                 temp.key;
            
profile.fontColor    = { 2552550205};
            
profile.fontSize     24;
            
profile.fontStyle    "cb";
            
profile.fontType     "Arial";
            
profile.shadowOffset = { 22};
            
profile.shadowColor  = { 000};
            
profile.align        "center";
            
profile.textShadow   true;
            
profile.modal        profile.autoSizeWidth false;
            
useOwnProfile        true;
            
          }
        } 
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #2  
Old 04-05-2011, 12:37 AM
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
and you have:

PHP Code:
function KeyboardDown(obj) {
  
//defined?

Something about having useownprofile being set last before your profile vars doesn't gel right with me either.
__________________
Quote:
Reply With Quote
  #3  
Old 04-05-2011, 12:58 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
the event you're catching is onMouseDown, and invoking
PHP Code:
function KeyboardDown(){


outside of the UI block

should also change this to name or this.name I believe, it is expecting a string, not an object.
Reply With Quote
  #4  
Old 04-05-2011, 01:40 AM
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
Quote:
Originally Posted by Mark Sir Link View Post
should also change this to name or this.name I believe, it is expecting a string, not an object.
No it does expect an object, Graal's object/string magic just lets that way work.
__________________
Quote:
Reply With Quote
  #5  
Old 04-05-2011, 01:42 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
TGraalVar.catchevent(str, str, str) - adds an event handler for the specified object and event, third parameter is the function which receives the event (first parameter of the event will be the object for which the event occured)
Reply With Quote
  #6  
Old 04-05-2011, 01:42 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
@ fowlplay4:
Yes it's defined properly just not echoing anything, removing useownprofile at the end doesn't work either.

@Mark Sir Link:
Chris Vimes instructed me to use 'this'
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #7  
Old 04-05-2011, 01:51 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Sometimes Graal wants an object, aka "this" sometimes it wants a reference to an object, aka "name." Enjoy the ****ing headaches.
Reply With Quote
  #8  
Old 04-05-2011, 02:01 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
I am only going with what scripthelp displays as the expected params, 3 strings

not sure what other string it could possibly want besides name, and I'm sure the reason this works isn't because it's what's expected, but instead because echoing objects tends to return object.name

Anyway, on closer look, I think the real issue here is you are throwing an event for mousedown when I assume that that event is thrown when the scroll buttons are pushed. You have the scroll bars disabled, so I think it would be a virtual impossibility to ever throw that event.
Reply With Quote
  #9  
Old 04-05-2011, 02:05 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by Mark Sir Link View Post
Anyway, on closer look, I think the real issue here is you are throwing an event for mousedown when I assume that that event is thrown when the scroll buttons are pushed. You have the scroll bars disabled, so I think it would be a virtual impossibility to ever throw that event.
after testing you are correct, thank you.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #10  
Old 04-06-2011, 08:36 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by Mark Sir Link View Post
I am only going with what scripthelp displays as the expected params, 3 strings

not sure what other string it could possibly want besides name, and I'm sure the reason this works isn't because it's what's expected, but instead because echoing objects tends to return object.name
Quote:
Originally Posted by Mark Sir Link View Post
TGraalVar.catchevent(str, str, str) - adds an event handler for the specified object and event, third parameter is the function which receives the event (first parameter of the event will be the object for which the event occured)
there's your parameters right there.
it want's an object, documention failure. (<- future reference, i know it have been solved already)
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #11  
Old 04-06-2011, 08:41 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
Quote:
Originally Posted by Deas_Voice View Post
there's your parameters right there.
it want's an object, documention failure. (<- future reference, i know it have been solved already)
Well it ultimately finds the object (object/string magic still stands) whether you pass it the reference or it's name anyway.

I.e:

PHP Code:
function onCreated() {
  
temp.req requesturl("http://google.ca");
  
temp.requestname temp.req.name;  // Just for example, don't actually do it this way.
  
this.catchevent(temp.requestname"onReceiveData""onWebData");
}

function 
onWebData() {
  echo(
"Data received!");

Passing an object still looks better in the end though.
__________________
Quote:
Reply With Quote
  #12  
Old 04-06-2011, 09:27 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Deas_Voice View Post
there's your parameters right there.
it want's an object, documention failure. (<- future reference, i know it have been solved already)
not sure what you're trying to indicate since it reads "specified object" rather than just object.

Specified leads me to believe string even more so.
Reply With Quote
  #13  
Old 04-06-2011, 09:39 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 Mark Sir Link View Post
not sure what you're trying to indicate since it reads "specified object" rather than just object.

Specified leads me to believe string even more so.
Specified object means exactly that—the specified object. It's the object you want to catch events from. Why does specified make you think string?

You could use the name, but I think it's silly to do so in an object-oriented language. Who knows what it does behind the scenes, though...
__________________
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 01:35 AM.


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