Quine

By jaytea on Feb 22, 2011

A quine is a piece of code that, when executed, outputs its own source. There are a number of ways to create quines in mIRC script; the most apparent methods are those that have a sort of self referential component such as $isalias().alias, $read($script, n, $scriptline), or $timer($ctimer).com. A little more interesting are quines without an obvious such component, an example of which is given below.

; Copy & Paste this and enter it into a window's editbox to experience the quine-ness!

//echo $iif($( //echo $!iif($( $v1 ,),$(,$v1)) ,),$(,$v1))

Comments

Sign in to comment.
jaytea   -  Nov 29, 2011

yea Firstmate, i saw that ;P you could say it's "a quine on a slightly modified mIRC environment", since it relies upon the existence and execution of a certain 'lastbind' alias.

 Respond  
Firstmate   -  Nov 28, 2011

I understand what you're saying, but a quine just has to show the re-output whatever you typed to trigger it.
By your logic, you could say Jaytea's might not be a quine because it doesn't show the source for $me or $ctimer.

 Respond  
Stewie1k94   -  Nov 28, 2011

Em, okay... Thanks...

 Respond  
[Plornt]   -  Nov 28, 2011

As explained in the description, it outputs its own source code. (Thats a rather hard thing to do in a sense). Although you could possibly just get it to read its own script file then output it >.>

 Respond  
Stewie1k94   -  Nov 28, 2011

What exactly does this Snippet do? :p

 Respond  
[Plornt]   -  Nov 28, 2011

But it isnt a quine, you are simply returning what command you put in and not specifically its own source code. A quine of that code above would output;

on *:INPUT:*:if (/* iswm $1-) set %lastbind $1-
alias lastbind return %lastbind
 Respond  
Firstmate   -  Nov 28, 2011

argv0 posted this and I thought it was a really simple, cool one.

on *:INPUT:*:if (/* iswm $1-) set %lastbind $1-
alias lastbind return %lastbind

The quine is produced when typing //echo -a $lastbind

 Respond  
SReject   -  Aug 15, 2011

Jaytea, I know there's better ways to code it. Was just giving an example of how Quines can be useful :)

 Respond  
jaytea   -  Aug 13, 2011

how about

.timer 0 10 if ($me ison # ) .timer $!+ $!ctimer off $(|) else join -n #

your quine form can still be useful though ;P

 Respond  
SReject   -  Aug 12, 2011

A nice little example of how quine's can be useful. A rejoin-on-kick timer, that tries to rejoin then reactivates itself if not on the channel you were kicked from:

on *:KICK:#:{
  if ($knick == $me) {
    $+(.timerRejoin:,$cid,:,#) 1 10 if ($me !ison # ) $chr(123) join # $(|) $!+(.timer,$ctimer) 1 10 $!timer($ctimer).com $chr(125)
  }
}
 Respond  
IllogicTC   -  Feb 25, 2011

I've noticed a lot of Jaytea's work to be proof-of-concept, which is perfectly fine and acceptable for a snippet post, by my standards. Showing people new ways to do things, or how to do things they didn't even KNOW they could do on mIRC, is part of the idea behind having a section on Hawkee dedicated to mSL in the first place, I would assume.

And I did learn something! I never knew quine was a word. =P

 Respond  
hixxy   -  Feb 24, 2011

It's not supposed to be a useful script.. not all code snippets have to be useful guys. mIRC scripting is a hobby for most people, so developing things that are challenging, albeit useless, is quite fun.

This is a prime example of such a snippet.

Nice work jaytea! A quine is one of the few things I've never been able to figure out on my own :P

 Respond  
Jethro   -  Feb 24, 2011

I apologize if it is. What you have typed made me think that you used an online translator of some sort. Lots of time people use them and end up getting translation other than what they've intended to say.

 Respond  
Conscious   -  Feb 24, 2011

.

 Respond  
Jethro   -  Feb 24, 2011

jaytea, cut Conscious some slack. Evidently English is not his first language and the translation seemingly appeared to be rude...;/ Nice snippet regardless of what I've been clueless about it.

 Respond  
jaytea   -  Feb 24, 2011

Conscious, if you don't see the point in this then that's fine, by all means ignore it. there are many other scripts on this site that are likely to interest you and that you can focus your efforts on instead. if your point was to suggest that i refrain from posting these sorts of snippets in the future, then i'm afraid i'm not persuaded :P

hah [Plornt], sorry, i did make it a bit cryptic! if it helps, here's the same line with proper syntax:

//echo $iif($eval( //echo $!iif($eval( $v1 , 0),$eval($v1, 2)) , 0),$eval($v1, 2))
 Respond  
[Plornt]   -  Feb 24, 2011

Ohai Conscious,
Before messaging me on IRC about this script expecting me to go ape sht and call it useless etc with you. Please understand what it is actually doing instead of showing me examples you have made that "achieve the same thing" when they dont do the slightest. Its supposed to message its source so your $($1-,0) wont work mainly because that only returns $1- which is not its source.

Anyway let me try and figure out how this one works (fulleh) as its a proper mind fuck >.>

 Respond  
Conscious   -  Feb 24, 2011

.

 Respond  
Jethro   -  Feb 24, 2011

This snippet is really deep it almost took me for a fool...It's like you're to meditate a long time to reach nirvana.

 Respond  
jaytea   -  Feb 24, 2011

alias thisisstuipid return $($1-,0)

apparently we have a heckler in the audience. no biggie, i can't expect everyone to appreciate the subtle and the intricate!

 Respond  
Conscious   -  Feb 24, 2011

.

 Respond  
jaytea   -  Feb 24, 2011

and that is precisely what a quine is. start with //echo in your editbox, and try to type a line of code that, when enter is pressed, displays the same line you typed. it's not as simple as you might think ;P

 Respond  
Conscious   -  Feb 24, 2011

.

 Respond  
Jethro   -  Feb 24, 2011

This snippet has lost me. I hope jaytea doesn't mind to shed some light on it.

 Respond  
Conscious   -  Feb 24, 2011

.

 Respond  
Jethro   -  Feb 22, 2011

I'm not certain. I've experienced nothingness but quine-ness. :s

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.