Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   list of index>strcontains (https://forums.graalonline.com/forums/showthread.php?t=55955)

xAndrewx 11-07-2004 06:52 PM

list of index>strcontains
 
This true?

Slash-P2P 11-07-2004 07:19 PM

Quote:

Originally Posted by xAndrewx
This true?

I find strcontains easy so I use that a lot.
I believe you can get an exact answer with strcontains if you use quotations around the data your searching in.

Nice sig.

Dach 11-08-2004 09:31 PM

Quote:

Originally Posted by Slash-P2P
I find strcontains easy so I use that a lot.
I believe you can get an exact answer with strcontains if you use quotations around the data your searching in.

Nice sig.

If you mean getting the index value, no. Otherwise, please do clarify your post ;)


PHP Code:

//--detecting element in list
  
if (strcontains(#s(foo),bar)) 

  
if (lindexof(bar,foo))

//--finding element in list
  
this.index lindexof(bar,foo);

  for (
i=0;i<sarraylen(bar);i++) {  //<- this is freaking ugly and I will hit you if you use it
    
if (strcontains(#I(bar,i),foo)) {
      
this.index i;
    }
  } 

It depends on what you are doing. As far as which function has the more efficient underlying code, I don't know. (only applicable in determining if an element is in a list though)

Slash-P2P 11-08-2004 09:36 PM

Quote:

Originally Posted by Dach
If you mean getting the index value, no. Otherwise, please do clarify your post ;)


PHP Code:

//--detecting element in list
  
if (strcontains(#s(foo),bar)) 

  
if (lindexof(bar,foo))

//--finding element in list
  
this.index lindexof(bar,foo);

  for (
i=0;i<sarraylen(bar);i++) {  //<- this is freaking ugly and I will hit you if you use it
    
if (strcontains(#I(bar,i),foo)) {
      
this.index i;
    }
  } 

It depends on what you are doing. As far as which function has the more efficient underlying code, I don't know. (only applicable in determining if an element is in a list though)

PHP Code:

//#CLIENTSIDE
if (created || playerenters) {
  
setstring this.accounts,some guy,foo;
  if (
strcontains(#s(this.accounts),#a)) {
    
message Your in the list;
  } else {
    
message Your not in the list;
  }


If your account is some or guy it will allow it but if you set the accounts string to "some guy","foo"; it only allows some guy and foo.

Dach 11-09-2004 09:22 PM

Quote:

Originally Posted by Slash-P2P
If your account is some or guy it will allow it but if you set the accounts string to "some guy","foo"; it only allows some guy and foo.

Oh yeah, I see what you're talking about. That's definitely not the same as returning an index though, making that information pretty arbitrary.


All times are GMT +2. The time now is 01:06 PM.

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