mIRC Home    About    Download    Register    News    Help

Print Thread
#116075 02/04/05 03:33 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
Can someone help me make this type of hint for triviabot?
hint 1/5: ********
hint 2/5: t*******
hint 3/5: t*g*****
hint 4/5: t*g*t***
hint 5/5: t*g*th**

hint 1/5: ******* *******
hint 2/5: R****** K******
hint 3/5: R****r* K**l***
hint 4/5: Ru***r* K**l*n*

hint 1/5: **** ******* *******
hint 2/5: J*** M****** C******
hint 3/5: Jo** M***e** C***z**
hint 4/5: Joh* M***e*l C**tz**
hint 5/5: Joh* M***ell Co*tz**



Always keep the last hint. Thank you!!!

#116076 02/04/05 03:38 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Is this any use to you?

#116077 02/04/05 03:44 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
nope not the hint i want

#116078 02/04/05 03:46 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ah, sorry! smile

#116079 02/04/05 03:48 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
yeah, thanks anway SladeKraven

#116080 02/04/05 03:50 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Maybe someone else has posted this too, do a forum search and expand the search to 5 years. You never know, it might come up trumps. smile

#116081 02/04/05 03:58 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
I'll try

#116082 02/04/05 04:31 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
Couldn't find it frown

#116083 02/04/05 04:43 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If you want an actual code, then I'm going to need to know how it's determined when the hints come up...is it after a certain amount of time, if so how does the game know when to start the timer for the next hint? How does the game know when an answer has been entered rather than just normal conversation? do you want the hints to be revealed in a certain predetermined order, or at random?

If you got the actual trivia code elsewhere, where did you get it, so that I can test? if not, and if it's not too big, could you post it? If you post, please remember the CODE tags

#116084 02/04/05 04:52 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Code:
alias _hint {
  var %i = 0,%a,%b = $regsub($2-,/\w/g,*,%a),%p
  bset -t &b 1 %a
  while (%i < $1) {
    %p = $pos($bvar(&b,1-).text,*,$r(1,%b))
    bset -t &b %p $mid($2-,%p,1)
    dec %b
    inc %i
    set %hint $+ %i $bvar(&b,1-).text
  }
}


/_hint <number of hints> <answer>

It sets variables named %hintN, so %hint1 is the first hint, %hint2 the second and so on

#116085 02/04/05 05:17 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
Sign When i test your script for example my text is: Henric VIII
it shows like this /_hint 5 Henric VIII

%hint1 ****** **I*
%hint2 ****i* **I*
%hint3 ****ic **I*
Doesn't look right

It should show like this

<triviabot> hint 1/5: ****** ****
<triviabot> hint 2/5: H***** V***
<triviabot> hint 3/5: H**r** VI**
<triviabot> hint 4/5: H**r*c VI*I
<triviabot> hint 5/5: H**ric VI*I

#116086 02/04/05 07:45 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You havent really given all the needed information to allow a script to be created, basicly becuase your examples dont match.
And you left it up to us to look at them and try and interprut what you wanted, I made a mistake and thought you wanted
hint 1 being all * and spaces
hint2 being each words first letter * and spaces
hint3 being an undetermined number of random extra letters revealed
^ I called this METHOD1

After writting code to do the above I looked a little closer and it appears you want
hint 1 being all * and spaces
hint2 being each words first letter * and spaces
hint3 being 1 random letter per word revealed , unless there is only one * left then do nothing on that word
^ I called this METHOD2


Since the second method used the code from the first one with some changes, and I like the first one better anyway, Im posting both.

As we cant know how your bot works or under what timing or conditions you release a hint, I have simply created an $identifier that returns the next hint

Usage is as follows...
var %thishint = $hint.methodx(<the answer>,<last hint>)
* if you only pass <the answer> then it well return a * and spaces representation of it
* if you pass it the last returned value it returns the next one
* if you pass it junk its going to pass you junk back!

simple example
//echo -a $hint.method1(This Is a Test)
**** ** * ****
//echo -a $hint.method1(This Is a Test,**** ** * ****)
T*** I* a T***
//echo -a $hint.method1(This Is a Test,T*** I* a T***)
T*** I* a T*s*
//echo -a $hint.method1(This Is a Test,T*** I* a T*s*)
Th** I* a T*s*
//echo -a $hint.method1(This Is a Test,Th** I* a T*s*)
Th*s I* a T*s*
etc etc

simple example
//echo -a $hint.method2(This Is a Test)
**** ** * ****
//echo -a $hint.method2(This Is a Test,**** ** * ****)
T*** I* a T***
//echo -a $hint.method2(This Is a Test,T*** I* a T***)
T*i* I* a T*s*
//echo -a $hint.method2(This Is a Test,T*i* I* a T*s*)
T*is I* a Tes*
//echo -a $hint.method2(This Is a Test,T*is I* a Tes*)
T*is I* a Tes* same as above


So you need to pass it the answer and rember what it returns wheather you use method1 (mine) or method2 (yours)

I have supplied an actual example alias to allow you to see how it works, and the results, your method of number or repetitions and mine may vary.

BE ADVISED DO NOT always expect the last hint of method 1 to match the passed <the answer> text. 99% of the time it well, but due to the use of tokens it is possable for extra spaces to have been erased.



Code:
alias hint.method1 {
  var %answer = $gettok($1,1-,32)
  var %hint = $gettok($2,1-,32)
  if (!%hint) {
    !.echo -q $regsub(%answer,/[^ ]/g,*,%hint)
  }
  elseif ($regex(%hint,/^[* ]+$/iS)) {
    var %i = $numtok(%hint,32)
    while (%i) {
      var %hint = $puttok(%hint,$+($left($gettok(%answer,%i,32),1),$mid($gettok(%hint,%i,32),2)),%i,32)
      dec %i
    }
  }
  elseif ($pos(%hint,*,0)) {
    var %pos = $pos(%hint,*,$rand(1,$v1))
    var %hint = $+($left(%hint,$calc(%pos - 1)),$mid(%answer,%pos,1),$mid(%hint,$calc(%pos + 1)))
  }
  return %hint
}
;
alias hint.method2 {
  var %answer = $gettok($1,1-,32)
  var %hint = $gettok($2,1-,32)
  if (!%hint) {
    !.echo -q $regsub(%answer,/[^ ]/g,*,%hint)
  }
  elseif ($regex(%hint,/^[* ]+$/iS)) {
    var %i = $numtok(%hint,32)
    while (%i) {
      var %hint = $puttok(%hint,$+($left($gettok(%answer,%i,32),1),$mid($gettok(%hint,%i,32),2)),%i,32)
      dec %i
    }
  }
  elseif ($pos(%hint,*,0)) {
    var %i = $numtok(%hint,32)
    while (%i) {
      var %hword = $gettok(%hint,%i,32)
      if ($pos(%hword,*,0) &gt; 1) {
        var %pos = $pos(%hword,*,$rand(1,$v1))
        var %hint = $puttok(%hint,$+($left(%hword,$calc(%pos - 1)),$mid($gettok(%answer,%i,32),%pos,1),$mid(%hword,$calc(%pos + 1))),%i,32)
      }
      dec %i
    }
  }
  return %hint
}

;
;
;
;
alias example {
  var %answer = $$gettok($remove($1-,*),1-,32)
  var %hint
  var %c = 1
  while (%hint != %answer) {
    var %oldhint = %hint
    var %hint = $hint.method1(%answer,%hint)
    echo -s Hint2 : %c : %answer : %hint
    inc %c
  }
  ;
  echo -s ----
  ;
  var %answer = $gettok($remove($1-,*),1-,32)
  var %hint
  var %oldhint = .
  var %c = 1
  while (%hint != %oldhint) {
    var %oldhint = %hint
    var %hint = $hint.method2(%answer,%hint)
    echo -s Hint1 : %c : %answer : %hint
    inc %c
  }
}

#116087 02/04/05 06:06 PM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
brick house
***** *****
b**** ****
br*** ****
br*** ***s
bri** ***s




It loses an e. How do i fix it Dave?

#116088 03/04/05 02:05 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
I finally got it, thank you so much for your great work Dave and also a big thanks to Sign. smile

#116089 03/04/05 02:43 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I tested my code and it didnt do that, Did you alter my code or was it you were sending it a faulty Hint value?

If you send $hint.method2(brick house,b**** h***) one star missing on house it well come back b**c* h**s etc becuase by then all its doing is removing *'s and replacing them with letters.

Also as I said if you send it dodgy info and its gonna send you dodgy info back as in $hint.method2(brick house,R** G**** B***) --> R*i G*u** B**
First 2 words simply replace *'s with matching letters from the answer word, the 3rd word looses a * becuase its replacing it with a letter from the 3rd answer word (which there isnt one)

#116090 03/04/05 04:44 AM
Joined: Apr 2005
Posts: 9
C
cuti Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2005
Posts: 9
I was sending to it a faulty hint value. frown But it work great now. Thanks Dave! You're awesome! smile


Link Copied to Clipboard