mIRC Home    About    Download    Register    News    Help

Print Thread
I need a challenge #122618 13/06/05 04:57 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
I need a scripting challenge... I'm bored and need something to do. smile

A couple requests before giving me a challenge (or challenges)...

1) I don't want to write a huge script that will take days or more to complete.

2) I'm quite advanced (I think, anyhow) with scripting, but I still have a lot to learn, so nothing so complex I won't have any chance to figure out. Just use your judgement. smile

3) I'd like the script to be something people can find useful... not just something that won't have any value when completed.

4) Once done, I'd like some people to view how I did it and give recommendations on how I could improve my scripting style. Scripting a lot without criticism improves ability, but it doesn't always improve quality. smile

Give as many ideas as you would like... depending what they are and how difficult and how many, I may or may not do all of them.

Thanks.


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122619 13/06/05 06:22 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
How about trying to create some of the things people suggest as features.


New username: hixxy
Re: I need a challenge #122620 13/06/05 06:29 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I've got a little something, should only be two lines of code maximum.

Make a commatizer with regsub that uses no identifiers other than maybe a $+, and the input $1.

So 12345678.123456 will be turned into: 12,345,678.123456

It's not really that helpful for others as you can script it without regsub, but when I was offered to make it as a challenge, I quite enjoyed it.

Good luck.


Gone.
Re: I need a challenge #122621 13/06/05 06:46 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Hm... Not a bad idea for the regex idea. That's something I've not taken the time to learn before. Gives me motivation to do it. smile

Still open to other ideas.

As far as feature suggestions... I was hoping to just get ideas from scripters for what would be challenging. Sorting through the feature suggestions to weed out all the things that aren't really worth scripting or can't be scripted or are already implemented or whatever is not really what I was wanting to do. Ok, so I'm lazy. smile


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122622 13/06/05 07:06 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If you have any experience in COM you could try to make a snippet that opens your cd-rom drives without using WMP's objects (was one of the first things I did with COM, good learning experience)

Other things:

* If you're any good with sockets, an mirc.com forum checker to see for new posts and give extra information about them like who/when/topic.

* A picwin scripts editor.

* A picwin gui to create picwin dialogs with everything MDX supports.

* A dialog editor similar to Dialog Studio/Editor, but in pure mIRC scripting.

* Learning regex, and by learning I don' t mean just memorizing the syntax, is a challenge on its own. Being able to make optimized regexes that don't match too much, and too little, is a great challenge. One of the pitfalls for people who only know regex so so, is that they make expressions that match what they want, but in more occassions than it should.

I know some of these suggestions sound like big things, but you could have the basis for some of them in one day for sure. Doesn't need to be finished in 2 days, you can work on them over a longer period of time.

Hard to find an appropriate challenge as I don't know your scripting ability.


Gone.
Re: I need a challenge #122623 13/06/05 08:04 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Hm... those may be interesting. As far as COM... never messed with it (yet). For sockets, see http://www.arrowweb.com/jeremy/IRCWeather.html .

Anyhow, I'm running into issues with $regex/$regsub. I understand searching for items and replacing them. However, I can't seem to figure out how to determine how many changes and such... (can't really explain... I'll demonstrate):

1234 = 1,234 (one replacement)
12345 = 12,345 (one replacement)
123456 = 123,456 (one replacement)
1234567 = 1,234,567 (two replacements)
etc.

Now, I can make it mess around with one replacement with this...

$regsub($1,[0-9]{3}\b,$chr(44) $+ $right($1,3),%commas)

Yes, I'm certain there's a better substifute format.... I'm trying smile

My problem is trying to make it do the second (or third or whatever number) replacement.

If you can give me a hint of some sort to get me on the right track without actually giving the answer, I'd appreciate that.


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122624 13/06/05 08:14 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You're not allowed to use $right, only $1, $+ and $chr(44) (forgot to mention $chr(44) though it's obvious you'll need to put it somewhere)

It's fairly useless for me to give you tips, you'll need to practice with regex first. No one can make that function with $regsub if they don't have atleast a decent understanding of regex. Anyway a tip would be: check if the current position in the regex has a multitude of 3 digits until the end/dot, so that you know you need to make a substitution there.

Btw it's easy to make it work on non-decimal numbers, the challenge is actually making it work on numbers that have a decimal part.


Gone.
Re: I need a challenge #122625 13/06/05 09:01 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Well, I *did* ask for a challenge. laugh

Still, I have wanted to learn regex and this will get me going. Now that work is done, I can spend more time on it... learning regex instead of working (while at work) isn't the best thing. laugh


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122626 13/06/05 09:28 PM
Joined: Apr 2005
Posts: 18
B
BarGarth Offline
Pikka bird
Offline
Pikka bird
B
Joined: Apr 2005
Posts: 18
I tried the $regsub challenge as well

Im always in for challenges laugh and didn't use lookahead/lookback that mutch in the past, so I learnt alot from it.

The $+ wasn't needed in my solution though.

I shall not post my result (unless he asks me to) to give Riamus2 the time to find the solution as well.

If anyone can think of more regex/regsub challenges, they more than welcome to tell them.

Re: I need a challenge #122627 13/06/05 11:06 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
If you want a different channlenge, and since your involved with Invision, how about a script that allows you to double click on server ads triggers instead of having to copy and paste them. In channel and in pm replies.

Re: I need a challenge #122628 14/06/05 04:12 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Ooh... I like that idea, Dave. And I'd learn something new since I've never done hotlinks before either. smile


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122629 14/06/05 01:06 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
As discussed in pm, you're not quite there yet, as your current solution only supports numbers with decimals, it has to work on any kind of number you input, whether it has decimals or not.

Good luck smile


Gone.
Re: I need a challenge #122630 14/06/05 07:27 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
DaveC, I almost have that hotlink trigger script complete... nice small script. I'm just looking for a suggestion if you have one...

Right now, I have the double click assume that the trigger is any text following the start of the trigger until the first Ctrl-K. I chose that because probably 99% of ads have colors.

So as an example:

3File Server Online! Trigger:4 /ctcp test me 3Slots...

It would assume the trigger is /ctcp test me (stopping at Ctrl-K). Yes, I have it set for non-ctcp triggers as well.

I'm just wondering if you, or anyone, has a better idea of how to determine the actual trigger. It's quite possible for an ad to be:

File Server Online! Trigger: /ctcp test me Slots...

Then, it would think the trigger was /ctcp test me Slots...

The problem is that a trigger can be any number of words (within reason) and I'm not sure any other method to determine a stopping point than to use Ctrl-K ($chr(3)). In most cases, it wouldn't be a problem, but it could be on rare cases. I hate making a script that I know will be wrong once in awhile, no matter how infrequently.

As a second question... can a hotlink span multiple words? I can't seem to make it work. In the example of /ctcp test me trigger, I'd like a person to be able to double click on any part of the trigger.


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122631 14/06/05 10:44 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I have just checked and the following is the default display (minus color) of a fserver ad

  • File Server Online Triggers:«/ctcp DaveC !trigger1» Sends:«0/1» Queues:«0/20» Accessed:«0 times» Online:«0/4» RCPS:«0 cps by n/a» Served:«0B in 0 files» Current BW:«0 cps» AQT:«No Wait» Serving:«901 files» MOTD: -= Invision 2.0 Build 3515


I have seen a variety of differing formats these 6 cover i beleave 99%
File Server Online Trigger: «*»*
File Server Online Triggers:«*»*
File Server Online! Trigger:«*»*
File Server Online! Triggers:«*»*
«File Server Slot Free» Trigger:«*»*
«File Server Slot Free» Triggers:«*»*

You well note the « » surround the triggers in everycase, this maybe only the case in the channels i visit, however since it seems the default invision setting also.
I would assume the trigger is the text represented by * between trigger:«*»
And its multiple triggers in Triggers:«*» the sepeartor between triggers is or $+($chr(32),$chr(149),$chr(32)) (incase that translates wrong on the forum)

Quote:
As a second question... can a hotlink span multiple words? I can't seem to make it work. In the example of /ctcp test me trigger, I'd like a person to be able to double click on any part of the trigger.


Well that depends how you want to define what a hotlink is.
Programaticly the answer is NO, the match text section of a hotlink well not match across words so
on ^*:HOTLINK:*«*»*:#:{
Well NEVER match Trigger:«/ctcp DaveC !trigger1»

You would have to use
on ^*:HOTLINK:*:#:{
And then using $hotlinepos (returns word position then line number in window, help file infers its the other way around <eeek!>) check if the word your on ($1) in $hotline is inside part of a trigger, if so RETURN if not HALT

you then do the same on
on *:HOTLINK:*:#:{
but trigger the trigger as its been clicked.

This generates what appears to be multi word hotlinks, but is infact a seperate hotlink detection for each word (you notice while over the spaces the mouse changes back lol)


****
Having said all of that above, one consideration is the shear volume of code having to be processed over and over and over which u want to try an minimize.
(When i did mine it covered Invision Polaris Excursion SysReset & FireServ). It ran ok but i decided to go a different way in the end.
Heres something like what i did.
Code:
Captured text with ON ^*:TEXT:*:#{
  pharsed the line for being a fserver add
    located the trigger
    stripped the trigger of control codes
    replaced $chr(160) with ctrl-r,ctrl-r,$chr(160)
    replaced $chr(32) with $chr(160)
    added to the front ctrl-b,ctrl-b,ctrl-r and to the end ctrl-r,ctrl-b,ctrl-b
    inserted the trigger back into the line
    displayed the line
    halted
.
Hotlinked with ON ^*:HOTLINK:$($+(ctrl-b,ctrl-b,ctrl-r,*,ctrl-r,ctrl-b,ctrl-b)):#:{ return }
.
Hotlinked with ON *:HOTLINK:$($+(ctrl-b,ctrl-b,ctrl-r,*,ctrl-r,ctrl-b,ctrl-b)):#:{
  replaced $chr(160) with $chr(32)
  replace ctrl-r,ctrl-r,$chr(32) with $chr(160)
  striped control codes
  had the trigger so activated it.


* As you can see this way the hotlink is simply on a already "marked up" (for a better word) hotlink, and thus the mouse over processing is minute.
* I did it this way, becuase i was also already recording triggers by nick as they appeared and originally just adding ctrl-r at the begining and end of them for easy siting on the line for cut and pasting, so i thought well why not just mark them up as a special hotlink.

PS: just remebered i said in PM's as well (namely @find's)
*Found:* Use the trigger:* in the channel.*
*Found:* Use the trigger:*
*Found * To access this, type * in the channel.*
*Found * To access this, type *

these are the matching texts that locate the trigger, in 99% of the pm lines, blue star is the trigger

Hope I helped rather than hindered your progress. :-)

Re: I need a challenge #122632 15/06/05 12:46 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Well, although I might have this work as part of Invision (actually, it can work outside Invision as well)... I still want it to work on ALL triggers regardless of the script. Yes, many users use Invision, but many others do not and if I can only click on Invision triggers, it doesn't really make sense.

Anyhow, I think this will work okay with the $chr(3). Just going to do some more testing.

Thanks smile


Invision Support
#Invision on irc.irchighway.net
Re: I need a challenge #122633 16/06/05 01:04 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Just remeber to put a cavet on it that color stopping cant be turned off in mirc.