Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-30-2005, 10:17 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
GS2: Serverside player.weapon[s]

For some reason in GScript2 serverside, you cannot access player.weapon or player.weapons, they are undefined. Yet they are defined clientside. Is there any reason for this?
Reply With Quote
  #2  
Old 03-30-2005, 01:17 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes need to map them, also need to fix hasweapon()
Reply With Quote
  #3  
Old 03-30-2005, 02:28 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
I also see a problem with tokenize(). You can't tokenize by newlines. (str.tokenize("\n")).
Reply With Quote
  #4  
Old 03-31-2005, 04:47 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
\n basically tells the NPC that a newline is there, but I believe it simply replaces it with the appropiate character (To what I beleive). It is searching for the string "\n" and not the actual new line.

While we're at it -- I'm not too sure how to do #K(x) anymore.
with command doesn't seem to work, nor is npcscount/npcs[i]. I can't seem to call a command by npcs[i].function(); (The function was public, although isn't a weapon).

Hrm.. Other problems? I'll post back if I see any.
Reply With Quote
  #5  
Old 03-31-2005, 05:21 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
Quote:
Originally Posted by Velox Cruentus
While we're at it -- I'm not too sure how to do #K(x) anymore.
char(x)
or ascii(x) to do the opposite

Quote:
with command doesn't seem to work,
NPC Code:
with (object) {


it works for me...
Quote:
nor is npcscount
npcs.size()


i don't know about anything else though


edit: i think it's getascii, not ascii? i forget which one is for gs2
__________________


Last edited by Evil_Trunks; 03-31-2005 at 07:12 AM..
Reply With Quote
  #6  
Old 03-31-2005, 05:54 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
Quote:
Originally Posted by Evil_Trunks
char(x)
or ascii(x) to do the opposite


NPC Code:
with (object) {


it works for me...

npcs.size()


i don't know about anything else though
Thanks -- I was using an already used variable -- That's why it didn't work.

I ended up doing:
NPC Code:

for (n: npcs){
n.chat := "Testing";
}


Reply With Quote
  #7  
Old 03-31-2005, 04:26 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Velox Cruentus
\n basically tells the NPC that a newline is there, but I believe it simply replaces it with the appropiate character (To what I beleive). It is searching for the string "\n" and not the actual new line.

While we're at it -- I'm not too sure how to do #K(x) anymore.
with command doesn't seem to work, nor is npcscount/npcs[i]. I can't seem to call a command by npcs[i].function(); (The function was public, although isn't a weapon).

Hrm.. Other problems? I'll post back if I see any.
In theory. The string parser should be escaping \n to an actual newline before it ever gets to the function. In order to actually search for \n you'd want \\n.
Reply With Quote
  #8  
Old 06-13-2006, 12:07 AM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
entao, quoi?

So what would be the equivalent of hasweapon() in GS2? Has it been fixed yet?

PHP Code:
function onCreated() {
  if (
hasweapon(Weapon_name_here)) {
    
// algo comentario por aqui
  
}

Btw, from what I've been doing so far, I've only noticed that player.weapons is only readable on server-side.

Here's what I tried to do in GS2 to substitute for it:

PHP Code:
function onCreated() {
  
this.weaponname Weaponnamehere;
  
this.weaponlist player.weapons;
}
//#CLIENTSIDE
function onPlayertouchsme() {
  if (
this.weaponname in this.weaponlist) {
    
message("true");
    
removeweapon(this.weaponname);
  } else { 
message("false"); addweapon(this.weaponname); }

but this doesn't work for whatever reason... so how else can I translate hasweapon() into GS2?

Btw — addweapon and removeweapon don't work on either clientside or serverside with me for some reason. Am I using it wrong? I've noticed that weapons shouldn't have quotes around them unless they include a symbol or space, so I didn't put any quotes around the actual weaponame.




EDIT -- I got an answer from a friend early:

hasweapon() can be translated to if (findweapon(weaponnamehere) != null) { ... }

Last edited by _Z3phyr_; 06-13-2006 at 03:28 AM..
Reply With Quote
  #9  
Old 06-13-2006, 01:57 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
addweapon/removeweapon only work serverside.
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 01:00 PM.


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