|
LordSoren Beginner
Joined: 01 Aug 2001 Posts: 12 Location: Canada
|
Posted: Tue Jul 23, 2002 10:26 pm
Talker Script |
On a roleplaying mud that I am currently playing on there is a dwarven race, and I went to http://www.delving.com/speak.html and downloaded their list of "dwarven" accented words, and was wanting to work this into a script. Generally what I would like to happen is this:
I would enter what I would like to say (dsay What is this about)
and it would reference a txt file and get the dwarven accented words (whit is this aboot) and send that to the mud in its place.
However I know little about Zmud scripting, and I do not know even if this would be doable. The format of the file is below:
about,aboot
after,efter
all,a'
along,alang
alright,a'right
and,an'
are,ur
aren't,urnae
around,roon'
ass,arse
Thank you for any help you might be able to give me on this problem.
Soren |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Jul 23, 2002 11:56 pm |
Try this alias:
#ALIAS dsay {#VAR message "";#LOOP 1,%numwords("%-1") {#VAR message %concat(@message, %if(%grep(1, %word("%-1", %i)), %word(%grep(1, %word("%-1", %i)), 2, ","), ""), " ")};#VAR message %leftback(@message, 1);say @message}
This assumes that the text file is already opened as filed 1 and that no word will appear twice anywhere in the text file (either the english part, or the dwarven part.)
Kjata |
|
|
|
LordSoren Beginner
Joined: 01 Aug 2001 Posts: 12 Location: Canada
|
Posted: Wed Jul 24, 2002 2:40 am |
Gah thats alot of nested statements, confusing as can be however it works...sorta. For single words your script seems to work fine, however should I look for words with 2 copies however one version longer than the first "can" and "cannot" for example, I run into problems such as:
dsay I cannot do the can-can
comes out as:
You say 'a'right|being dae|does thum '
I attempted to understand and modify your script, but modifying someone elses code is a pain in the butt. From what I understand, if you where to add a comma after the search for command, this problem would be elimnated (instead of searching for "can" search for "can,") I was unable to implement this idea however.
Here is the entire file:
about,aboot
after,efter
all,a'
along,alang
alright,a'right
and,an'
are,ur
aren't,urnae
around,roon'
ass,arse
ball,ba'
being,bein'
before,afore
belongs,belangs
between,a'tween
body,boady
bottle,boatle
but,bar
call,ca'
can,kin
can't,cannae
children,weans
cold,cauld
couldn't,couldnae
crazy,daft
dead,deid
deaf,deef
do,dae
does,diz
doing,daein'
done,doon
don't,donnae
down,doon
drunk,blootered
fart,feart
fellow,fella
floor,flair
foot,fit
for,fur
from,fae
fucking,fookin'
girl,girrel
give,gie
god,goad
going,gaun
got,goat
had,hid (or) hud
half,hauf
has,hiz
hand,haun
hang,hing
have,huv
having,huvin'
haven't,havnae
head,heid
herself,hersel'
himself,himsel'
hold,haud
home,hame
hour,hoor
hundred,hunner
I,ah
I'm,ahm
into,intae
isn't,isnae
I've,Ah've
just,jist
language,langweej
leave,lea'
little,wee
lost,loast
messy,manky
more,mair
mouth,mooth
my,ma
myself,masel'
no,nae
none,nane
not,no'
now,noo
of,'o
off,aff
on,oan
once,wance
one,wan
our,oor
out,oot
outside,ootside
over,o'er
own,ain
pissing,pishin'
poor,puir
put,pit
round,roond
shit,shite
shouldn't,shouldnae
small,wee
south,sooth
stand,staun
stop,stoap
stupid,stupit
them,thum
those,thae
thought,thaot
to,tae
toilet,cludgie
told,telt
too,tae
trousers,troosers
understand,understaun
wall,wa'
was,wer
wasn't,wiznae
were,wur
what,whit
with,wi'
world,worreld
would,wid
wouldn't,wouldnae
wouldn'tve,widnae
you,ye
you'd,ye'd
you'll,ye'll
your,yer
you're,ye're
yourself,yersel'
you've,ye've
Sorry for the spam...
Soren
PS, the **** are actually curses, and I suspect you can figure out their meaning... |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Wed Jul 24, 2002 4:25 am |
Those results occured because %grep returns a string list of all matching results. This requires us to add another step in which we compare the word we are translating against the first word in each pair of possible choices:
#ALIAS dsay {
#VAR message ""
#LOOP %numwords("-1") {
#VAR engword %word("-1",%i)
#VAR dwarword ""
#VAR choices %grep(1,@engword)
#FORALL @choices {
#IF (@engword = %word(%i,1,",")) {#VAR dwarword %word(%i,2,",")}
}
#VAR message %concat(@message,%if(%null(@dwarword),@engword,@dwarword)," ")
}
#VAR message %leftback(@message, 1);
say @message
}
Troubadour |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jul 24, 2002 4:33 am |
Ah-ha! Part of the problem is that grep is not case-sensitive. I expanded Kjata's code, so it is may be more readable in places. Added something to pick out and put back punctuation. As well as trying to cover the possibility that grep will return more then one line, while limiting it.
#ALIAS dsay {message="";#LOOP 1,%numwords("%-1") {word=%word("%-1", %i);#IF (%pos(%rightback(@word,1),",.;:!?")) {punct=%rightback(@word,1);word=%leftback(@word,1)} {punct=""};oword=%grep(1,%concat("^",@word,","));#IF (@oword) { #IF (%numitems(@oword)>1) {oword=@word} {oword=%word(@oword,2,",");#IF (%pos(" (or) ",@oword)) {oword=%word(@oword,%random(1,%numwords(@oword," (or) "))," (or) ")}}} {oword=@word};message=%concat(@message,@oword,@punct," ")};message=%leftback(@message,1);say @message}
If all goes well you should be up and running. |
|
|
|
LordSoren Beginner
Joined: 01 Aug 2001 Posts: 12 Location: Canada
|
Posted: Wed Jul 24, 2002 5:13 pm |
Well, let me say that I have no idea HOW it works, but it seems that Vijilante version of it works the best. The only problem I have encounted thus far is that the capitols at the start of a sentence are removed. "I am well" becomes "ah am well", however even with this limitation, it works beyond what I expected, thank you very much for your help.
Soren |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Thu Jul 25, 2002 4:08 am |
You can see if %proper() will work. Maybe 'say %proper(@message)' or maybe '#exec say %proper(@message)'.
Iljhar |
|
|
|
|
|
|
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
|
|