|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
items | data ------------------------------- autojoin1 | #chatzone autojoin2 | #blazingsaddles |
/hadd MyHashTable autojoin1 #mirc /hadd MyHashTable autojoin2 #blazingsaddles
my question is a, how would i make a pop up to add something into it
then delete something out of it,
then make it enter every room on it?
|
|
|
|
Joined: Dec 2002
Posts: 40
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 40 |
alias -l autor {
if ($1 == begin) return -
if ($hget(myhashtable,%i).item) return Auto Join %i $ifmatch:hdel myhashtable $ifmatch
if ($1 == end) return -
}
alias -l aj.add {
var %i = 1
while ($hget(myhashtable,%i).item) { inc %i }
var %i = $calc(%i + 1)
hadd myhashtable $+(AutoJoin,%i) $$?=What Channel Name?"
}
menu menubar {
Auto Join
.Add:aj.add
.Delete
...$submenu($autor($1))
}
That should work
|
|
|
|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
i think ill start off asking a simple question
lol sorry for the confusion im trying to learn these, i understand adding to a hash table and deleting an item from a hash table
if this will echo whats in the table //echo -s $hget(christest,autojoin1) brings up #lobby,#Praise-Him,#Never-Silent
what can i do to /join $hget(christest,autojoin1) to work cause it just brings up $hget(christest,autojoin1) with or with out the -s
and id like to get the info from autojoin1 which would be a room name
how would i get the results of that to say enter a variable like $serverautojoin #lobby,#Praise-Him,#Never-Silent from the hash table?
thanks for your help
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
This should work fine.
on *:CONNECT:{
echo $color(info2) -esti2 ** Attempting to join the following channels: $replace($hget(christest,autojoin1),$chr(44),$chr(32))
.raw JOIN $hget(christest,autojoin1)
}
I'm not too sure what you meant by $serverautojoin. If you mean you want $serverautojoin to return what's in $hget(christest,autojoin1), then do this:
alias serverautojoin {
return $hget(christest,autojoin1)
}
on *:CONNECT:{
.raw JOIN $$serverautojoin
}
If what you really want is to know whether or not to try that JOIN by returning $network (if you're on the right network) or $null (if you're not), then do this:
alias serverautojoin {
if (($network == DALnet) || ($network == EFnet) || ($network == undernet)) return $network
}
on *:CONNECT:{
if ($serverautojoin) .raw JOIN $hget(christest,autojoin1)
}
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
Thanks Hammer as always you do a good job
ill ask this of you,
$replace($hget(christest,autojoin1) could that be used to say
/set %autojoin $replace($hget(christest,autojoin1)
would that work?
im trying to figure out how to get the info from the hash table to do something with, i cant find what im looking for in mIRC help
thanks for your help
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
That $replace() example just replaced the commas in #lobby,#Praise-Him,#Never-Silent with spaces: #lobby #Praise-Him #Never-Silent to make it "prettier." You don't need to /set any variable with the value $hget(christest,autojoin1). Part of the point of using hash tables is that you don't have to use variables to store data, you can store those values inside the hash table. If you don't like looking at the $hget() syntax, you can write up a custom identifier to make it "neater" looking, like this:
alias christest return $hget(christest,$$1) and then just use $christest(autojoin1) to retrieve that value.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
its not that i dont lke $hget its that if i //echo with it it will give a label but i cant figure out how to get the vaule of the info into a %allias or anything else
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
$hget(table,item) doesn't return a label, it returns the value that matches item stored in table. You have a hash tabled called christest. In that hash table, you have an item called autojoin1. The value stored in that item is #lobby,#Praise-Him,#Never-Silent. You can think of hash tables as .ini files with a single [section], or as an ini .file with the hash table name as the [section] [christest] autojoin1=#lobby,#Praise-Him,#Never-Silent awaynick=Chris-AwayUsing this concept as a model, here are some ways to use $hget and the values they will return: - /hmake christest
/hadd christest autojoin1 #lobby,#Praise-Him,#Never-Silent /hadd christest awaynick Chris-Away - $hget(christest,0) will return 2 because there are two items in that hash table
- $hget(christest,1).item will return autojoin1
- $hget(christest,1) will return #lobby,#Praise-Him,#Never-Silent
- $hget(christest,autojoin1) will return #lobby,#Praise-Him,#Never-Silent
- $hget(christest,2).item will return awaynick
- $hget(christest,2) will return Chris-Away
- $hget(christest,awaynick) will return Chris-Away
//NICK $hget(christest,awaynick) //JOIN $hget(christest,autojoin1)
I hope this clears up the question.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
//echo -s $hget(christest,autojoin1) brings up #lobby,#Praise-Him,#Never-Silent
what can i do to /join $hget(christest,autojoin1) to work [color:red]//[/color]join $hget(christest,autojoin1) on *:connect:{
join $hget(christest,autojoin1)
}
|
|
|
|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
Actually 1 question
do i have to load and save the hashtables every time?
Last edited by PHMinistries; 28/12/02 08:32 PM.
|
|
|
|
Joined: Dec 2002
Posts: 271
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 271 |
If you want to keep them, yes you do, mIRC Destroys hash tables when it closed/exits... if you want to save a hash table:
on *:exit:{
if ($hget(christest)) { hsave -o christest christest }
}
That will save -o(Overide Existing file) Table name(christest), To File name(christest) If you want to load a file:
on *:start:{
hmake christest 10
hload christest christest
}
that will make the table(Christest) at a size of 10(plenty for what your doing) then it will load the table(christest) from the file christest
|
|
|
|
Joined: Dec 2002
Posts: 174
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 174 |
Thanks you just answered the other question that i needed to know many blessings upon you
|
|
|
|
Joined: Dec 2002
Posts: 271
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 271 |
no problem
|
|
|
|
|