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 11-07-2004, 06:52 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
list of index>strcontains

This true?
__________________
Reply With Quote
  #2  
Old 11-07-2004, 07:19 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
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.
Reply With Quote
  #3  
Old 11-08-2004, 09:31 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
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)
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #4  
Old 11-08-2004, 09:36 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
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.
Reply With Quote
  #5  
Old 11-09-2004, 09:22 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
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.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
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 11:44 PM.


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