mIRC Home    About    Download    Register    News    Help

Print Thread
#118745 28/04/05 03:38 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hello scripters,

I thought it'd be nice to see the scripters on this forum come together to participate in a thread, which would not only be fun, but also a way to think creatively, and to improve the scripting skills a bit, or perhaps to get see some new ideas or scripting techniques.

We often see people asking for hint systems, and trivia bots are popular script projects where these systems are often used. I thought'd it'd be a nice idea to see what kind of different hint systems people can come up with.

So here is my proposal

Post a hint system, which hasn't been posted in this thread yet. The idea though is that you make it yourself, so that you can be creative, and practice a bit in scripting. I would like to see atleast 10 different kind of hint systems, preferably not all from the same person


Some guidelines
  • Don't copy/paste code from somewhere, that's useless.
  • If a certain hint system has already been posted, it is possible for people to post the same hint system which uses a different method to accomplish. But don't go bashing other people's code please.
  • Make your code as optimized as possible.
  • When posting code, explain its function, provide an example, and use the code tags.

    Example:

    ; Usage: $myhintsystem(<input>,<N>)
    ;
    ; Example: //echo -a $myhintsystem(this is a test,3)
    ;
    ; --> thi* is a tes*
    ;

    Code:
    alias myhintsystem {
    ...
    }

So common people, give it your best shot, show me what you can come up with.

Some examples to get you going

Scrambled hint (there's many possible variations)
Only showing certain letters.
Words in different order.
N first letters of each word.
...

It would be nice to see some examples that don't use variables, some that do, some that use a scripted while loop, some who take advantage of an internal loop, some using recursion, $regsub, binvars... you name it. Though, if you use a non-common technique, please give a little explanation so that people can benefit from it.

To the less experienced scripters: don't be afraid to post what you have, no one is going to laugh at your code, I just want to see what you can come up with.

To non-scripters: now's the time to request hint systems, if you have a good idea! (looks at monk)

To advanced scripters: please don't post all what you can think of all at once, or nothing will be left to script. Perhaps give one hint system, and wait a bit.

Happy scripting laugh


Gone.
#118746 28/04/05 05:21 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ok, here's a very simple one, very being the keyword here. I'll optimize itwhen I'm more awake, hehe. It's using the $prop identifier. This is 1 of the 10 methods. grin

Code:
alias start.hint {
  set %hint $$1-
  echo -a $hint(%hint).1
  .timerhint2 1 15 echo -a $hint(%hint).2
  .timerhint3 1 30 echo -a $hint(%hint).3
}

alias hint {
  if ($prop == 1) { return 1st. $replace(%hint,a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*) }
  if ($prop == 2) { return 2nd. $replace(%hint,b,*,c,*,d,*,f,*,g,*,h,*,j,*,k,*,l,*,m,*,n,*,p,*,q,*,r,*,s,*,t,*,v,*,w,*,x,*,y,*,z,*) }
  if ($prop == 3) { return Times up! %hint }
}


2 methods

1. Using the /start.hint command echoes the hint as stars 15 seconds down the line adds the vowels 30 seconds down the line you'd of failed to answer.

/start.hint <word>

1st. <****>
2nd. <*o**>
Times up! --> <word> <--

2.

Using the custom identifier (not timers)..

//echo -a $hint(FiberOPtics).1 returns 1st. ***********
//echo -a $hint(FiberOPtics).2 returns 2nd. *i*e*O**i**
//echo -a $hint(FiberOPtics).3 returns Times up! --> FiberOPtics <--

-Andy

Last edited by SladeKraven; 28/04/05 05:25 PM.
#118747 28/04/05 08:22 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Quote:
if ($prop == 1) { return 1st. $replace(%hint,a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*) }


Code:
if ($prop == 1) { return $str(*, $len(%hint)) }


New username: hixxy
#118748 28/04/05 08:46 PM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Instead of setting a variable, why not just use $1

Quote:
alias start.hint {

set %hint $$1-

echo -a $hint(%hint).1

.timerhint2 1 15 echo -a $hint(%hint).2

.timerhint3 1 30 echo -a $hint(%hint).3

}


Code:
 alias start.hint {

  echo -a $hint($$1).1

  .timerhint2 1 15 echo -a $hint($1).2

  .timerhint3 1 30 echo -a $hint($1).3

} 


Same goes to the hint alias.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
#118749 28/04/05 08:50 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:

if ($prop == 1) { return $str(*, $len(%hint)) }


//echo -a $hint(this is a test).1 would return ***********

#118750 28/04/05 08:55 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Well I don't know why I didn't set the var in the actual hint alias itself blush, I usually use vars to hold the string rather than using $$1- just a habbit. smile

PS. where's everyone elses!?

#118751 28/04/05 11:14 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
i think you were right but i would have done even more and used

Code:
alias start.hint {
  set %hint $$1-
  echo -a $hint(%hint).1
  .timerhint2 1 15 echo -a $!hint(%hint).2
  .timerhint3 1 30 echo -a $!hint(%hint).3
}


You just never know when the %hint and thus the $hint(%hint).3 might just have a " | exit " in it, or something worse.

#118752 28/04/05 11:23 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Yep that's very true, thanks for poining that out dude!
Nicely done. smile

#118753 29/04/05 11:09 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Common people, so far only corrections have been added, where's the hint systems!?! :tongue:

Here's one from me.

; Usage: $Nfirstletters(<string>,N,<char>)
;
; Example: //echo -a $Nfirstletters(this is a test,2,?)
,
, -> th?? is a te??
;
; Shows the N first letters of each word in the input string

Code:
alias Nfirstletters { 
  var %a, %b = $regsub($1,/(?&lt;=\S{ $+ $2})\S/g,$replace($$3,\,\\,$,\$),%a) 
  return %a 
}


Gone.
#118754 29/04/05 01:29 PM
Joined: Apr 2005
Posts: 3
P
Self-satisified door
Offline
Self-satisified door
P
Joined: Apr 2005
Posts: 3
;Usage: /hints <text here>
;Example: /hints o lk abc defh ijklm nopqrs tuvwxyz
;Return: o l* a** d*** i**** n***** t******
;Return: * ** *** **** **k** **pq** ***w***
;Return: o *k **c ***h ****m *****s ******z
;Note: If the length of the word is smaller than 4 it only shows
;the First and Last letters, otherwise it shows the First, Last
;AND the middle letter.
alias hints {
var %r = $1-
echo -a $hint(%r).s
.timerhint2 1 1 echo -a $hint(%r).m
.timerhint3 1 2 echo -a $hint(%r).f
}
alias hint {
var %i 1
while $gettok($1,%i,32) {
var %z = $gettok($1,%i,32),%p = $calc(($len(%z)+1)/2),%o = $str(*,$calc($floor(%p) -1)) $+ $mid(%z,%p,$iif(*.5 iswm %p,2,1))
var %r = %r $iif($prop == s,$left(%z,1) $+ $str(*,$calc($len(%z)-1)),$iif($prop == f,$str(*,$calc($len(%z)-1)) $+ $right(%z,1),$iif($prop == m,$iif($len(%z) > 4,%o $+ $str(*,$calc($len(%z) - $len(%o))),$str(*,$len(%z))))))
inc %i
}
return %r
}

#118755 29/04/05 02:01 PM
Joined: Apr 2005
Posts: 1
M
Mostly harmless
Offline
Mostly harmless
M
Joined: Apr 2005
Posts: 1
alias reversewords {
tokenize 32 $$1
var %a
while ($0) {
%a = $1 %a
tokenize 32 $2-
}
return %a
}
Usage: $reversewords(<string>

Example: //echo -a $reversewords(this is a test)

This was a fun challenge, great idea, keep up the good posts.

#118756 29/04/05 02:12 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
alias reverse {
var %i = 1
while ($mid($1-,%i,1) != $null) {
var %r = $+($v1,%r)
inc %i
}
return %r
}

//echo -a $reverse(.stsop doog eht pu peek aedi taerg egnellahc nuf a saw sihT)

Last edited by mIRCManiac; 29/04/05 02:14 PM.
#118757 29/04/05 02:36 PM
Joined: Apr 2005
Posts: 18
B
Pikka bird
Offline
Pikka bird
B
Joined: Apr 2005
Posts: 18
Code:
  
alias hint {
  set %answer $2-
  var %b = $regsub($2-,/([[:alnum:]])/g,_,%hint) 
  .timerHint 3 5 MakeHint $1
}
alias MakeHint {
  set %hint $scatter($1,%hint)
  echo -a Hint: %hint
}
alias scatter {
  var %n = $int($calc($regex(%answer,/([[:alnum:]])/g)*($1 / 100))), %h = $2-, %k
  if ($count(%h,_) &lt;= %n) { return %answer }
  while (%n) {
    while ($mid(%h,%k,1) != _) { %k = $r(1,$len(%h)) }
    %h = $+($left(%h,$calc(%k - 1)),$mid(%answer,%k,1),$right(%h,$calc(-1 * %k)))
    dec %n
  }
  return %h
}


Original Scatter alias from tatarize altered to only scramble what's left after the hint before.

usage:
/hint <% visibele after each hint> <answer>

example:

/hint 25 this is a Hint-test

will return:

Hint: _h_s _s _ ____-____
Hint: th_s _s a __n_-____
Hint: th_s _s a H_n_-__st

Timer is set to 3 hints every 5 seconds.

The code:
if ($count(%h,_) <= %n) { return %answer }
will prevent an infinite loop if % is above 100; so choose the number of hints and percentage wisely

One remark:
The percentage can be one letter down each hint because of the usage of $int().

#118758 29/04/05 02:54 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias hint { 
  var %a, %b, %c = $replace($2, $, \$, \, \\), %i = 1
  if ($prop == consenant) { %b = $regsub($1, /[^aeiou ]/ig, %c, %a) }
  elseif ($prop == consenant2) { %b = $regsub($1, /[^aeiou]/ig, %c, %a) }
  elseif ($prop == step) { 
    while (%i &lt;= $len($1)) {
      %a = $+(%a, $mid($1, %i, $3), $2)
      inc %i $calc($3 + 1)
    }
  }
  elseif ($prop == vowel) { %b = $regsub($1, /[aeiou]/ig, %c, %a) }
  elseif ($prop == vowel2) { %b = $regsub($1, /[aeiou ]/ig, %c, %a) }
  return %a
}


$hint(<string>, <replacement character>).consenant
$hint(testing this, *).consenant

This method will replace all consenants with the replacement character (* is this case)

*e**i** **i*

$hint(<string>, <replacement character>).consenant2
$hint(testing this, *).consenant2

This method will replace all consenants and spaces with the replacement character (* in this case)

*e**i*****i*

$hint(<string>, <replacement character>, <N>).step
$hint(testing this, *, 2).step

This method will replace every N + 1 character with the replacement character (* in this case)

te*ti*g *hi*

$hint(<string>, <replacement character>).vowel
$hint(testing this, *).vowel

This method replaces all vowels with the replacement character.

t*st*ng th*s

$hint(<string>, <replacement character>).vowel2
$hint(testing this, *).vowel2

This method replaces all vowels and spaces with the replacement character.

t*st*ng*th*s


New username: hixxy
#118759 29/04/05 02:55 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'd just suggest spelling "consonant" correctly with that last one. laugh


Invision Support
#Invision on irc.irchighway.net
#118760 29/04/05 03:00 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Care factor: 0


New username: hixxy
#118761 29/04/05 03:11 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Lol! Sorry... I'm bad at pointing out grammar/spelling on anything being shared and used by others. smile

Feel free to hit me for it. laugh


Invision Support
#Invision on irc.irchighway.net
#118762 27/05/05 05:54 AM
Joined: Jan 2003
Posts: 87
T
Tat Offline
Babel fish
Offline
Babel fish
T
Joined: Jan 2003
Posts: 87
Heh. If you really want a challenge try doing plot hints.

**** ** *** ****.
T*** ** *** ****.
T*** i* *** ****.
T*** i* t** ****.
T*** i* t** h***.
Th** i* t** h***.
Th** is t** h***.
Th** is th* h***.
...
This is the hint.

Somebody had suggested I add it to my bot. It took like four hours to code up.

#118763 06/06/05 03:03 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hah, saw this post merely by accident.

That's an interesting kind of hint, though not as hard as you think (took me about half an hour)

To run the first time: /plot <string>
To get results: $plot

Example:

/plot this is a test

$plot -> **** ** * ****
$plot -> t*** ** * ****
$plot -> t*** i* * ****
$plot -> t*** i* a ****
$plot -> t*** i* a t***
$plot -> th** i* a t***
$plot -> th** is a t***
$plot -> th** is a te**
...

Code:
alias plot {
  if $isid {
    if %plot.pos == -1 { inc %plot.pos }
    elseif * isin %plot.cur {
      while !$regex(plot,%plot.cur,/(?=(?:\s|^)[^*]{ $+ %plot.pos $+ }(\*))/) { inc %plot.pos }
      bset -t &amp;raw 1 %plot.raw 
      bset -t &amp;cur 1 %plot.cur 
      bcopy &amp;cur $regml(plot,1).pos &amp;raw $regml(plot,1).pos 1
      set %plot.cur $bvar(&amp;cur,1-).text
    }
    return %plot.cur
  }
  $null($regsub($$1-,/\S/g,*,%plot.cur))
  set %plot.raw $1-
  set %plot.pos -1
}


Gone.
#118764 07/06/05 10:34 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Here's another one:

It will randomly show 1 character that hadn't been shown before, until all characters are visible.

; Usage:
; To initiate the hint: /hint <char> <string>
; To return hints: $hint

Example:

/hint ? this is a test
$hint -> ???? ?? ? ???t
$hint -> ???? ?s ? ???t
...

$hint will keep adding random letters, until they're all visible, then it just keeps giving the full answer. Only letters and digits are hidden, punctuation is always visible (this can be easily adjusted)

Code:
alias hint {
  if $isid {
    if %hint.chr isin %hint.cur {
      bset -t &amp;raw 1 %hint.raw
      bset -t &amp;cur 1 %hint.cur
      var %pos = $pos(%hint.cur,%hint.chr,$r(1,$count(%hint.cur,%hint.chr)))
      bcopy &amp;cur %pos &amp;raw %pos 1
      set %hint.cur $bvar(&amp;cur,1-).text
    }
    return %hint.cur
  }
  $null($regsub($2-,/[a-z\d]/ig,$1,%hint.cur))
  set %hint.raw $2-
  set %hint.chr $1
}


--------------------------------------------------------------------

And here's a sentence scrambler (preserving spaces):

; Usage: $scramble(<string>)

Code:
alias scramble {
  var %a = $len($1), %b, %c, %d
  while %a {
    %b = $mid($1,%a,1) 
    if %b == $chr(32) { var %d = %c %d, %c }
    else %c = $iif($r(0,1),%c $+ %b,%b $+ %c) 
    dec %a
  }
  return %c %d
}



Gone.

Link Copied to Clipboard