Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   obj.hide() problems (https://forums.graalonline.com/forums/showthread.php?t=134262021)

xAndrewx 02-08-2011 11:15 PM

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

fowlplay4 02-08-2011 11:19 PM

I feel like using 'mode' would cause a problem, keywords/built-in variables can be jerks sometimes.

xAndrewx 02-08-2011 11:52 PM

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 =[

Crow 02-08-2011 11:55 PM

PHP Code:

trigger("ToggleVis"true/false)
// instead of
trigger("onToggleVis"true/false

That should do it, no?

Tigairius 02-09-2011 01:43 AM

Quote:

Originally Posted by Crow (Post 1629216)
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 (Post 1629203)

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;



xAndrewx 02-09-2011 09:16 AM

nope @ tig =[

cbk1994 02-09-2011 01:48 PM

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?

codecub 02-09-2011 02:57 PM

at times like this firebug would be great for debugging graalscript

Admins 02-09-2011 03:58 PM

Quote:

Originally Posted by cbk1994 (Post 1629389)
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".

xAndrewx 02-09-2011 11:17 PM

Thanks guys- greathelp :)


All times are GMT +2. The time now is 07:02 PM.

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