Scripting mushclient to edit locally

Posted by Jett on Sun 29 Jul 2001 02:28 PM — 3 posts, 14,217 views.

#0
i am a MOO user, and have set my account to edit locally. this means when i type @edit <object:verb> the server returns a string, followed by the programming for that verb, followed by a fullstop. I would like to send the program to the notepad, but i cant work out how to pass the multiple lines to a script, or even how a script can read in from the world. As an example:

@edit box:close
#$# edit name: box of kleenex:close upload: @program #25134:close
player:tell("You can't close it.");
player.location:announce(player.name," must be an idiot.");
.

then the notepad should contain

@program #25134:close
player:tell("You can't close it.");
player.location:announce(player.name," must be an idiot.");
.

is it possible?
Australia Forum Administrator #1
Yes, you can do this. You would need a couple of triggers:

One to match on "#$# edit name: *" - which indicates a program is coming, and another to match on "*" which is everything.

Something like this:

First trigger

Match on: #$# edit name:*:close upload: *
Enabled: checked
Label: StartProgram
Script: OnStartProgram

Second trigger

Match on: *
Enabled: not checked
Label: ProgramLine
Script: OnProgramLine
Keep Evaluating: checked
Sequence: 90

Add to script file (VBscript)


sub OnStartProgram (strAliasName, theoutput, ArrWildcards)
  World.EnableTrigger "ProgramLine", TRUE 
  World.ReplaceNotepad "Program", ArrWildcards (2) + vbcrlf 
end sub  

sub OnProgramLine (strAliasName, theoutput, ArrWildcards)
  World.AppendToNotepad "Program", theoutput + vbcrlf
  if theoutput = "." then
    World.EnableTrigger "ProgramLine", FALSE
    World.ActivateNotepad "Program"  
  end if
end sub



The subroutine OnStartProgram enables the second trigger, the one that matches on everything. Once enabled the second trigger will capture all incoming lines, and append them to the notepad window "Program".

The subroutine OnProgramLine keeps appending to the notepad window until a line containing only "." arrives, at which time it disables its trigger, and brings the notepad window to the front, so you can work on it.
#2
Thanks heaps Nick, it works a treat. you made my day! (:D)
jett.