|
asm Wanderer
Joined: 19 Jul 2004 Posts: 68
|
Posted: Sun Apr 01, 2007 2:30 am
Lisp script |
Hello all,
A friend of mine wants to create a character with a lisp, but he'd rather have a script than do it manually...So I told him there was bound to be one on the forum and I'd find it for him. Unfortunately, this does not seem to be the case. Could anyone help me write one? What I tried to do was adapt this:
Code: |
#ADDK DumbWords {some=sum|him=himz|get=git|should=shuld|money=muny|me=mez|thinking=tinking|i=mez|he=hez}
#ALIAS say {
#VARIABLE Temp "%-1"
#VARIABLE Temp %replace(%replace(%replace(%replace(@Temp," ","|"),",","|,|"),".","|.|"),"||","|")
#LOOPDB {@DumbWords} {#VARIABLE Temp %replace( @Temp,~|%key~|,~|%val~|)}
#VARIABLE Temp %replace(%replace(%replace(@Temp,"|"," ")," ,",",")," .",".")
~say @Temp} |
Into this:
Code: |
#ADDK DumbWords {s=th}
#ALIAS lisp {
#VARIABLE Temp "%-2"
#VARIABLE Temp %replace(%replace(%replace(%replace(@Temp," ","|"),",","|,|"),".","|.|"),"||","|")
#LOOPDB {@DumbWords} {#VARIABLE Temp %replace( @Temp,~|%key~|,~|%val~|)}
#VARIABLE Temp %replace(%replace(%replace(@Temp,"|"," ")," ,",",")," .",".")
%1 @Temp} |
Unfortunately, all it seems to do is convert every other s as long as it's not the first or last word. For example:
lisp say s s s s s » "say s th s th s"
lisp say s s s s s s » "say s th s th s s"
So, anyone know how I mgiht accomplish this? I'm pretty shaky on exactly how the replacing works, especially when it's nested so. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Apr 01, 2007 11:11 am |
Because you're only replacing one thing it should be fairly simple.
Try
#ALIAS lisp {say %replace( %-1, s, th)}
typing: lisp is this what you're searching for?
gives: say ith thith what you're thearching for? |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 01, 2007 11:17 am |
The problem also comes because you won't lisp s characters that are part of words, because they won't be bordered by pipes and so won't match in the #loopdb's replace function. Why can't you just do %replace("%-1",s,th) and use that in any aliases you want the output to lisp?
EDIT: Bah, beaten. Putting quotes around the variable does solve the comma issue with Guinn's script, though. |
|
Last edited by Fang Xianfu on Sun Apr 01, 2007 11:25 am; edited 2 times in total |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Apr 01, 2007 11:20 am |
Found a problem with that. If there's a comma in what you're trying to lisp then the alias doesn't work.
It works in CMUD fine, but the only way I could see to fix it in zMUD was by altering the alias to
#ALIAS lisp {lisp = %-1;say %replace( @lisp, s, th)}
I'm sure there's a better way, but this does work at least |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Apr 01, 2007 5:12 pm |
Guinn as Fang Xianfu said putting quotes around the "%-1" zmud won't have a problem with the commas.
|
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Apr 01, 2007 5:38 pm |
#ALIAS lisp {say %replace(%replace( "%-1", s, th),S,Th)}
to make it handle Upper case S as well. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Apr 01, 2007 6:35 pm |
Whoops, Fang got there with the correction as I was writing. I'm getting used to CMUD now, where it works fine ;)
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|