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
  #1  
Old 02-08-2006, 09:46 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
#n > Gs2

In GS1:

NPC Code:
#N - Nickname of NPC.
#n - Nickname of player.
#w - Nickname of selected Weapon.
#W - Image of selected Weapon.




In GS2:


NPC Code:
#n > nick
#w - player.weapon.name
#W - player.weapon.image




My question is, what is the GS2 version of #N?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #2  
Old 02-08-2006, 09:53 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I don't think #N is the NPC name. It's been a while so I could be wrong.

Anyways for GS2, 'nick' is the nickname of an NPC/Player.

'player.nick' is the current player's nick

If you had an NPC, its nick would be 'this.nick'.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 02-08-2006, 09:58 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Haha, I find it hillarious that I never tried that one.. And #N IS the NPC name.

For example, the NPC "Sendtorc NPC" uses this command:

NPC Code:
sendtorc This is triggered by #N!;



This would show upon RC:

NPC Code:
(NPC Server): This is triggered by Sendtorc NPC!




By using #w, that would only work if its selected with the classic inventory.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 02-08-2006, 10:02 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
Quote:
Originally Posted by napo_p2p
I don't think #N is the NPC name. It's been a while so I could be wrong.

Anyways for GS2, 'nick' is the nickname of an NPC/Player.

'player.nick' is the current player's nick

If you had an NPC, its nick would be 'this.nick'.
The ID (#N) is this.name.
__________________
Skyld
Reply With Quote
  #5  
Old 02-08-2006, 11:18 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
'nick' is a built-in variable so in an npc you can access it with just 'nick' and not 'this.nick' or even 'npc.nick'. I don't use 'this.' with built-in variables, its less confusing for me I suppose. Whatever you're scripting in has a current object in it.

And also, 'id' and 'name' are seperate. 'name' being the object its on and 'id' being the NPC's Id. All weapons have an ID of -1.
__________________
Reply With Quote
  #6  
Old 02-11-2006, 08:43 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Inverness
'nick' is a built-in variable so in an npc you can access it with just 'nick' and not 'this.nick' or even 'npc.nick'. I don't use 'this.' with built-in variables, its less confusing for me I suppose. Whatever you're scripting in has a current object in it.

And also, 'id' and 'name' are seperate. 'name' being the object its on and 'id' being the NPC's Id. All weapons have an ID of -1.
OR if you decide to use nick as a parameter in a function of the NPC, you can use this.nick = nick or something. Haven't really tried, but otherwise the this.var wouldn't really make sense in having rather than deciphering from unprefixed variables.
Reply With Quote
  #7  
Old 02-11-2006, 08:56 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
Quote:
Originally Posted by Inverness
'nick' is a built-in variable so in an npc you can access it with just 'nick' and not 'this.nick' or even 'npc.nick'. I don't use 'this.' with built-in variables, its less confusing for me I suppose. Whatever you're scripting in has a current object in it.
Doesn't it make more sense, for readability and understandability reasons, to show the object you're using?
__________________
Skyld
Reply With Quote
  #8  
Old 02-12-2006, 12:55 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Skyld
Doesn't it make more sense, for readability and understandability reasons, to show the object you're using?
Well, when the object is implied, it makes more sense not to rather than using a pointer.
Reply With Quote
  #9  
Old 02-12-2006, 02:45 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
jake13jake, take this as an example:

PHP Code:
function onCreated()
{
  
this.nick "a";
  echo(
nick);
  
temp.nick "b";
  echo(
nick);

Guess what is output?

Quote:
a
b
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:08 AM.


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