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
  #16  
Old 02-13-2005, 11:32 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Hey could someone tell em the gs2 version of strcontains?
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #17  
Old 02-13-2005, 11:40 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
contains(str as string,partstr as string) which returns a true/false
__________________
Skyld
Reply With Quote
  #18  
Old 02-13-2005, 11:53 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
alright, and (I ahve one other question (for now).

whenever I ahve something like:
NPC Code:

this.image=tokens[2];


it gets an error in the rc saying "error: unexpected token: ; at line 5: this.image=tokens[2];"

how do i fix that?
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #19  
Old 02-14-2005, 12:46 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Check the lines before it for missing ;'s, or brackets, etc.
__________________
Skyld
Reply With Quote
  #20  
Old 02-14-2005, 02:08 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
alright after some tweaking I ended up with the error:
"unexpected token: at line 12: for (pl: allplayerscount) {"

and it doesnt say what shouldnt be there
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #21  
Old 02-14-2005, 02:27 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
PHP Code:
for (plallplayers){
  
// stuff

Reply With Quote
  #22  
Old 02-14-2005, 02:28 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by falco10291029
alright after some tweaking I ended up with the error:
"unexpected token: at line 12: for (pl: allplayerscount) {"

and it doesnt say what shouldnt be there
allplayerscount is a variable, not an array, the statement you are looking for is:
NPC Code:
for(pl: allplayers) {



[edit] bastard pfa beat me to it >:P [/edit]
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #23  
Old 02-14-2005, 02:30 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
ok, got it, sorry

EDIT: After changing that, i still get the same error
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #24  
Old 02-14-2005, 03:58 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by falco10291029
ok, got it, sorry

EDIT: After changing that, i still get the same error
Show the whole chunk of code that's before and after that?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #25  
Old 02-14-2005, 10:16 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Well since I haven't a clue what's wrong, here's the whole serverside script:

NPC Code:

if (actionserverside) {
tokens=params[0].tokenize;;
if (!params[1].starts("*")&&!strcontains(#p(1),"staff")&&!params[1].starts("subclass/")) {
putnpc2 tokens[0],tokens[1],{
this.image=tokens[2];
this.player=tokens[3];
this.class=tokens[4];
this.weapon=tokens[5];
setimg("block.png");
chat=this.weapon;
if (this.image.length()>=2) setimg(this.image);
for (pl: allplayers){
if (pl.account==this.player) {
removeweapon #s(this.weapon);
insertstring client.messages,0,you dropped a #s(this.weapon);
}
}
}
function onPlayerTouchsMe() {
addweapon(this.weapon);
destroy;
}
};



You'll notice that for once I styled my script

NOte: It isn't completely GS2 yet, I figure it best to finish that after the errors are gone, and they shouldn't affect the rest of the code.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #26  
Old 02-14-2005, 10:25 PM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
NPC Code:
tokens=params[0].tokenize;;


i think this is the problem

(oh no I broke tree structure)
__________________

Reply With Quote
  #27  
Old 02-14-2005, 10:32 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by falco10291029
NPC Code:
tokens=params[0].tokenize;;

tokenize is a function, so it needs parenthesis after it, and also, why is there two semi-colons?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #28  
Old 02-14-2005, 11:07 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
The semicolons...well must have been a typo, not that it really matter sthough
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #29  
Old 02-15-2005, 12:21 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
tokens = params[0].tokenize();

Like Okiesmokie said.
__________________
Skyld
Reply With Quote
  #30  
Old 02-15-2005, 12:31 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by falco10291029
The semicolons...well must have been a typo, not that it really matter sthough
Umm, you were getting a syntax error, no?
Two semi-colons is a syntax error
__________________


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


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