![]() |
GScript2 Questions
1. I can't do this for some reason
PHP Code:
i can do this, however PHP Code:
2. hasweapon, it does not work for me (using old gscript serverside) and i can't figure out what the correct substitution is for this 3. addstring, I can't get this to work with gscript2 PHP Code:
4. could someone explain getstring()? edit: nevermind this one |
Quote:
NPC Code: or something might work Quote:
NPC Code: |
Quote:
|
You could probably just do this:
NPC Code:i = 0; |
Quote:
|
Quote:
|
findweapon(str) - returns object
I'd presume you'd do something like: NPC Code: I haven't had a play with it, but I'd say from the name of the command it would probably be the substitute, or close to, for hasweapon(str); |
Quote:
also, i am trying to do something like this: something = "text" @ var; but if var is 1, i dont want it to set to text1, i want it to give me the value of text1 if someone could help me out with that i'd appreciate it x.x |
I don't have gscript2 on the server I work on, but I would try:
PHP Code:
|
If you can't find a substitute for hasweapon(), you could always script your own.
This should work: PHP Code:
|
Quote:
|
Quote:
|
Am I correct in saying that instead of using something like:
NPC Code:player.chat = "Account #s(this.string1) was kicked"; I would use: NPC Code:player.chat = "Account" @ this.string1 @ "was kicked"; I'm confused about that, because I want a deffinate way of identifying what the stringname is from the rest of the words. I hope this makes sense. |
Quote:
message codes are outdated and shouldnt be used anymore although you forgot the space NPC Code:player.chat = "Account " @ this.string1 @ " was kicked"; |
Hmm, So I would do:
NPC Code:player.chat = "Account " @ this.string1 @ " was kicked"; instead of: NPC Code:player.chat = "Account "@this.string1@" was kicked"; because it appears to have to many spaces in the first one, why is that? >.< |
Hey could someone tell em the gs2 version of strcontains?
|
contains(str as string,partstr as string) which returns a true/false
|
alright, and (I ahve one other question (for now).
whenever I ahve something like: NPC Code: it gets an error in the rc saying "error: unexpected token: ; at line 5: this.image=tokens[2];" how do i fix that? |
Check the lines before it for missing ;'s, or brackets, etc.
|
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 :whatever: |
PHP Code:
|
Quote:
NPC Code: [edit] bastard pfa beat me to it >:P [/edit] |
ok, got it, sorry
EDIT: After changing that, i still get the same error |
Quote:
|
Well since I haven't a clue what's wrong, here's the whole serverside script:
NPC Code: 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. |
NPC Code:tokens=params[0].tokenize;; i think this is the problem (oh no I broke tree structure) |
Quote:
|
The semicolons...well must have been a typo, not that it really matter sthough
|
tokens = params[0].tokenize();
Like Okiesmokie said. |
Quote:
Two semi-colons is a syntax error ;) |
Well i changed it and it didnt fix it
|
Ah thats a pretty heavy mix of old and new scripting which doesn't really work they way you did. Old functions and commands still expect the old syntax, and vice versa, e.g. it must be strcontains(#p(1),staff) or contains(#p(1),"staff") or contains(params[1],"staff")
|
Here I converted the whole thing to GS2 (serverside of course), it gives me the error still, heree's what it looks like (since I cant edit my old 1 for some reason):
NPC Code: |
Quote:
NPC Code: NPC Code: also this is wrong: NPC Code:removeweapon(this.weapon); i think you need to use with() (don't think you can use objects with this command) NPC Code:insertstring(client.messages,0,"you dropped a" @this.weapon); this is bad too, you should use obj.insert(), and make sure this is in a with() as well, or use the player object |
The fact that it's usiong the for each replaces with. For the actionserverside I was told that that's what you used, is it function onActionServerSide() if not? As for the others I'll fix them.
|
Quote:
and at the end of the script... PHP Code:
|
Quote:
|
Alright fixed, now to attempt to debug my 5 other rc scripts, and try to get a clue as to what's wrong with the 500 levels npcs.....:whatever:
|
Quote:
|
| All times are GMT +2. The time now is 07:01 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.