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 08-20-2009, 08:36 PM
Damien Damien is offline
Corpse
Join Date: Feb 2009
Location: 6 Feet under
Posts: 106
Damien is an unknown quantity at this point
Icon Script

I suck at scripting, this is what i got. can i have some help?


PHP Code:
//CLIENTSIDE
function onCreated()
{
 
this.stafflist = {
                      
"Manager"
                      "Staff"
                      "Etc"
                      
}
  if (
player.guild this.stafflist)
  {
   
showimg ("stafficon.png"player.x-0.04player.y-3.3)
  )

Reply With Quote
  #2  
Old 08-20-2009, 09:15 PM
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
Quote:
Originally Posted by Damien View Post
I suck at scripting, this is what i got. can i have some help?


PHP Code:
//CLIENTSIDE
function onCreated()
{
 
this.stafflist = {
                      
"Manager"
                      "Staff"
                      "Etc"
                      
}
  if (
player.guild this.stafflist)
  {
   
showimg ("stafficon.png"player.x-0.04player.y-3.3)
  )

You need to use //#CLIENTSIDE and not //CLIENTSIDE for starting the clientside portion.

You need a semicolon (; ) after using any commands or setting something. That means that this doesn't apply to a function, check, loop, etc.
Example
PHP Code:
player.chat "I just set the player's chat."
Arrays need a comma (,) in-between strings and variables.
Example
PHP Code:
temp.array = { "string 1","string 2",26,}; 
A check requires (or should ) == instead of =, which is for setting something.
Example
PHP Code:
this.check "pie";
if (
this.check == "pie") {
  
//code

Since you are checking if the player's guild is in an array and not a specific string, you need to use in instead of == for the check.
Example
PHP Code:
temp.array = { 1,};
if (
this.action in temp.array) {
  
//code

showImg() has 4 params:
integer (for ID), string (the image's file name), float (x coordinate), float (y coordinate)
Example
PHP Code:
showImg(200,"block.png",player.x,player.y); 
And I'm sure your last mistake was a typo, which is that you accidentally closed a check with ) instead of }.

Here is the correct code (I use my own styling, you don't necessarily have to follow it):
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.staffList = { "Manager","Staff","Etc" };
  if (
player.guild in temp.staffList)
    
showImg(200,"stafficon.png"player.x-0.04player.y-3.3);

I used a temp array instead of a this array since it is only called inside that one function (onCreated()).

Anyways, you should make a Gani script set as a player.attr[] for this.
__________________
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.

Last edited by Switch; 08-20-2009 at 10:06 PM.. Reason: Pelikano + Inverness
Reply With Quote
  #3  
Old 08-20-2009, 09:21 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
Here is the correct code (I use my own styling, you don't necessarily have to follow it):
PHP Code:
//CLIENTSIDE
function onCreated() {
  
temp.staffList = { "Manager","Staff","Etc" };
  if (
player.guild in temp.staffList)
    
showImg(200,"stafficon.png"player.x-0.04player.y-3.3);

I used a temp array instead of a this array since it is only called once.

Anyways, you should make a Gani script with an attr[] for this.
To clarify, since it's not used outside the function, not because it's called once...
Reply With Quote
  #4  
Old 08-20-2009, 09:25 PM
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
Quote:
Originally Posted by Pelikano View Post
To clarify, since it's not used outside the function, not because it's called once...
Too tired

Anyways I forgot to mention this in my original post, but you should try to fix these things on your own. RC should have displayed some error messages to lead you in the right path.
__________________
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
  #5  
Old 08-20-2009, 09:58 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
It's //#CLIENTSIDE not //CLIENTSIDE.
__________________
Reply With Quote
  #6  
Old 08-20-2009, 10:07 PM
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
Quote:
Originally Posted by Inverness View Post
It's //#CLIENTSIDE not //CLIENTSIDE.
Quote:
Originally Posted by Switch View Post
Too tired
need text
__________________
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
  #7  
Old 08-20-2009, 10:07 PM
Damien Damien is offline
Corpse
Join Date: Feb 2009
Location: 6 Feet under
Posts: 106
Damien is an unknown quantity at this point
Jeez, I am VERY bad at this. I left out semicolons for god sake..
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 09:16 AM.


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