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 02-26-2011, 02:21 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Switch needed for triggerserver?

Do I need a switch command for triggerserver?
I tried to check the command via if-funktion, but that didn't work, can someone tell me why?
PHP Code:
function onActionserverside() 
{
   if (
params[0] == "summon")   //If instead of a switch
   
{
      
temp.pl findplayerbycommunityname(params[1]);
      if (
pl != NULL
      {
       
pl.setlevel2(player.levelplayer.xplayer.y);
       
pl.chat format(""player.account);
       
player.chat format(""pl.communityname);
      }else
    
player.chat format("Community name '%s' not found!"params[1]);
   }
}
//#CLIENTSIDE
function onPlayerChats() 
{
   if (
player.chat.starts("/summon") && player.account != NULL
   {
    
triggerserver("gui"this.name"summon"player.chat.substring(8));
   }

__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #2  
Old 02-26-2011, 06:03 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
Switch docu: http://forums.graalonline.com/forums...ad.php?t=76294

A switch is just a glorified stack of if statements, at a quick glance I can't really see anything wrong unless you're putting this in a level npc and not a weapon.
__________________
Quote:
Reply With Quote
  #3  
Old 02-26-2011, 07:35 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
Your code looks correct. Try adding echoes to it to see if the trigger is being received.
__________________
Reply With Quote
  #4  
Old 02-26-2011, 09:14 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
to start with,
PHP Code:
  pl.chat format(""player.account); 
  
player.chat format(""pl.communityname); 
wont work, because you won't chat the account/communityname because there is no %s in the first parameter.
edit:
2nd, there's a space after //#CLIENTSIDE, remove that and the trigger will work.
3rd, there's no reason to have "&& player.account != NULL" since it's not possible to have no account and be a player chatting "/summon" !
__________________
.
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

Last edited by Deas_Voice; 02-26-2011 at 09:26 PM..
Reply With Quote
  #5  
Old 02-26-2011, 09:38 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
to 1st: useless, agreed
to 2nd: It works without space, but why? o.o'
to 3rd: useless, agreed
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #6  
Old 02-26-2011, 09:57 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 Schetti View Post
to 1st: useless, agreed
didn't say it was useless

Quote:
Originally Posted by Schetti View Post
to 2nd: It works without space, but why? o.o'
dono, but it's a common error, i believe that, if theres a space after it, it still consider it as serverisde
Quote:
Originally Posted by Schetti View Post
to 3rd: useless, agreed
lol copy/paste
__________________
.
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
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 12:59 AM.


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