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 09-30-2008, 03:33 PM
Vima Vima is offline
Registered User
Join Date: Dec 2005
Posts: 542
Vima is an unknown quantity at this point
[EZ] This script makes me insane.

Hi! I'm making a script for the Cherry Guildhouse.
I can't get the script working, what's wrong with it?
Thanks!

// NPC made by SwedishKing -Y-
function onCreated(){
setshape(1,32,32);
}
function onWarp(){
setlevel2("cherrytown_2c.nw",30,30);
}

//#CLIENTSIDE
function onPlayertouchsme()
{
if (player.guild == "Cherry")
{
triggerAction(this.x+.5,this.y+.5,"warp",null);
}
else
{
this.chat = "Only Cherry Members!";
}
}
__________________
*aka SwedishKing*
Reply With Quote
  #2  
Old 09-30-2008, 03:55 PM
Vulcan Vulcan is offline
Registered User
Vulcan's Avatar
Join Date: Jun 2006
Location: Columbia, SC
Posts: 641
Vulcan is on a distinguished road
You don't need to use a trigger for this. You can set the chat and check the guild all on the serverside.
__________________

Playerword Issues: Support Center
Email: [email protected]


Reply With Quote
  #3  
Old 09-30-2008, 04:16 PM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
Vulcan was right, but triggers are recieved by 'function onAction<name>, so your function would be onactionwarp. That should fix it
__________________


CAUTION
Reply With Quote
  #4  
Old 09-30-2008, 05:51 PM
Vima Vima is offline
Registered User
Join Date: Dec 2005
Posts: 542
Vima is an unknown quantity at this point
Ahh Thanks! I'm kind of new with GS2 so yeah :P
__________________
*aka SwedishKing*
Reply With Quote
  #5  
Old 09-30-2008, 11:10 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
I don't know if your styling was destroyed by posting it, but try to indent, and use [PHP] tags when posting code.

Besides that, you can just remove the //#CLIENTSIDE and add onWarp() to when the player touches the object.
__________________
Reply With Quote
  #6  
Old 11-09-2008, 11:09 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
I wish GS2 required proper indentation to work, similar to Python or Lua

Makes life a whole lot easier when developing proper scripting habits
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #7  
Old 11-09-2008, 11:32 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Raeiphon View Post
I wish GS2 required proper indentation to work, similar to Python or Lua
lua does not require indentation to work. It does not even require semicolons.

Quote:
Makes life a whole lot easier when developing proper scripting habits
Those languages are designed to be actually used for more than teaching.
Reply With Quote
  #8  
Old 11-10-2008, 04:35 AM
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
Quote:
Originally Posted by Raeiphon View Post
I wish GS2 required proper indentation to work, similar to Python or Lua

Makes life a whole lot easier when developing proper scripting habits
People have different tastes in what looks good in scripts, though probably 90[percent] of GS2 scripters agree on how they do it.
__________________
Reply With Quote
  #9  
Old 11-10-2008, 04:39 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Raeiphon View Post
I wish GS2 required proper indentation to work, similar to Python or Lua

Makes life a whole lot easier when developing proper scripting habits
The indentation is fine(I'm assuming), it just wasn't closed in php tags so it lost it.

Either way, I usually find the actual indentation of scripts fine, it's usually the placement of brackets and the use of whitespace that differs between scripters. Either way, there is no reason to discriminate those who prefer to indent different. What about those who prefer tabbing instead of the typical two-space of Graal?

This script seems to have two different forms of styling going on, though.
Reply With Quote
  #10  
Old 12-05-2008, 02:17 AM
WaDaFack WaDaFack is offline
*
WaDaFack's Avatar
Join Date: May 2007
Posts: 419
WaDaFack is an unknown quantity at this point
Wait, dosn't setlevel2 not work on Gs2?
__________________
WaDaFack

Reply With Quote
  #11  
Old 12-05-2008, 02:28 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 WaDaFack View Post
Wait, dosn't setlevel2 not work on Gs2?
It works.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #12  
Old 12-07-2008, 01:21 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
View>Source reveals that the script is formatted (albeit badly), but good ol' HTML ignores whitespace.

PHP Code:
// NPC made by SwedishKing -Y-<br />
function onCreated(){<br />
 
setshape(1,32,32);<br />
}<
br />
function 
onWarp(){<br />
 
setlevel2(&quot;cherrytown_2c.nw&quot;,30,30);<br />
}<
br />
<
br />
//#CLIENTSIDE<br />
function onPlayertouchsme()<br />
  {<
br />
  if (
player.guild == &quot;Cherry&quot;)<br />
    {<
br />
    
triggerAction(this.x+.5,this.y+.5,&quot;warp&quot;,null);<br />
  }<
br />
  else<
br />
    {<
br />
    
this.chat = &quot;Only Cherry Members!&quot;;<br />
  }<
br />

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 05:18 AM.


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