Re: Mushclient and Soundpack Development

You need to use lua audio. you need the plugin ID for it, and then you do ppi.load(blablablablablabla), all your triggers will then take the form of ppi.play("path", 0, vol, pan) where that first 0 is the sound slot, you get ten. Forgive me if the syntax is a bit off, I haven't done it in a while. Also, you want to make regex triggers wherever possible, because that way your triggers will not interfere or get crossed up with one another. A lot of packs use wildcard triggers, which is something like [* chat * which works just fine until someone says to you, I wanted to have a chat with Billy. Then your chat sound goes off.

You could of course clean this up a bit without using regular _expression_ triggers by just including more of the string, for instance, if your mud puts brackets around its chat channel, supposing it even has one, you could do [chat] *. You don't need that forward star in front of the chat, that's causing issues for people. Learning regex is a %*#$ing pain in the 4$$ so if you go that route, be prepared for it, but it does give you a lot of power and flexibility.

Let's say I wanted to buffer all chat messages using the chanelhistory.xml plugin. I didn't want to include the chat string, just the relevant bits, name, and message. You can format this however you'd like, I'll give an example. First, let's say our output from the mud when the chat channel is used takes the following form: [chat] Nocturnus says, "message"

Now we have some pieces of information needed to make a regular _expression_. Go in to your triggers list and hit add, then hit alt X to check that box so you don't forget, then alt T again to get back into the trigger, then type in the following

^\[chat\] (.*) says, "(.*)"$

Alright, so that seems crazy, right? but its not, let me break it down for you. The caret thing which looks like an inverted V means basically beginning of line, in other words, were asserting that this is the beginning of the matching line. Now, you may be asking yourself why are their backslashes in front of the brackets enclosing the chat. Well, that's because brackets are used in regular expressions to create a set. like this: p[aeiou]tter. Now, that regular _expression_ would match patter, petter, pitter, potter, and putter, not all of which are words, but you get the idea. So we need to escape those brackets, which just tells the thing, hey, we're not doing a set, we literally mean brackets, so don't interpret it as a set.

Also, why are there parentheses around parts of this _expression_? Parentheses have several meanings, part of which is to start a branch, so you could have (thing1|thing2|thing3), which means either this one, that one, or finally *that* one, not both, not all, but only one. That symbol in the middle there is the pipe symbol, commonly used in unix like operating systems to pipe things into and out of stdin and stdout. Anyway, for our purposes, the parens do another thing, they mark out what's inside them as things we can refer to as wildcards.

Now, let's move onto that dot star or dot asterisk syntax. The dot, or full stop means literally any character, remember that example with patter pitter, etc? it could also be written like this: p.tter In this case, it means literally any character can fill the place of that dot, not just vowels, and it will still match. The asterisk is a quantifier, it just means zero or more, and now that I think about it, since we want both those fields to be filled in, it would be more appropriate to change the asterisk to a plus sign, which is also a quantifier meaning one or more.

That covers everything for this example except for the dollar sign, which simply means end of line. SO, the caret is beginning of line, and the dollar is end of line. Notice how we included the quotes in the regex rather than just encapsulating them in the .*? I did it that way so the quotes would be left out of that second wildcard to give you flexibility to format it however you wish.

Now that that regular _expression_ is finished, you will want to go into the send box and do something like this, then you will go down two and change that combo box to script. Going back up in to the send, do the following:

history_add chat=(%1, %2)

The %1 and %2 are how you refer to those wildcards in the order they appear inside your regex. You can also format that however you wish, or if you don't want to format it, leave off the parens and delete everything inside them and change it to chat=%0. %0 is the entire matching line.

Now, one more thing, you will probably want to create a .lua file for your world which is part of our pack. This is where you link the external file to and is where you put the ppi.load method call. In this file you will want to do something like the following: global path=Getinfo(56) + "/worlds/aardwolf/sounds/"; But what is that Getinfo(56)? All that is saying is give me the path of mushclient's executable. After that we do what is called string concatenation, what that means is that we join multiple bits of info into one string, the + sign in lua is for that purpose, also for arithmetic addition, so its called an overloaded operator. We're basically forming a root so that we can use relative paths in the pack. We also leave it with a trailing / so that you don't have to prepend one to every sound trigger. The global in front of path is just saying I want to access this variable anywhere i.e. globally. So what this does is saves you a massive amount of typing. You could use it in a trigger like this. Let's say you had a folder structure in your Aardwolf/sounds folder that was like: combat, communication, general, etc. etc. etc. Your chat sound would be in communication, so in that example trigger earlier, you could add a line that looks like this: ppi.play((path+"communication/chat.ogg"), 0, 50, 50) and it would both play the sound and buffer it. I forget which one comes first pan or volume, I'd have to look inside luaaudio.xml to straighten that out but still... you get the general idea.
I'm sorry if that was too slow going or whatever, I don't know how much you know about programming and regex, not trying to be insulting or anything, just wanted to make something anyone should be able to follow. If you want more help with this, skype me or something, pm me and tell me here you sent one because  I never check them.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — General Game Discussion : Nocturnus via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : ironcross32 via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Nocturnus via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : ironcross32 via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : ironcross32 via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : ironcross32 via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Nocturnus via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : ironcross32 via Audiogames-reflector

Reply via email to