mIRC Homepage
Posted By: Zaephyr A personality script - 08/08/06 08:13 PM
Alright, I have bits and pieces from certain people that could help here, but I'm lost on the rest.

Here's what I want:

A script that randomly changes the variable %mood to one of these settings: Happy, Sad, Angry

After that I need it to pull and do a $read from a text file, based on the current value of %mood.

If %mood = happy then pull a $read from happy.txt
If %mood = sad then pull a $read from sad.txt
If %mood = angry then pull a $read from angry.txt

but it needs to be randomized.

[script]
n0=alias -l brandtime {
n1= var %lowtime = 100 | ; quickest duration between messages (in seconds)
n2= var %hightime = 500 | ; 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=}

The above script does a $read from the text named brand based on the random times caused by the settings of the 2 numbers: 100 & 500
I had hoped this could be added with the above %mood variable scripting, so that based on the 2 numbers the mood will randomly shift to another of the options available.
I'd like them both combined, so that the mood will shift randomly based on its 2 numbers, and the bot will speak, or do an action, based on a different set of 2 numbers. So I can customize how often they both happen.

Finally, after thats finished I wanted some text triggers put in, to cause a mood shift based on what is said to the bot.
Something like

If someone says: I love you, [botname]. Then the %mood variable will be changed to happy and the bot will then speak in main: I love you too $nick. (So that she will reply back to whoever spoke the words.

Another type of text triggering I'm interested in is using keywords, like this.

If the words I and hate and [botname] all appear in one line of text then the variable %mood should be changed to angry and the bot will do this as an action /me storms off to be alone.

another example is to set up the same as above, but using if and or, like this

If hate and [botname] or sucks and [botname] appear then the %mood changes to angry and the bot says "Well I hate you!"

I know this is a big job, and I hope someone is capable enough to figure how this entire thing would look.
Posted By: glue Re: A personality script - 08/08/06 11:10 PM
Code:
on *:connect:{
.timermood 0 3600 randmood 
[color:red];3600 is 1hr [/color] 
}
alias randmood {
var %a = $rand(1,3)
if (%a == 1) { %mood = happy }
if (%a == 2) { %mood = sad }
if (%a == 3) { %mood = angry }
}

alias -l brandtime {
var %lowtime = 100 | ; quickest duration between messages (in seconds)
var %hightime = 500 | ; longest duration between messages (in seconds)
 return $rand(%lowtime,%hightime)
}
alias brandmsg {
if (%mood = happy) { var %rline = $read(happy.txt) }
if (%mood = angry) { var %rline = $read(angry.txt) }
if (%mood = sad) { var %rline = $read(sad.txt) }
if (/me* iswm %rline) /describe $1 $gettok(%rline,2-,32)
else /msg $1 %rline
.timer [ $+ [ $1 ] ] 1 $brandtime brandmsg $1-
}


this is not tested and prob could be made alot smaller
Posted By: RusselB Re: A personality script - 09/08/06 02:01 AM
Here's a condensed version of Glue's script
Code:
 on *:connect:{
  .timermood 0 3600 randmood 
  ;3600 is 1hr  
}
alias randmood {
  set %mood $gettok(happy sad angry,$r(1,3),32)
}

alias -l brandtime {
  var %lowtime = 100 | ; quickest duration between messages (in seconds)
  var %hightime = 500 | ; longest duration between messages (in seconds)
  return $r(%lowtime,%hightime)
}
alias brandmsg {
  var %rline = $read($+(%mood,.txt))
  if (/me* iswm %rline) describe $1 $gettok(%rline,2-,32)
  else msg $1 %rline
  $+(.timer,$1) 1 $brandtime brandmsg $1-
}
 
Posted By: Zaephyr Re: A personality script - 09/08/06 03:18 AM
Russell I copy pasted your script in exactly, and only changed the 3 times to shorter increments, the only thing it does is say randmood in the console.
Posted By: Zaephyr Re: A personality script - 09/08/06 03:45 AM
scractch all the stuff you have put up here, I may have a simpler way to do this...

First it needs the random timer, for speaking

that would be this I think

alias -l brandtime {
var %lowtime = 100 | ; quickest duration between messages (in seconds)
var %hightime = 500 | ; longest duration between messages (in seconds)
return $rand(%lowtime,%hightime)
}

then just do the roll random number out of the number of moods
and have it set to do if 1 then read happy
if 2 then read sad

nd display 1 line from it at random intervals in the room
Posted By: RusselB Re: A personality script - 09/08/06 04:34 AM
Did you have the client that you put the script on, disconnect from the network, then reconnect? If not, then the ON CONNECT event won't have triggered
© mIRC Discussion Forums