mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
How do you get a name of a window with hash table data with multiple names....

like
hash table -- GUI

data
-@blah
-@boom
...etc...

just ask if you dont understand(I'm making a GUI)


This is not the signature you are looking for
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
the name of any window? or a specific one? If you know the name of it, then.. well, you already have it. If you want the "first" window in your hash table, though-- you can't do that.

Your question is quite vague so I'll go over all the ways to get values from hash tables.

Hash tables don't maintain order, they're a data structure similar to your english dictionary. You have a "key" (the english word) and the corresponding "value" (the definition of the word).. you do lookups by the key name, not by the index number. For instance, because you don't (easily) know how many words are between "aardvark" and "arrow", you can't just say "give me the next word", because there is no simple correlation between one key and the next. They're not maintained that way in memory, so its your job to figure out the next key.

If you want to maintain order in a hash table, make the key a number value ranging from 1-n and then have the value contain the rest of the data.

You can also use $hget(htable,N) where N is a value from 1-size. In this case, mIRC will grab the "Nth" key-- but before you go AHA!, know that the order is not guaranteed. It might pull "arrow" at index 1 and "aardvark" at index 2, for instance. Even though you may have entered them in the other way around.

Finally, you can use $hfind to search for a key name if you know part of the name, like "@b*".. again these results are not ordered, but this might be what you're looking for.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
if you have ever used the Blizzard GUI from picwin.tk, thats what im talking about, I want it because for mouse events you need a specified window... altough there might be a way... thx for that anyway

what i will try, and i hope it works, is i will create an if statement inside my general code for a highlight and i will create mouse events for a check on the active window(if the hash table name matches the window name)


This is not the signature you are looking for
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Does this work?
Code:
menu $active {
  sclick:if ($active == $hfind(GUI,$active) { window -c $active }
}

and if not, how do i get it to


This is not the signature you are looking for
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try it yourself you lazy git, then come back and ask for help if it doesn't work.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As mentioned, try things first... then ask if it doesn't work. It saves everyone some time. smile

That said, you're missing a ), so it will not work. And I'm not entirely sure that you're going to get a good comparison in that IF... it will depend on how your hash table is configured. Just try it and see if it works (after adding your missing ) ).


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i did try it


This is not the signature you are looking for
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400
  hmake @GUI
  hadd @GUI name @GUI
}
menu $active {
  sclick: { if ($active == $hfind(GUI,$active) == name) { window -c $active } }
}

heres what i have, i think the hash tables are wrong, can someone fix it please? i just learned them lol

Last edited by foshizzle; 16/01/08 03:05 AM.

This is not the signature you are looking for
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
you hmade @GUI, not GUI.

Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400
  $iif($hget(@GUI), hfree @GUI, )
  hmake @GUI
}
menu $active {
  sclick: { if ($hget($active) == $active) { window -c $active } }
}

still doesnt work...


This is not the signature you are looking for
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
you can't do "menu $active"

$active is meaningless at that level of code

Why would you have the $iif over a regular if statement by the way?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
idk
do u know how i would get this to work though?


This is not the signature you are looking for
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
As I said, menu $active is meaningless.. Follow the proper syntax, type /help menu prefix


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i knwo it but how


This is not the signature you are looking for
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Use the /window command's ability to use a defined Popup menu:

Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400 @MyPopup
  if ($hget(@GUI)) { hfree @GUI }
  hmake @GUI
  hadd @GUI name @GUI
}
menu @MyPopup {
  sclick: {
    if ($active == $hget(@GUI,name)) {
      window -c $active
    }
  }
}

Something like that perhaps.. although the point of the hash table at this point is.. well, there isn't a point.

Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i know, with that, but i want this to be a GUI, so i need multiple windows.. thus requiring some way to tell if a window is a GUI window....


This is not the signature you are looking for
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
but you see, you know its a GUI window because you made the menu specifically for that window name

"menu @MyPopup {"

AFAIK, you cannot make a menu for an arbitrary custom window, so you will always know the menu you made is for a specific window. This goes back to how i said "menu $active" is meaningless, and that you should consult /help menu prefix


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
I know that, but do u know any way around it?


This is not the signature you are looking for
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try something like this...

Code:
menu * {
  $iif(@* iswm $window($active),GUI):Do something here
}


If you need the menu to only work for custom windows starting with "@GUI", then put "@GUI*" instead of "@*".

Granted, that doesn't give sclick ability, but you may be able to work around needing that depending what you're doing.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Small sidenote, $window($active) is the same as $active (as the latter always returns the name of an existing window (or $null, although that wouldn't happen in popups)).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Page 1 of 3 1 2 3

Link Copied to Clipboard