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 06-10-2002, 10:32 AM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Thumbs up another array question

k, I made my hat NPC, no one helped me
But I have it so when you pick up the NPC it sets an array.It uses client.hats for the variable.
question:
why is it when I make a variable like client.hats[0]=1; it only stays true for that level, and goes false for any other level?
__________________
maximus_asinus
Reply With Quote
  #2  
Old 06-10-2002, 09:30 PM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Unhappy

bump
I need help someone
plz
__________________
maximus_asinus
Reply With Quote
  #3  
Old 06-10-2002, 09:34 PM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
LOL. I h8 arrays. Otherwise I would help. Arrays are one of the few things I'd prefer not to script unless I have to, they annoy me. Maybe soon I'll take the time to understand them more fully. Beg the great Kai and he may help, he he.
---Shifter
__________________
Who has time for life these days?
Reply With Quote
  #4  
Old 06-10-2002, 10:26 PM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Quote:
Originally posted by Projectshifter
LOL. I h8 arrays. Otherwise I would help. Arrays are one of the few things I'd prefer not to script unless I have to, they annoy me. Maybe soon I'll take the time to understand them more fully. Beg the great Kai and he may help, he he.
---Shifter
:O
I beg apon the almighty Kai, I need your supirior(sp?) knowledge about scripting arrays
__________________
maximus_asinus
Reply With Quote
  #5  
Old 06-10-2002, 11:20 PM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
If you're using VARIABLES, as opposed to strings, and it's offline, then you won't have much luck. Unless a NPC weapon sets a this. var, variables are attatched to the level, not the player. Anyway, I seem to recall Kaimetsu saying there is no such thing as a client. variable; it will work, but it's no different to calling a variable anything else. Diagram is below.



Note: to save hats, it's probably better to use strings. Variables have a nasty habit of clearing whenever you reconnect, or at least they do in my experience.

Last edited by GrowlZ1010; 06-10-2002 at 11:33 PM..
Reply With Quote
  #6  
Old 06-11-2002, 01:11 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Ah, the almighty Growlz has come to aid you, heh. GrowlZ and I worked back on Sans, he's smart, maybe rivaling Kai? He he.
---Shifter
__________________
Who has time for life these days?
Reply With Quote
  #7  
Old 06-11-2002, 01:59 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Quote:
Originally posted by Projectshifter
Ah, the almighty Growlz has come to aid you, heh. GrowlZ and I worked back on Sans, he's smart, maybe rivaling Kai? He he.
---Shifter
Rivaling Kaimetsu? Two words: "I" and "wish". But thank you for that, Shifter. I like to think my work is occasionally appreciated.
Reply With Quote
  #8  
Old 06-11-2002, 02:08 AM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Quote:
Originally posted by GrowlZ1010
If you're using VARIABLES, as opposed to strings, and it's offline, then you won't have much luck. Unless a NPC weapon sets a this. var, variables are attatched to the level, not the player. Anyway, I seem to recall Kaimetsu saying there is no such thing as a client. variable; it will work, but it's no different to calling a variable anything else. Diagram is below.



Note: to save hats, it's probably better to use strings. Variables have a nasty habit of clearing whenever you reconnect, or at least they do in my experience.
ok I get that, so is there a thing like stringarrays?
__________________
maximus_asinus
Reply With Quote
  #9  
Old 06-11-2002, 02:18 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Quote:
Originally posted by darkriders_p2p

ok I get that, so is there a thing like stringarrays?
String arrays. Murky waters. *shudder*

Umm.. I don't know of any such thing as string arrays. Maybe they exist, but I've never come across one. You can probably simulate something like 'em, but if you're using strings now, why don't you just have a piece of code that, when the player picks up a hat, checks whether or not the player already has that hat (doing strcontains on a string), and adds it to their list? If, as I presumed, you're using the array to track what hats the player has, rather than the mode of the weapon, configuration, etc., this would probably work better. It'd be my choice, anyway. (Unless, of course, you want the player to be able to carry more than one of a hat. Then we could potentially get into the confusing world of string indexes which I don't exactly want to go over unless I really, really, really have to.)
Reply With Quote
  #10  
Old 06-11-2002, 02:22 AM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Quote:
Originally posted by GrowlZ1010


String arrays. Murky waters. *shudder*

Umm.. I don't know of any such thing as string arrays. Maybe they exist, but I've never come across one. You can probably simulate something like 'em, but if you're using strings now, why don't you just have a piece of code that, when the player picks up a hat, checks whether or not the player already has that hat (doing strcontains on a string), and adds it to their list? If, as I presumed, you're using the array to track what hats the player has, rather than the mode of the weapon, configuration, etc., this would probably work better. It'd be my choice, anyway. (Unless, of course, you want the player to be able to carry more than one of a hat. Then we get into the confusing world of string indexes which I don't exactly want to go over unless I really, really, really have to.)
I don't want to get complicated.
NPC Code:
if (strequals(#v(this.hats[i]),1)) {


I use that to check if the player has the the hat, so how could I replace this to check for a string.
If you would like to see the script, my MSN email is [email protected]
__________________
maximus_asinus
Reply With Quote
  #11  
Old 06-11-2002, 02:28 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Quote:
Originally posted by darkriders_p2p

I don't want to get complicated.
NPC Code:
if (strequals(#v(this.hats[i]),1)) {


I use that to check if the player has the the hat, so how could I replace this to check for a string.
If you would like to see the script, my MSN email is [email protected]
Presuming the number of the hat is 1:

NPC Code:
if (strcontains(#s(client.hats),1)) {



... will check if the number 1 (the hat's number) is in the client.hats string, so basically, will have the effect of checking if the player has a certain hat (in this case, hat 1).
Reply With Quote
  #12  
Old 06-11-2002, 02:45 AM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Quote:
Originally posted by GrowlZ1010


Presuming the number of the hat is 1:

NPC Code:
if (strcontains(#s(client.hats),1)) {



... will check if the number 1 (the hat's number) is in the client.hats string, so basically, will have the effect of checking if the player has a certain hat (in this case, hat 1).
ya I fixed it, It was pretty easy :P
NPC Code:
if (strequals(#s(hats[#v(i)]),1)) {

__________________
maximus_asinus
Reply With Quote
  #13  
Old 06-11-2002, 02:51 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Quote:
Originally posted by darkriders_p2p

ya I fixed it, It was pretty easy :P
NPC Code:
if (strequals(#s(hats[#v(i)]),1)) {

Well, you're simulating an array well enough. :P But why one string for every hat? Are you measuring the number of hats in those, or whether or not the player has the hat? If it's the latter, use one string. More efficient, less space, same effect!
Reply With Quote
  #14  
Old 06-11-2002, 07:04 AM
darkriders_p2p darkriders_p2p is offline
Registered User
Join Date: Jan 2002
Location: Canada
Posts: 690
darkriders_p2p is on a distinguished road
Quote:
Originally posted by GrowlZ1010


Well, you're simulating an array well enough. :P But why one string for every hat? Are you measuring the number of hats in those, or whether or not the player has the hat? If it's the latter, use one string. More efficient, less space, same effect!
because I have no clue what ur talking about
__________________
maximus_asinus
Reply With Quote
  #15  
Old 06-11-2002, 09:53 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
-FooL-

Quote:
Umm.. I don't know of any such thing as string arrays. Maybe they exist, but I've never come across one.
addstring
insertstring
removestring
replacestring
deletestring
#I()
For()
[edit] sarraylen() [/edit]

Need I say more?
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
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 02:35 PM.


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