mIRC Home    About    Download    Register    News    Help

Active Threads | Unanswered Past 24 hours | Past 48 hours | Past Week | Past Month | Past Year
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? Raccoon 6 hours ago
Right. As I explained above, $hfind() is going to be horrendously slow, so you will have to design your table accordingly to predict how you will access the data and to make sure that it can be queried directly without performing iterative searches. This means lots of cross indexing, reverse indexing, sideways indexing... that is, performing multiple /hadd's to cover all of your bases of lookup direction.

If you want the list "adam bobby charlie" then you will need to create that list.

Code
var %user = charlie
var %users = $hget(%table,root.users)
var %users = $addtok(%users,%user,32)  [addtok prevents adding duplicate items to a list]
hadd %table root.users %users
var %item = baz
var %useritems = $hget(%table,root.users. $+ %user $+ .items)
var %useritems = $addtok(%useritems,%item,32)
hadd %table root.users. $+ %user $+ .items %useritems
hadd %table root.user. $+ %user $+ . $+ %item I'm a little teapot.

; [table]
; root.users == adam bobby charlie
; root.users.adam.foo == Did you miss me?
; root.users.bobby.bar == Not that it matters!
; root.users.charlie.baz == I'm a little teapot.
; root.users.adam.items == foo
; root.users.bobby.items == bar
; root.users.charlie.items == baz
7 94 Read More
Scripts & Popups Jump to new posts
Re: Problem with timestamps on ZNC playback buffer 8bitbubsy Yesterday at 07:39 PM
Originally Posted by JohnEricNO
Try using $ini(servers.ini,servers,0)

That worked, thanks!
4 35 Read More
Scripts & Popups Jump to new posts
Re: On Notice maroon Yesterday at 07:07 PM
You have the handling for the 4 nicks inside the condition which is true only when the nick ends with "serv", so that code can never be true
1 12 Read More
Scripts & Popups Jump to new posts
Re: Problem with timestamps on ZNC playback buffer JohnEricNO Yesterday at 06:06 PM
Try using $ini(servers.ini,servers,0)
4 35 Read More
Scripts & Popups Jump to new posts
Re: Problem with timestamps on ZNC playback buffer 8bitbubsy Yesterday at 05:45 PM
Thanks, that's just what I needed! Passing that to $asctime() did the trick. Now I'm wondering how to get the number of servers present in servers.ini so that I can iterate through them in a loop in another script...
4 35 Read More
Scripts & Popups Jump to new posts
Re: Problem with timestamps on ZNC playback buffer Loki12583 Yesterday at 05:07 PM
$msgstamp has the time from znc
4 35 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? beer Yesterday at 04:46 PM
Thanks for the insight guys, I really appreciate the knowledge/experience share! Hash tables are a new area for me and I'd prefer not to step into any design potholes if I don't have to. smile

Just thought of another question. Using the one table design, if I have a hash table (mytable), is it possible to search through the keys/items using a wildcard (such as root.user.*) but also set a max search depth and return only unique results? Using the following hash keys/items in testtable for example:

root.user.adam
root.user.bobby
root.user.bobby.abc
root.user.charlie
root.user.charlie.abc
root.user.charlie.def.jkl

Ideally I just want to return "adam, bobby, charlie". But not (w/ or w/o prefix) "adam, bobby, bobby.abc, charlie, charlie.abc, charlie.def.jkl. Basically if "." is the field seperator, just search keys/items that only have 3 fields. I tried "$hfind(testtable,$root.user.[^.]*$,1-,r)" but that didn't work.

Or would I want to just get the total # of keys/items and loop through them all, checking just the first two tokens for "root.user" and if true then writing the third token to a variable if it's !isin the variable already? Seems like looping through an entire table would be slow but I guess thats what trying to wildcard search the keys/items does anyways right?
7 94 Read More
Scripts & Popups Jump to new posts
On Notice DragonRyder Yesterday at 04:33 PM
here is my snippet:

Quote

on ^*:NOTICE:*:*: {
var %sn = $+($nick,@,$network)
if ($2 $4-5 == invited into the) { noticeprint 14(10Invited14) 12What Nick15:10 $3 12What Channel15:10 $chan  }
if (*Serv iswm $nick) {
var %t = $remove($1-,$chr(58))
if ((%t == Bot List) || (%t == Bots reserved to IRC operators)) { echo -at 14(10Notice14) 12From15: %sn 12Msg15:10 $1-  }
if ($istok(Global opsb,$nick,32)) { noticeprint 14(10Notice14) 12From15: %sn 12Msg15:03 $1-  }
elseif (CaptainJack iswm $nick) { echo -at 14(10Notice14) 12From15: %sn 12Msg15:10 $1-  }
elseif (CaptJack iswm $nick) { echo -at 14(10Notice14) 12From15: %sn 12Msg15:10 $1-  }
else { echo -at 14(10Notice14) 12From15: %sn 12Msg15:03 $1-  }
}
else { echo -t @DragonView 14(10Notice Sent14) 12From15:10 %sn 12Msg15:03 $1-  }
haltdef
}


I'm unsure whats wrong with this snippet, but I could seriously use some expert help, I am wanting to make it so the elseif statements (the ones with Capt in them) ONLY echo into my active channel, while leaving Services to go into the DragonView window, and I am unsure how to accomplish this task.
1 12 Read More
Scripts & Popups Jump to new posts
Problem with timestamps on ZNC playback buffer 8bitbubsy Yesterday at 01:47 PM
I'm using a custom script to change the message output style of TEXT and INPUT events, and this is also appending timestamps to every message by feeding -t to echo. The problem is that the timestamp shown is the current time instead of using the time from the ZNC playback buffer. If I close mIRC and reopen it, ZNC will feed it the backlog, and the timestamp for every message is the current time instead.

Is there any way I can customize channel message styles while also showing the correct ZNC timestamps?

Also another quick unrelated question: Is there any way I can get the number of servers (not networks) present in servers.ini as a variable for mIRC scripting?
4 35 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? Raccoon 16/10/19 12:03 AM
Originally Posted by beer
Thanks once again Raccoon!

On a kinda similar note, is there a better method between having one hash table with long data for each item (say 100-300 characters), or a few hash tables with the data split between them (so say 3 hash tables where each item has 100 character data)? Nobody likes a slow script. smile


I typically, anymore, just assign one hashtable to a single script to handle all of its data storage. Then I name each item with prefixes / suffixes to identify the type of content that I'm storing. In practice, the only thing that makes hashtables slow is not knowing in advance what the item name is. It's always best to lookup an item rather than searching for it with $hfind(), which is slow.

So try not to worry about any other aspects like buckets or number of split up tables. The time savings would be negligible one way or another, and will change from mIRC version to version as updates are made to algorithms and speed improvements are introduced.

Code
var %reason User was running his mouth again.
var %table = kickscript
var %item = $+($network,.,$chan,.,$nick)
hinc -m %table $+(%item,.kickcount) 1
var %count = $hget(%table,$+(%item,.kickcount))
hadd -m %table $+(%item,.kickreason.,%count) %reason

; [kickscript]
; efnet.#mirc.raccoon.kickcount == 2
; efnet.#mirc.raccoon.kickreason.1 == User keeps harassing the ops.
; efnet.#mirc.raccoon.kickreason.2 == User was running his mouth again.
7 94 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? Wims 15/10/19 11:32 PM
2 Things:

-Everytime a message is received on a channel/pm, mirc scans the script file for on text event, having multiple on text events means everytimes there is a message received like that, it takes more times for mIRC to figure it out, you don't want a lot of script file with a lot of on text event in it, I'd suggest to use one single event to avoid making mIRC 'freezing' to look for your event.

-With a single on text event per file, once the event triggers you have to use multiple if/else combination in order to differenciate channel/pm messages and act based on what has been said, which is slowing down the script itself

Another thing is that mIRC only triggers one event type per file, which often leads to people's event not getting triggered (more info & examples on https://en.wikichip.org/wiki/mirc/on_event), and as such I do not recommend multiple events per file.

In practice the time wasted in both cases is negligeable and you shouldn't be bothering too much.
7 94 Read More
Bug Reports Jump to new posts
Re: /run -a maroon 15/10/19 09:42 PM
The new $isadmin works as expected in win7-32. Assuming that there's no effective difference between using /run's -a switch if mirc.exe itself is already running in elevated privileges, it might be reasonable to have everyone skip using the new API as superfluous.

One slight change might be to conform with other identifiers that return $true or $false, instead of the current 1 or 0. Unless there's the intent to switch over to this type of return value, like $compress does. I know there's no effective difference inside if() boolean logic.
2 103 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? maroon 15/10/19 08:04 PM
In general, scripts are faster when you reduce the number of commands, because of the overhead involved in preparing the input output. i.e. if you need to use other identifiers to stitch items together, that takes even more time. Splitting data across several items just means there's more things to search past, but it's probably faster for the alternative which does not require stitching items together, or using string identifiers to hunt within the item data for a token.

If you're having a lot of items in your table, the biggest impact on $hget speed is the number of buckets. If you have 100k items split into 100 bucks, then each bucket has around 1000 items, and $hget needs to search on average 500 items to find the right one. If you have 1000 buckets, then each bucket has 100 items, and needs to search past average of 50 items to find the right one. There is probably a little overhead involved with having more buckets, so it may not be wise to just take the max 10000.

Buckets probably don't help you with using $hfind, since that needs to look at everything rather than looking in a specific bucket for a specific item.

https://en.wikichip.org/wiki/mirc/hash_tables
7 94 Read More
Bug Reports Jump to new posts
Re: mIRC beta Khaled 15/10/19 07:12 PM
The latest beta is mIRC v7.57.2425 and can be downloaded here. It includes the following changes:

Quote
Beta v7.57.2425 changes:
1.Item 41, added. Tested under Windows XP/7/10.
2.Item 42, updated. Mostly affects APIs that return HRESULT values.

Beta v7.57.2269 changes:
1.Item 36, https://forums.mirc.com/ubbthreads.php/topics/266054
2.Item 37, https://forums.mirc.com/ubbthreads.php/topics/266138
3.Item 38, added.
4.Item 39, fixed.
5.Item 40, https://forums.mirc.com/ubbthreads.php/topics/264540
This change affects $comchan(), if isop/isvoice/ishelp/isowner, and
the channel Command Editbox handling of modes.

Beta v7.57.2183 changes:
1.Item 33, https://forums.mirc.com/ubbthreads.php/topics/266076
Also made several other changes to /list to make it work correctly
when multiple queued list requests are sent.
2.Item 34, required changes to the treeview code.
3.Item 35, https://forums.mirc.com/ubbthreads.php/topics/266097
Required a rewrite of most MODE parsing code. This change means that
mIRC's mode parsing is now more dependent on the CHANMODES token, MODE
events, and numeric events. It also needs to handle the "Hide channel
key" option in the Options/IRC dialog. This also affects user mode
parsing and $chan().mode/key/limit.

Beta v7.57.1965 changes:
1.Item 30, added.
2.Item 31, changed. Previous implementation did not allow window names
that contained . periods. Change should be backwards compatible.
3.Item 21, made a few more changes. Now has a 30 second time-out and
handles other issues.
4.Item 32, updated.

Beta v7.57.1701 changes:
1.Item 18, fixed.
2.Item 20, fixed.
3.Item 21, fixed. Note that this change may mean that $url no longer
works with older browsers.
4.Item 22, https://forums.mirc.com/ubbthreads.php/topics/266007
5.Item 23, https://forums.mirc.com/ubbthreads.php/topics/266011
This means that features that previously required &binvar names
of two letters or more in length now allow just &.
6.Item 16 and 19. Re-ran CppCheck. The main issue with static code
analyzers is the large number of false positives. Each warning needed
to be checked to determine whether there really was an issue. In most
cases, there was not. Issues were found relating to portability,
optimizations, dereferences, pointer arithmetic, sprintf() parameters,
32bit/64bit variables, and so on. Changes were made to 140+ files.

Also installed Visual Studio 2019. For now, it is only being used for
testing purposes, not for compiling the beta or release version. Required
a number of code changes to make mIRC compile.

Beta v7.57.965 changes:
1.Item 11, another partial rewrite of the code used by /run, /exit -nr,
/url, etc. Note that /run may or may not report an error if a file
cannot be run, depending on the version of Windows. Also, /url now
uses a simpler method of opening the default browser.
2.Item 17, https://forums.mirc.com/ubbthreads.php/topics/265915

Beta v7.57.669 changes:
1.Item 11, https://forums.mirc.com/ubbthreads.php/topics/265834
Partial rewrite of code that affects /run, /url, /exit -nr, opening
DCC Files received folder, etc. The /exit -nr command needs to call
ShellExecute() synchronously, the opposite of other commands which
were fixed for https://forums.mirc.com/ubbthreads.php/topics/265736
2.Item 12, added.
3.Item 13, fixed.
4.Item 14, fixed.
5.Item 15, fixed.
6.Item 16, performed CppCheck on the source code.

Several issues were fixed, though most were mitigated in other ways so
were unlikely to cause issues, and others required specific, unlikely
contexts to be triggered.

A large number of 32/64bit portability issues identified which will
need to be changed over time for 64bit version.

Beta v7.57.528 changes:
1.Item 1, https://forums.mirc.com/ubbthreads.php/topics/265799
2.Item 2, changed.
3.Item 3, https://forums.mirc.com/ubbthreads.php/topics/265806
4.Item 4, https://forums.mirc.com/ubbthreads.php/topics/265805
5.Item 5, https://forums.mirc.com/ubbthreads.php/topics/263520
6.Item 6, https://forums.mirc.com/ubbthreads.php/topics/265812
7.Item 7, optimized.
8.Item 8, fixed.
9.Item 9, added. A large amount of DPI-related code has been added,
including detecting DPIs on different monitors for different windows
and on different versions of Windows, detecting DPI changes for top
level windows, scaling/resetting fonts to match DPI changes, changes
to dialog tabs to handle different size fonts, and so on.

However, most of the code is currently disabled as more work is
needed. mIRC uses a number of DPI APIs, some of which are only
available in the latest update to Windows 10.

10.Item 10, fixed. If files are present, such as with a new install,
they are used. If no files are present, the internal defaults point
to $mircdir. This is partly necessary for backwards compatibility
but the method has been improved.

Changes:
1.Fixed $+ not correctly reporting string too long errors.
2.Changed installer setting to make it DPI aware.
3.Changed $findfile() to preserve multiple spaces inside a wildcard
parameter.
4.Fixed /reload interacting incorrectly with Script Editor when a new,
unedited file is created.
5.Fixed $parms returning incorrect values in some contexts.
6.Fixed DCC trust user list bug that prevented autoget from working
correctly for trusted users.
7.Optimized SendMessage() processing to use less memory.
8.Fixed SendMessage() gpf bug where recursive calls result in a stack
overflow.
9.Updated several features to be DPI aware.
10.Fixed incorrect default location for alias, popup, and remote
scripts when no files are present.
11.Fixed /exit -nr not restarting mIRC.
12.Added /run -a switch to request running as administrator.
13.Fixed script editor bug that was wrapping excessively long lines,
resulting in script errors, instead of truncating them.
14.Fixed SendMesage() handling of negative indexes.
15.Fixed richedit control handling bug that may have caused some
editbox-related code to behave incorrectly if the richedit control
failed to load.
16.Fixed a number of issues identfied by CppCheck relating to range
checking, memory initializations, optimizations, portability, and
pointer dereferences.
17.Fixed script #group parsing bug for invalid group definitions.
18.Fixed $decode() gpf buf.
19.Updated more routines to use 32/64-bit compatible types as step in
preparing for a 64bit version of mIRC.
20.Fixed text file writing bug that could have caused the UTF-8 BOM to
be set incorrectly.
21.Fixed $url not working with newer versions of Chrome.
22.Changed /msg to no longer check for channel/nick prefixes due to some
networks using identical prefixes for both.
23.Changed all &binvar supporting features to allow single character &
as a binvar name for consistency.
24.Fixed $findfile() not freeing handles in some contexts. This also
affected other features that retrieve file lists.
25.Fixed /ignore/protect/aop/avoice gpf bugs.
26.Fixed 64bit time calculations in several features.
27.Fixed memory HDC allocation error check in line marker.
28.Fixed $did().csel potential gpf bug when freeing memory.
29.Changed compiler settings to disable string pooling and enable whole
program optimization.
30.Added /logview -nN switch to scroll view to line number.
31.Changed /play to improve handling of window/file names.
32.Updated OpenSSL library to v1.1.1d.
33.Added 421 numeric check for server disabled LIST command.
34.Changed server list and favorites list listboxes to use full line
selection.
35.Updated channel mode parsing and display based on CHANMODES token.
36.Fixed /window -r not restoring a hidden non-min/max window.
37.Changed $ctime() to return $null for invalid input and to handle
commas as separators.
38.Added support for IRCv3 message-tags token and msgid feature.
39.Fixed $N parameter bug that caused inconsistent handling of text
appended to the $N parameter, such as text that contained numbers
or dashes.
40.Fixed handling of channel nickname mode 'q' in some contexts.
41.Added $isadmin identifier that returns current elevation status.
42.Updated error handling for a number of APIs to use consistent method
across all features.
1 171,316 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? beer 15/10/19 05:51 PM
Thanks once again Raccoon!

Since it doesn't sound like there's any real advantage to splitting everything into multiple ON TEXT, I'll probably join the crowd that prefers to keep it all in one and try minimizing lines.

On a kinda similar note, is there a better method between having one hash table with long data for each item (say 100-300 characters), or a few hash tables with the data split between them (so say 3 hash tables where each item has 100 character data)? I don't know how mirc manages hash table keys/items but I'd assume it would be faster to do a single $hget of 300 chars than 3 $hget's of 100 chars each. I don't care about memory but I do care about execution speed. Nobody likes a slow script. smile
7 94 Read More
Scripts & Popups Jump to new posts
Re: Multiple ON TEXT's or 1 with multiple if/elseif's? Raccoon 15/10/19 07:10 AM
mIRC was designed for the former, that is, creating several event text triggers with different match text. However, these days, most people just lump all text triggers into a single On TEXT event, especially so they don't have to repeat / reuse lines of code that can all be used in a single common event.

It's really just up to you. Write it both ways and decide which styles you prefer or find convenient. Nobody sticks to just one method.
7 94 Read More
Scripts & Popups Jump to new posts
Multiple ON TEXT's or 1 with multiple if/elseif's? beer 14/10/19 11:36 PM
If I write a script with say 10 commands, is it better to write 10 ON TEXT triggers (one for each command), or would I want to have a single ON TEXT with 10 if/elseif checks? Or does it even matter? I wasn't sure if one method would be safer some how, execute faster, or have other considerations I'm not aware of.
7 94 Read More
Feature Suggestions Jump to new posts
Re: Automatically colourize nicknames maroon 14/10/19 10:12 PM
This thread deals with that topic, and it doesn't look as cut and dried as you make it seem. How many colors should be assigned? How should they be assigned to the different nicks?

Depending on the background color, there can be different number of different colors you'd want to use. If your background is black, you could use 3-green 4-red 8-yellow 9-neon-green 11-sky-blue. But 2-blue would be bad. On the other hand, with a white background, 8/9/11 are bad, but 2 and 12 are good. Other colors start to become marginal, so how to decide when enough is enough.

Should the color be calculated based on the 'nick'? or their address so they stay the same color when they change nick? If the address, which mask should be used? Right now, your example looks like 3 nicks are using green, and a 4th uses a shade of blue that looks almost the same. It took me a while to figure out that bold meant that $1 was someone's nick.
3 72 Read More
Feature Suggestions Jump to new posts
Re: Automatically colourize nicknames RoCk 14/10/19 08:10 PM
This can already be done. In mIRC type /abook -l

Here is mine.
[Linked Image from i.ibb.co]
3 72 Read More
Scripts & Popups Jump to new posts
Re: How to get channel name you received a notice in? beer 14/10/19 04:26 PM
Thanks for the explanation Raccoon, it makes complete sense now. I was able to take advantage of the $comchan function you mentioned and do what I was looking for.

Cheers!
2 54 Read More
Feature Suggestions Jump to new posts
Re: Automatically colourize nicknames True_Falcon 14/10/19 03:03 PM
You mean like this?

https://imgur.com/a/9yOSW7C

Press alt-b to get the address book or right-click any name. It's also in the tools menu.

This is not new; I've been using it for years.

This particular chat room also give permission to certain users to post in colour as well!
3 72 Read More
Feature Suggestions Jump to new posts
Automatically colourize nicknames afterdeck 14/10/19 11:49 AM
Consider the following screenshot:

[Linked Image from i.imgur.com]

How easy is to follow a conversation? /rhetorical/

Now, with colours:

[Linked Image from i.imgur.com]


...Can we please have automatic "colourization" of the nick-names in the chat and (maybe) in the user list as well?
3 72 Read More
Scripts & Popups Jump to new posts
Re: How to get channel name you received a notice in? Raccoon 13/10/19 10:40 PM
mIRC's behavior is such that private (direct to user) notices will be displayed in all channels in which you and the sender share in common.

So, to discover which channel windows those are, you would iterate through $comchan($nick,%i)

In addition, mIRC options allows you to show notices in the Active Window as well, so that window would be identified by $active

If $chan is populated in the On Notice event, then the target was a channel and not just to you privately. In which case, the notice would only appear in that channel window.

As of this time, there is no NOTICE command that allows you to notice a single person with a specific channel-context. On some IRCDs (networks), there exists a WHISPER command that does this.

Another thing that NOTICE allows is to target only a channel's ops, voices, or halfops by prefix, ie, "NOTICE @#mIRC That guy wants to get banned real bad." and the client command /onotice is an alias for this.
$target will be populated with "@#mIRC" on networks where this is supported.
2 54 Read More
Scripts & Popups Jump to new posts
How to get channel name you received a notice in? beer 13/10/19 07:59 PM
Hi. How do you retrieve the channel name which you have received a notice in? For example, if myself and someone else are in channel #test, and they send me a /notice, the notice msg will go to my #test window whether I'm currently in that window or not (which is how I like it). If I have an `on *:NOTICE:*:?:{ .. }` function, how do I find out what channel that msg was received in? I'd expect $chan to be "#test" but $chan is empty.

Thanks
2 54 Read More
General Discussion Jump to new posts
Re: Find & Search Not working maroon 13/10/19 03:48 PM
Your question is not clear. There is no command in mIRC which begins with "@", so either you have a script with aliases of those 2 names, or this is a script which responds to a sentence beginning with either of those 2 words. Is this search/response going on between 2 different nicks where their script makes a @find response to your @search, or is your own script supposed to respond with @find to your own @search?

The only non-scripting reasons I can think of for your problem is:
1. your scripts have been disabled. if "/remote" says 'off', you can turn your event handing back on with: /remote on
2. when upgrading, if you installed the new version into a different folder, or answered the install question that you did not want to keep existing settings, one of those existing settings is to know which scripts to load.

If #2 happened, then the REMOTE tab of the scripts editor is blank, and so is the list of scripts shown in the "view" menu of that window. Your scripts shouldn't be deleted, you just need to find where they are and install them again.
3. You've installed a new script which is able to intercept and block the old behavior
4. When either of these commands fail to do anything, is there also an error message displayed in the Status Window? If there is, that can give a clue to the problem: /window -a Status Window
1 42 Read More
Page 1 of 2 1 2