Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   #n > Gs2 (https://forums.graalonline.com/forums/showthread.php?t=63986)

xXziroXx 02-08-2006 09:46 AM

#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?

napo_p2p 02-08-2006 09:53 AM

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'.

xXziroXx 02-08-2006 09:58 AM

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.

Skyld 02-08-2006 10:02 AM

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.

Inverness 02-08-2006 11:18 PM

'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.

jake13jake 02-11-2006 08:43 PM

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.

Skyld 02-11-2006 08:56 PM

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?

jake13jake 02-12-2006 12:55 AM

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.

Rick 02-12-2006 02:45 AM

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


All times are GMT +2. The time now is 01:14 AM.

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