mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
Alright here is the script I currently have.

[script]
n0=alias -l brandtime {
n1= var %lowtime = 1 | ; quickest duration between messages (in seconds)
n2= var %hightime = 9 | ; longest duration between messages (in seconds)
n3= return $rand(%lowtime,%hightime)
n4=}
n5=alias brandmsg {
n6= var %rline = $read(brand.txt)
n7= if (/me* iswm %rline) /describe $1 $gettok(%rline,2-,32)
n8= else /msg $1 %rline
n9= .timer [ $+ [ $1 ] ] 1 $brandtime brandmsg $1-
n10=}

It returns 1 line of text as speech or an action from the text file named Brand.

Is there a way somebody could customize this script to allow the owner, me, to set which text file is drawn from at any given time. Example would be this, based on the 'bot's mood'.

I set the bot to happy. She begins to say random things from happy.txt
I set the bot to angry. She begins to say random things from angry.txt

How exactly would I go about doing this?

If possible, and I know this might be a lot of work, could you perhaps write a second code to mimic this one, only the program itself switches between the available moods.

Joined: Aug 2006
Posts: 12
G
Pikka bird
Offline
Pikka bird
G
Joined: Aug 2006
Posts: 12
Code:
alias brandmsg {
if (%bot.mode == happy) { var %rline = $read(happy.txt) }
else { var %rline = $read(happy.txt) }
if (/me* iswm %rline) { .describe $1 $gettoK(%rline,2-,32) }
else { .msg $1 %rline }
.timer [ $+ [ $1 ] ] 1 $brandtime brandmsg $1-
}

then u just need to set the bot.mode
like
Code:
on *:text:*:*:{
if ($nick == YOURNICKNAME) {
if ($1 == !botmode) {
if ($2) { set %bot.mode $2 }
}
}



note this is untested

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Try this wink
Use !mood <happy|angry|default> to change the bot's mood. Feeel free to add more moods.

Code:
alias -l brandtime {
 var %lowtime = 1 | ; quickest duration between messages (in seconds)
 var %hightime = 9 | ; longest duration between messages (in seconds)
 return $rand(%lowtime,%hightime)
}
alias brandmsg {
 var %rline = $read($iif(%bot.file,$v1,brand.txt))
 if (/me* iswm %rline) /describe $1 $gettok(%rline,2-,32)
 else /msg $1 %rline
 .timer [ $+ [ $1 ] ] 1 $brandtime brandmsg $1-
}
on *:TEXT:!mood &amp;:#: {
  [color:blue]; Modify this list with the different moods and text files.
  ; Use the format &lt;mood_name&gt;:&lt;text_file&gt;, speprated by a space for each mood[/color]
  var %mood_list = default:brand.txt happy:happy.txt sad:sad.txt
  if ($wildtoktok(%mood_list,$+($2,:*),1,32)) {
    /set %bot.file $gettok($v1,2,58)
    /msg $chan Bot mood set to $2 $+ .
  }
  else /msg $chan Unknown mood $+(',$2,')
}

* untested


-KingTomato

Link Copied to Clipboard