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 04-16-2004, 06:56 PM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
Something really helpful with string lists i discovered last night

I thought I would post this so people of my scripting skill level might use this. I was working on my housing system, and I didn't want to store a variable in the housing database showing how many users are on the list, so it knows how many times to loop.
So heres what I did:

I took my string list and stored it in this.houseowners using setstring thiso.houseowners within the getnpc. I then tokenized the string list, and I could loop through it with tokenscount.

I hope others can find this as useful as I did. As its helpful with bans from certain levels, housing systems, lottery systems.

Proof that you do learn more efficient ways to do things as you script. Otherwise id still be setting a variable to store how many items are in the string list.
Reply With Quote
  #2  
Old 04-16-2004, 07:24 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
If the list is a list of account names, tokenize isn't what you want to use, as it's going to split based on commas AND spaces. There are account names with spaces in them... and doing it with that method will prevent them from working.
__________________
Kat
Reply With Quote
  #3  
Old 04-16-2004, 07:48 PM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
what would be a good way to handle spaces?
Reply With Quote
  #4  
Old 04-16-2004, 07:51 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Use the string list as you were, with commas separating each account. Then use sarraylen(string) and #I(string,index) instead of tokenscount and #t(index).
__________________
Kat
Reply With Quote
  #5  
Old 04-17-2004, 08:48 AM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
Thanks!
Reply With Quote
  #6  
Old 05-27-2004, 05:35 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
If you tokenized and put account omg wow w/ out quotes in the database it wouldnt work but if you set omg wow with quotes around it I believe it would. Like for example a staff tool.

If you said:
/nick self "*KuJi <3"
It would set your name as *KuJi <3

If you said:
/nick self *KuJi <3
It would set your name as *KuJi
Reply With Quote
  #7  
Old 05-27-2004, 08:19 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
But he already figured that out..?
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 01:03 PM.


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