J-Script — File Browser

J-Scriptv2.2 / J-Scriptv2.2 / ini / agents.mrc

agents.mrc — 4.25 KB — Download this file

;# This script allows you to browse and test out agents.

menu menubar {
  Agent Browser:/mbrowse
}
alias mbrowse {
  if ($agentver != 0) {
    dialog -m mbrowse mbrowse
    mbrowse.init
  }
  else {
    var %null = $!="You don't have MS Agent Installed!"
  }
}
dialog mbrowse {
  title "Sojourn's MS Agent Browser"
  size -1 -1 135 215
  option type dbu

  text "Agents Installed:", 1, 10 5 55 8, center
  list 2, 10 13 55 60
  button "Load", 3, 25 69 25 10

  text "Agents Loaded:", 4, 70 5 55 8, center
  list 5, 70 13 55 60
  button "Unload", 6, 85 69 25 10

  box "Agent Info", 7, 5 80 125 130

  text "Name:", 8, 11 91 19 8, left
  edit "", 9, 30 90 35 10, autohs
  text "Filename:", 10, 71 91 24 8, left
  edit "", 11, 95 90 30 10, autohs

  box "Speech", 12, 10 105 55 37
  text "Pitch:", 13, 15 116 17 8, right
  edit "", 14, 33 115 25 10, autohs
  text "Speed:", 15, 15 127 17 8, right
  edit "", 16, 33 126 25 10, autohs

  box "Starting Size", 17, 70 105 55 37
  text "Width:", 18, 75 116 17 8, right
  edit "", 19, 92 115 25 10, autohs
  text "Height:", 20, 75 127 17 8, right
  edit "", 21, 92 126 25 10, autohs

  box "Settings", 22, 10 142 61 50
  check "Visible", 23, 15 150 28 10
  check "Idle", 24, 15 160 25 10
  check "Effects", 25, 15 170 28 10
  check "Active", 26, 15 180 25 10
  text "Lang. ID", 27, 42 152 25 8, center
  edit "", 28, 42 159 25 10, autohs
  text "Balloon", 29, 42 172 25 8, center
  edit "", 30, 42 179 25 10, autohs

  text "Actions", 31, 73 143 52 7, center
  list 32, 73 149 52 66, sort

  button "Exit", 999, 30 195 20 10, ok
}
alias mbrowse.init {
  var %Agent
  var %Agents
  set %Agent 1
  set %Agents $agent(0).char
  while (%Agent <= %Agents) {
    did -a mbrowse 2 $agent(%Agent).char
    inc %Agent 1
  }
  set %Agent 1
  set %Agents $agent(0)
  while (%Agent <= %Agents) {
    did -a mbrowse 5 $agent(%Agent)
    inc %Agent 1
  }
}
on *:DIALOG:mbrowse:sclick:3:{
  var %Agent = $did(mbrowse, 2, $did(mbrowse, 2).sel).text
  .gload $left(%Agent, -4) %Agent
  did -a mbrowse 5 $left(%Agent, -4)
}
on *:DIALOG:mbrowse:dclick:2:{
  var %Agent = $did(mbrowse, 2, $did(mbrowse, 2).sel).text
  .gload $left(%Agent, -4) %Agent
  did -a mbrowse 5 $left(%Agent, -4)
}
on *:DIALOG:mbrowse:sclick:6:{
  .gunload $did(mbrowse, 5, $did(mbrowse, 5).sel).text
  did -d mbrowse 5 $did(mbrowse, 5).sel
}
on *:DIALOG:mbrowse:sclick:5:{
  mbrowse.loadinfo %Agent $did(mbrowse, 5, $did(mbrowse, 5).sel).text
}
alias mbrowse.loadinfo {
  var %Action
  var %Actions
  did -ra mbrowse 9 $1
  did -ra mbrowse 11 $agent($1).fname
  did -ra mbrowse 14 $agent($1).pitch
  did -ra mbrowse 16 $agent($1).speed
  did -ra mbrowse 19 $agent($1).ow
  did -ra mbrowse 21 $agent($1).oh
  if ($agent($1).visible) { did -c mbrowse 23 }
  else { did -u mbrowse 23 }
  if ($agent($1).idle) { did -c mbrowse 24 }
  else { did -u mbrowse 24 }
  if ($agent($1).Effects) { did -c mbrowse 25 }
  else { did -u mbrowse 25 }
  if ($agent($1).active) { did -c mbrowse 26 }
  else { did -u mbrowse 26 }
  did -ra mbrowse 28 $agent($1).langid
  did -ra mbrowse 30 $agent($1).balloon
  set %Action 1
  set %Actions $agent($1, 0).anim
  did -r mbrowse 32
  while (%Action <= %Actions) {
    did -a mbrowse 32 $agent($1, %Action).anim
    inc %Action 1
  }
}
on *:DIALOG:mbrowse:sclick:23:{
  var %Agent = $did(mbrowse, 9).text
  if ($agent(%Agent).visible) {
    did -u mbrowse 23
    .ghide %Agent
  }
  else {
    did -c mbrowse 23
    .gshow %Agent
  }
}
on *:DIALOG:mbrowse:sclick:24:{
  var %Agent = $did(mbrowse, 9).text
  if ($agent(%Agent).idle) {
    did -u mbrowse 24
    .gopts -i %Agent off
  }
  else {
    did -c mbrowse 25
    .gopts -i %Agent on
  }
}
on *:DIALOG:mbrowse:sclick:25:{
  var %Agent = $did(mbrowse, 9).text
  if ($agent(%Agent).effects) {
    did -u mbrowse 25
    .gopts -e %Agent off
  }
  else {
    did -c mbrowse 25
    .gopts -e %Agent on
  }
}
on *:DIALOG:mbrowse:sclick:26:{
  if ($Agent($did(mbrowse, 9).text).active) { did -c mbrowse 26 }
  else { did -u mbrowse 26 }
}
on *:DIALOG:mbrowse:dclick:32:{
  var %Agent
  var %Action
  set %Agent $did(mbrowse, 9).text
  set %Action $did(mbrowse, 32, $did(mbrowse, 32).sel)
  .gplay %Agent %Action
}