|
demoneyoungblood Apprentice
Joined: 16 Dec 2002 Posts: 114 Location: USA
|
Posted: Fri Oct 22, 2004 1:55 am
Unsure how to create a script for the following |
I play an rp mud, and as it is rp, i would like to be able to use a few variables to generate more creative resposes so that its not the same thing over and over again... Right now says that end with . are state, etc... I want to create my own say channel so to speak with variable lists, and punctuation...
Here is an example...
say is aliased to emote btw...
say this is an example!
now... when i make that statement, i want the client to look at the punctuation at the end of the command, and locate a variable based on the punctuation...
ie: if endpunct="!" varlist=@exclaim
and then output something like
emote %item(@exclaim(1,#)) '%0'
to where i can create a much more interesting environment... i know its not a great example, but about the best way i can think of to show you what i meant. |
|
_________________ -Demone YoungBlood |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Fri Oct 22, 2004 7:53 pm |
A friend and I came up with this script on 5.55 years ago, but I've editted it slightly to work for you:
#ALIAS say {
#VAR message {%-1}
#IF (%rightback( @message, 1)="!") {emote maniacally cries, '@message'} {#IF (%rightback( @message, 1)="?") {emote confusedly asks, '@message'} {emote psychopathically sends, '@message'}}
} |
|
|
|
demoneyoungblood Apprentice
Joined: 16 Dec 2002 Posts: 114 Location: USA
|
Posted: Fri Oct 22, 2004 9:59 pm |
Worked perfectly, and I was able to add the %random calls to it, I was wonderring if there was a way of detecting the end most character. Thank you very much for the assistance :).
|
|
_________________ -Demone YoungBlood |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Oct 22, 2004 10:07 pm |
Danlo's script gives examples of detecting the end most character. Detection was present for '!' and '?', that should be enough for you to go on.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Oct 22, 2004 10:32 pm |
A more flexible example:
#ALIAS say {
#CASE %ismember(%rightback("%-1",1),"!|?|.") {emote exclaims, '%-1'} {emote questions, '%-1'} {emote says, '%-1'}
}
To add more punctuations edit the alias and change
this part "!|?|." but add it BEFORE the period and then add the {} case in the right spot. You want to keep your . as the last item as the normal say because that is the default as #CASE 0 returns the last case
example to add @ as Angry
"!|?|@|."
and between {emote questions} AND {emote says} ADD {emote snarls angrily, '%-1'} so the final example from above would become
#CASE %ismember(%rightback("%-1",1),"!|?|@|.") {emote exclaims, '%-1'} {emote questions, '%-1'} {emote snarls angrily, '%-1'} {emote says, '%-1'}
I've just about scripted out my mud so I am bored :P |
|
|
|
|
|