Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2011, 11:15 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
obj.hide() problems

I'm having some problems with the
HTML Code:
obj.hide()
It's finding the NPCs (using a loop)
HTML Code:
for (temp.i: npcs) {
  if (temp.i.isinclass("event_block")) temp.i.trigger("onToggleVis", true/false);
}
in the NPC
HTML Code:
function onToggleVis(mode) {
  if (temp.mode == true) this.hide(); 
  else this.show();
}
Although, it calls the function (onToggleVis) but it won't hide the NPC. I saw this
HTML Code:
obj.hidetoclients = boolean
when I set it to true, it hides no problem. It just won't come back!

Thanks
__________________
Reply With Quote
  #2  
Old 02-08-2011, 11:19 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
I feel like using 'mode' would cause a problem, keywords/built-in variables can be jerks sometimes.
__________________
Quote:
Reply With Quote
  #3  
Old 02-08-2011, 11:52 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
It's detecting the right function & mode, so it's not that =[

I just want to hide the object, so it doesn't block the player =[
__________________
Reply With Quote
  #4  
Old 02-08-2011, 11:55 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
PHP Code:
trigger("ToggleVis"true/false)
// instead of
trigger("onToggleVis"true/false
That should do it, no?
Reply With Quote
  #5  
Old 02-09-2011, 01:43 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Crow View Post
PHP Code:
trigger("ToggleVis"true/false)
// instead of
trigger("onToggleVis"true/false
That should do it, no?
No, it doesn't matter which one. It'll still invoke "onToggleVis."

Quote:
Originally Posted by xAndrewx View Post

HTML Code:
function onToggleVis(mode) {
  if (temp.mode == true) this.hide(); 
  else this.show();
}
Why not try something simpler, like:
PHP Code:
function onToggleVis(mode) {
  
this.visible mode;

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #6  
Old 02-09-2011, 09:16 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
nope @ tig =[
__________________
Reply With Quote
  #7  
Old 02-09-2011, 01:48 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
PHP Code:
function onToggleVis(mode) { 
  
this.visible mode
  
this.trigger("update");

I haven't read every post in this thread but have you tried that?
__________________
Reply With Quote
  #8  
Old 02-09-2011, 02:57 PM
codecub codecub is offline
Banned
Join Date: Feb 2011
Location: psych ward
Posts: 37
codecub is an unknown quantity at this point
at times like this firebug would be great for debugging graalscript
Reply With Quote
  #9  
Old 02-09-2011, 03:58 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by cbk1994 View Post
PHP Code:
function onToggleVis(mode) { 
  
this.visible mode
  
this.trigger("update");

I haven't read every post in this thread but have you tried that?
Normally you don't need that, since he is triggering the npc anyway (triggering is waking it up).
On server-side to change some other npc you normally have to:
npc.visible = false;
npc.trigger("updateorso","");

That sets the visibility to false and is also waking up the npc so that the new attributes are sent to the clients.

The original code looks a little bit fishy to me though, you are hiding when you pass "true" and show when you pass "false"? That can confuse the one who is calling the function and thinks it will actually show when you call it with parameter "true".
Reply With Quote
  #10  
Old 02-09-2011, 11:17 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Thanks guys- greathelp
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:46 AM.


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