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 08-26-2002, 09:17 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Script Help.

Well, i'm trying to get this so that when a player gets online he adds his account name to a string and then an NPC checks that string and if the players online don't match the names in the string, a little message saying, "Player <accout namr> has left game."

Currently I Have:
NPC Code:

tokenize2 ,,,#s(this.logged);
for (i=0;i<tokenscount;i++) {
this.found=false;
with (getplayer(#t(i))) this.found=true;
if (this.found==false) {
deletestring this.logged,#t(i);
setstring this.temp,#t(i);
for (p=0;p<allplayerscount;p++){
with (allplayers[p]) {
insertstring client.messages,0,Player #s(this.temp) left the game.;
}
}
}
}
}
if (this.count!=allplayerscount){
for(i=0;i<allplayerscount;i++){
with(allplayers[i]){
this.gotten=false;
for (j=0;j<tokenscount;j++{
if (strequals(#a,#t(j))) this.gotten=true;
}
if (strlen(#F)>0){
if (this.gotten==false) {
addstring this.logged,#a;
}
} else {setplayerprop #3,headrc.png;}
}
}
}
this.count=allplayerscount;
timeout=.1;


Any help or input would be appreciated.

BTW, this is all serverside database NPCs.
Reply With Quote
  #2  
Old 08-26-2002, 11:37 PM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
LOL, the way I was considering doing something like this was:
[code]
if (actionplayeronline)
{ setstring this.online,#s(this.online),#a;
timeout=1;
}
if (timeout)
{ tokenize2 ,,#s(this.online);
for (i=0;i<tokenscount;i++)
{ with (getplayer(#t(i)))
{ if (!playerisonline)
{ actions to show that they are not online;
for (o=0;o<tokenscount;o++)
{ deletestring this.online,#s(this.online)-#t(i);}
}
}
}
}
---Shifter
gtg bell rang!
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #3  
Old 08-27-2002, 06:54 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
if (actionplayeronline) { << - Put this in the Control NPC, then add it to the string and check the name, etc etc
__________________
[signature]insert here[/signature]
Reply With Quote
  #4  
Old 08-27-2002, 08:03 AM
Bhala Bhala is offline
Disgruntled Monkey
Bhala's Avatar
Join Date: Mar 2001
Posts: 779
Bhala is on a distinguished road
There is an easyer way of check if a string is in a string array. Do this:

if(lindexof(str,strarray)>-1)

thats to check if it is in a string array

if(lindexof(str,strarray)=-1)

checks if it isnt in a string array
__________________
Reply With Quote
  #5  
Old 08-27-2002, 08:44 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
I loved it when Stefan released string arrays.
Before that I had to:

NPC Code:

tokenize #s(bla);
for (this.i=0;this.i<tokenscount;this.i++) {
if (this.found==0 && strequals(#a,#t(this.i))) {
this.found = 1;
// Other stuff here
}
}



All that code compacted into one little bit of code.
__________________
[signature]insert here[/signature]
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 05:02 PM.


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