Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   player[index].darts player[index].bombs (https://forums.graalonline.com/forums/showthread.php?t=47447)

SilentSkripter1988 08-24-2003 09:48 AM

player[index].darts player[index].bombs
 
what is index? It used to be like playerdarts and playerbombs that held arrow and bomb count. Whats the new way?

Knuckles 08-24-2003 10:00 AM

it's another way of naming the players?
each player has an index in a level...

it's like the index of showimg. it's just another way of singleling out one thing from another...

NPC Code:

// -- This will grab each player IN the
// -- current level of the NPC and warp them to 30,30;
for(i=0; i<playerscount; i++) {
player[i].x = 30;
player[i].y = 30;
}



^It grabs the player by index, and not account name or anything like that.

I don't know how to explain it :-p.

Snakeandy7 08-24-2003 11:27 AM

because he used
for (i=0; i<playerscount; i++){..}
since it begin's with i i'm thinking the index must be i?

Thought 08-24-2003 12:06 PM

Think of it this way, players is a list, let's say it currently looks like this:

NPC Code:
GuyA
GalB
GuyC
GalD



GuyA is position 0, GalB is position 1, and so on.

eg:

NPC Code:
0: GuyA
1: GalB
2: GuyC
3: GalD



An index essentially the position in the list. (Usually -1 since most lists start from a 0 based index, as does Graal)

Snakeandy7 08-24-2003 12:26 PM

Quote:

Originally posted by Thought
Think of it this way, players is a list, let's say it currently looks like this:

NPC Code:
GuyA
GalB
GuyC
GalD



GuyA is position 0, GalB is position 1, and so on.

eg:

NPC Code:
0: GuyA
1: GalB
2: GuyC
3: GalD



An index essentially the position in the list. (Usually -1 since most lists start from a 0 based index, as does Graal)

Thats quite hard to understand, but i under stood it

Benm00t 08-24-2003 03:18 PM

how would you get the indea of just one person though? If you have their account name that is.

Snakeandy7 08-24-2003 03:35 PM

Quote:

Originally posted by Benm00t
how would you get the indea of just one person though? If you have their account name that is.
You mean

with(getplayer(account)){
}

?!

Benm00t 08-24-2003 03:39 PM

err... i guess so lol.

-Ramirez- 08-24-2003 07:37 PM

Quote:

Originally posted by Benm00t
how would you get the indea of just one person though? If you have their account name that is.
A for loop scanning #a(index) would do what you ask.


All times are GMT +2. The time now is 03:05 PM.

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