Hello,

I'm sorry someone else will have to help you on your way. Not that I'm incapable of doing so, but because I simply don't understand where the Hash Tables come in.

Quote:
I'm writing to text files because it's easier for me to do a while loop and read all the data out of the text files.


What do you need hash tables for if you are writing everythign to txt file and retrieving it back from txt file. Also, in that snippet that you showed, the hash table players is emptied because of the hdel -w players * each time that you will run that script. In other words, right before adding 1 item with corresponding data, the hash table will be emptied again. Eh maybe I'm not thinking clearly right now, but I don't see what the purpose is...

I don't see what is stopping you from doing:

if ($1 isnum 1-127) { hadd players $2 $gettok($4,1,9) $1 $gettok($gettok($4,3,9),1,59) }

which adds the data to your hash table.

To retrieve all the data from the hash table using a loop, you could simply do:
Code:
 
var %a = $hget(players,0).item
 [color:red]  [/color] 
while (%a) { echo -a $hget(players,%a).item $hget(players,%a).data | dec %a }

You see where I'm going with this. Btw echo is just an example, if you want to msg this data to a channel you would of course use msg # ... however this will surely get you flooded off the server if the amount of items is large. Best way for that would be either to send it with intervals, or to send it through dcc chat.

But like I said, someone else will probably be of more help.

Greetz


Edit
If you want to remove excessive spaces you can simply use the /tokenize command on your string. E.g. if you do /tokenize 32 this____ is__ a_____ test , then the tokenized string $1- will be: this_is_a_test Note that _ represents a space in this example.


Last edited by FiberOPtics; 16/05/04 05:57 PM.