|
ShadowsPirate Beginner
Joined: 15 Jun 2007 Posts: 17
|
Posted: Fri Jul 27, 2007 11:20 pm
Word number convert to actual number |
So in the mud I play, instead of "Tom hands you 14 gold coins", it comes
out at "Tom hands you fourteen gold coins". And I was wondering if anyone
had a way to capture the words and change them to numbers.
At the moment I use this trigger
Quote: |
Pattern-(%w) hands you (*) gold coins.
Value-(put 10000 gold in pack;thank %1) |
But would like to get it so that I put in only the amount they gave me, isntead of
someone else's gold I may have. Thanks in advance, for anyone that can help. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat Jul 28, 2007 2:55 am |
A List Variable named numbers
#var numbers {one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen}
A database variable named HNumbers
#addkey HNumbers {twenty=20|thirty=30|forty=40|fifty=50|sixty=60|seventy=70|eighty=80|ninety=90}
#func getNum {%if( %pos( "-", %1)>0, %eval( %db( @hnumbers, %left( %1, %pos( "-", %1)-1))+%ismember( %right( %1, %pos( "-", %1)), @numbers)), %if( %iskey( @hnumbers, %1), %db( @hnumbers, %1), "")%if( %ismember( %1, @numbers), %ismember( %1, @numbers)))}
#alias showNum {#show @getNum(%1)}
Typing "shownum twenty-three" gives 23.
Obviously this needs more numbers added to it to be able to handle numbers higher than one hundred. For the purposes I built this for, it was more than adequate. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|
|
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
|
|