Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-29-2011, 04:25 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
It's not really a big deal but you can do the "search" processing on the client-side.

Then in the case of multiple results, you can just display a dialog and have the player select who they wanted to summon.

I would suggest using.. string.starts("text") or string.pos("text") for checking for partials. I.e:

PHP Code:
function onCreated() {
  
temp.str "loltextlmao";
  echo(
temp.str.pos("text")); // echos 3 (found == position >= 0)
  
echo(temp.str.pos("rofl")); // echos -1 (not found)
  
echo(temp.str.starts("lol")); // echos 1 (found)
  
echo(temp.str.starts("lmao")); // echos 0 (not found)

Also in your check... you should have community name support as well. Another thing when searching you should probably check them all in lowercase or uppercase. I.e:

PHP Code:
function onCreated() {
  
temp.exact "Phil";
  
temp.cond temp.exact.lower();
  
temp.matches = {};
  for (
aallplayers) {
    
// Skip RCs
    
if (a.level == NULL) continue;
    
// Check for Exact Match
    
if (a.account == temp.exact || a.communityname == temp.exact) {
      
temp.found a.account;
      break;
    }
    
// Check for Partials
    
if (a.account.lower().pos(temp.cond) >= || a.communityname.lower().pos(temp.cond) >= || a.nick.lower().pos(temp.cond) >= 0) {
      
temp.matches.add(a.account);
    } 
  }
  if (
temp.found != "") {
    echo(
"Found... " temp.found);
  } else {
    echo(
"Other matches... " temp.matches);
  }

__________________
Quote:
Reply With Quote
 


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 07:43 PM.


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