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 10-15-2009, 08:52 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
Not adding or removing from guild

So, im trying to make it where you can add staffs clientr.var, wep, and tag all in one move, like many have done before. Dont quit see what im doing wrong. Please.

PHP Code:
function onActionServerSide(params) {
  
// Summons Player to You
  
if (params[0] == "summon") {
    
// Adjusts the Players Level, X, Y
    
findplayer(params[1]).setlevel2(player.levelplayer.xplayer.y);
    
// Adjusts Players Chat 
    
findplayer(params[1]).chat "Summoned by" SPC player.account;
  } 
  if (
params[0] == "addstaff") {
    
//sets the clientr.staff to yes
    
findplayer(params[1]).clientr.staff "yes";
    
//gives the staff weapon
    
findplayer(params[1]).addWeapon("StaffTool");
    
//puts them in the staff guild
    
addguildmember(params[2], params[1], params[3]);
  }
  if (
params[0] == "removestaff") {
    
//sets the clientr.staff to no
    
findplayer(params[1]).clientr.staff "no";
    
//removes the staff weapon
    
findplayer(params[1]).removeWeapon("StaffTool");
    
//takes them out of the staff guild
    
removeguildmember(params[2], params[1]);
  }
  if (
params[0] == "settag"){
    
getguildnick(params[1], player.account);
  }
   
}

//Custom staff boots system
//By: Gambet
//Controls:
//  + and = key (left of backspace on American keyboard) - plus speed
//  - and _ key (left of + and = key on American keyboard) - minus speed
//  z key = toggle on/off
//  Max Speed: 10

//#CLIENTSIDE
function onPlayerChats() {
// say /addstaff accountname position nickname
  
if (player.chat.starts("/addstaff")){
   if (
player.account == "sssssssssss" || player.account == "Decus_Arillias"){
    
// Gets acct from "/addstaff acct"
    
temp.toAdd player.chat.substring("/addstaff ".length());
    
// Sends Trigger to Server
    
triggerserver("gui"this.name"addstaff"temp.toAdd);
    }
   }
//say /removestaff accountname position
  
if (player.chat.starts("/removestaff")){
   if (
player.account == "sssssssssss" || player.account == "Decus_Arillias"){
    
// Gets acct from "/removestaff acct"
    
temp.toRem player.chat.substring("/removestaff ".length());
    
// Sends Trigger to Server
    
triggerserver("gui"this.name"removestaff"temp.toRem);
    }
   }
  if (
player.chat.starts("/summon")) {
   if (
clientr.staff == "yes"){
    
// Gets acct from "/summon acct"
    
temp.toSummon player.chat.substring("/summon ".length());
    
// Sends Trigger to Server
    
triggerserver("gui"this.name"summon"toSummon);
   }
  }
//say /settag position
  
if (player.chat == "/settag"){
   if (
clientr.staff == "yes"){
     
triggerserver("gui"this.name"settag"toTag);
    
   }
  }

function 
onKeyPressed(code,key)
{
if (
clientr.staff == "yes"){
 if (
key == "z")
  {
   if (
this.staff_boots == "on")
    {
      
this.staff_boots this.speed "";
      
player.chat "Staff Boots -Off-";
      
setTimer(0);
    } else
     {
       
this.staff_boots "on";
       
player.chat "Staff Boots -On-";
       
setTimer(0.05);
     }
  }
 if (
code == 187)
  {
   if (
this.speed+<= 10)
    {
     
this.speed+=1;
     
player.chat "Speed: " this.speed;
    }
  } else if (
code == 189)
   {
    if (
this.speed->= 0)
     {
      
this.speed-=1;
      
player.chat "Speed: " this.speed;
     }
   }
 }
}

function 
onTimeOut()
{
 if (
this.staff_boots == "on")
  {
   for (
a=0a<4a++)
    {
     if (
keydown(a))
      {
       switch(
a)
        {
          case 
"0":
           
player.y-=this.speed;
           break;
          case 
"1":
           
player.x-=this.speed;
           break;
          case 
"2":
           
player.y+=this.speed;
           break;
          case 
"3":
           
player.x+=this.speed;
           break;
        }
      }
    }
  }
 
setTimer(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 10-15-2009, 09:06 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
function onActionServerSide(params) {
ex: triggerserver("gui",name,{foo,bar,leb }, baroo);

so, params[0] is the first in a array, would be foo.
params[1] would be bar, not baroo.

(this is just thoughts, i haven't tested it,)
__________________
.
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
  #3  
Old 10-15-2009, 09:17 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
PHP Code:
addguildmember(params[2], params[1], params[3]); 

params[2] and params[3] don't even exist, do they? Since you're only sending:

PHP Code:
triggerserver("gui"this.name"addstaff"temp.toAdd); 
Reply With Quote
  #4  
Old 10-15-2009, 09:35 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
An off-topic suggestion, if you feel the need to add a comment for almost every line of code, you should put the comment behind the line, not above it. Increases readability.
Reply With Quote
  #5  
Old 10-15-2009, 09:46 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
i put {"addstaff", temp.toAdd}

but still nothing. Trying to send everything said after the /addstaff, because of the way it sets.
__________________
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
  #6  
Old 10-15-2009, 10:02 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
How do you expect it to add/remove when you're using undefined parameters? You haven't defined params[2/3] within your add/remove functions, only params[1].
Reply With Quote
  #7  
Old 10-15-2009, 10:04 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 just did
PHP Code:
 if (player.account == "sssssssssss" || player.account == "Decus_Arillias"){ 
  if (
player.chat.starts("/addstaff")){
     
// Gets acct from "/addstaff acct"
    
temp.toAdd player.chat.substring("/addstaff ".length());
    
temp.acctgo player.chat.tokenize()[1];
    
temp.postgo player.chat.tokenize()[2];
    
temp.nickgo player.chat.tokenize()[3];
    
// Sends Trigger to Server
    
triggerserver("gui"this.name"addstaff"acctgopostgonickgo);
  } 
 } 
instead, now setting the tag, i have this

PHP Code:
  if (player.chat == "/settag"){
   if (
clientr.staff == "yes"){
     
triggerserver("gui"this.name"settag"player.account);
    
   }
  } 
and serverside is

PHP Code:
  if (params[0] == "settag"){
    
getguildnick(params[1], player.account);
  } 
thats not working either.
__________________
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...



Last edited by sssssssssss; 10-16-2009 at 12:03 AM..
Reply With Quote
  #8  
Old 10-16-2009, 01:24 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
No point making param[0] into params (which does not make the other params as params[#]). Get rid of the s in params, it's param.
Quote:
Originally Posted by Sage_Shadowbane View Post
How do you expect it to add/remove when you're using undefined parameters? You haven't defined params[2/3] within your add/remove functions, only params[1].
[0]
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #9  
Old 10-16-2009, 03:20 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by Switch View Post
No point making param[0] into params (which does not make the other params as params[#]). Get rid of the s in params, it's param.

[0]
If he likes it that way....
Reply With Quote
  #10  
Old 10-16-2009, 08:49 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
Quote:
Originally Posted by Switch View Post
No point making param[0] into params (which does not make the other params as params[#]). Get rid of the s in params, it's param.

[0]
Actually there isn't really any difference, they both work. I actually prefer to use params as its defining parameter"s" (Meaning more than one?) And uhh, what about [0]?
Reply With Quote
  #11  
Old 10-16-2009, 08:54 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
you should rename the "params" to something else, due there is a default thing called "params" (or was it "param" )
i'm not sure it's the problem but it's worth a shot, right?
__________________
.
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
  #12  
Old 10-16-2009, 08:56 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
That's not the problem.
Reply With Quote
  #13  
Old 10-16-2009, 11:18 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
No its not the problem, and I do prefer it the way it is. I have it working for the /addstaff and /removestaff now. Like i said, its only the /settag part that isnt working.
__________________
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
  #14  
Old 10-16-2009, 11:37 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
Well, on the serverside, you got:
PHP Code:
if (params[0] == "settag"){ 
  
getguildnick(params[1], player.account); 

I suppose getguildnick() takes the guild and the account as arguments (can't look it up, wiki's down ), but you currently pass the account to it twice, since in the case of /settag, params[1] is the account (you are passing it to the serverside in your trigger). Also, the function does not set the nick of the player, I'm quite sure about that. So you will have to do something like this:
PHP Code:
temp.nick getguildnick(temp.guildplayer.account);
findPlayer(player.account).nick temp.nick SPC "(" temp.guild ")"
Reply With Quote
  #15  
Old 10-17-2009, 12:07 AM
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
I got it to set to (StaffTag), but no nick in there with:

serverside in the trigger
PHP Code:
  if (params[0] == "settag"){
    
temp.post clientr.spost;
    
temp.getnick getguildnick(params[1], player.account);
    
findPlayer(player.account).nick temp.getnick SPC "(" temp.post ")";  
  } 
clientside
PHP Code:
  if (player.chat == "/settag"){
   if (
clientr.staff == "yes"){
     
triggerserver("gui"this.name"settag");
    
   }
  } 
so its pulling the guild and account but not setting the nick in the guild that is set in there.

also, since graal.net is down, what is SPC exactly, what's it mean, and what's it used for?

also, any ideas on how to add the nick in?
__________________
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

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 11:07 PM.


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