![]() |
[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!"; } } |
You don't need to use a trigger for this. You can set the chat and check the guild all on the serverside.
|
Vulcan was right, but triggers are recieved by 'function onAction<name>, so your function would be onactionwarp. That should fix it
|
Ahh Thanks! I'm kind of new with GS2 so yeah :P
|
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. |
I wish GS2 required proper indentation to work, similar to Python or Lua
Makes life a whole lot easier when developing proper scripting habits |
Quote:
Quote:
|
Quote:
|
Quote:
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. |
Wait, dosn't setlevel2 not work on Gs2?
|
Quote:
|
View>Source reveals that the script is formatted (albeit badly), but good ol' HTML ignores whitespace.
PHP Code:
|
All times are GMT +2. The time now is 07:22 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.