requires AGS 2.71 or above
It's a real pain to script multiple responses to an action, sometimes. You have to go around declaring variables, put in bunches of if statements, etc. Not too much effort for one interaction, but if you're doing it for all of them?
SSH to the rescue with MultiResponse...
add a script action to your "interact with hotspot" for example and say:
Multi.Disp("No, I'm not touching that>No, I'm really not going near it>Look, for the last time, NO!");
And the first click on it will give you "No, I'm not touching that", the 2nd "No, I'm really not going near it" and the 3rd and subsequent clicks "Look, for the last time, NO!"
Great, I hear you say, but there's more!
The function returns which of the responses was given, so you can do something special:
int state=Multi.Say("I don't think I want to take any>I'd rather not>OK, if you insist>I've already got some");
if (state==3) player.AddInventory(iIckyGoo);
Full documentation at http://ssh.me.uk/moddoc/MultiResponse
Download MultiResponse module here (http://ssh.me.uk/modules/MultiResponse.zip)
UPDATED FOR v1.1:
Multi.Respond still does what it used to, but Multi.Disp is now preferred (I would have made it Display, but AGS won't allow it :( ) There is now also Multi.Say to use player.Say instead of Display, and Multi.SRespond which returns the string as GarageGothic suggested. Also new Multi.SLoop and Multi.SRandom which return a looping or random string respectively. There is also the current position in Multi.reponse and a "last response" detector in Multi.last.
UPDATED v1.2:
Added some v3.0+ support with extender functions
Nice idea!
How is the response displayed? player.Say speech text? Is there an option to use a simple Display text box?
Forgot to say. It uses Display at the moment. I'll probably add another function/option for using player.Say at some point...
It sounds great, should speed up some scripting times. I'll add it to my site.
Wouldn't it make more sense to let the function return the String that is being said, and then store the state in a global int? Then instead of Display, you could do things like:
player.Say(Multi.Respond("No, I'm not touching that>No, I'm really not going near it>Look, for the last time, NO!"));
if (respondstate == 3) player.AddInventory(iIckyGoo);
That's another possibility. I might make a new version that lets you do it eitehr way..
SSH, this is GREAT! Thanks so much for this.
Nice work.
Wow! It's like magic!
Quick question, SSH. Will this function support voice speech?
Without having looked at the current code, it should be quite trivial to allow voice support if the String is passed to Display (current) or Say. In fact the format should be exactly the same as now, so you just add the voice file numbers in the original String:
Multi.Respond("&1 I don't think I want to take any>&2 I'd rather not>&3 OK, if you insist>&4 I've already got some");
Then, if passed to Say rather than Display, the function would end up calling e.g. cBilly.Say("&1 I don't think I want to take any"), which would play the voice file BILL1.OGG and display the text "I don't think I want to take any".
Haven't tried it, but I think you're right, GG
I've made a v1.1 now, details in first post.
Edit:
I forgot to mention that the 1.1 version should be up to 100 times faster for big games now, as it uses a hash table to store data rather than just a single string
Great great great work!!!
This module is wonderful!
It will allow me to drown players in plethora of zany responses more easily! Also random!
Hooray!
This is proving to be most fun to use! However, I am noticing it acts a bit funky when it's used in the global script. If you use more than one in the global script, every "instance" gets increased when you use it. For example, let's say you have two inventory items, and since their look interactions are stored in the global script you'd have the following:
object 1:
response 1: "It's a magnifying glass"
response 2: "I said it's a magnifying glass"
response 3: "For the third time, it's a magnifying glass"
object 2:
response 1: "It's a toolbox."
response 2: "Nothing has changed since the last time."
response 3: "Actually, this toolbox has a false bottom"
Again, these are both in the global script. If you look at object one, you'd get "It's a magnifying glass", but then if you look at object 2, you'd get "Nothing has changed since the last time."
This only seems to happen in the global script.
Hmmm, did you download this right after I announced v1.1? I did have a buggy version that was a bit like that that I initially uploaded by mistake, but fixed the same day. So, try redownloading first. Also, can you check with 3 different items, not two. There is a cacheing mechanism to make it run faster and it used to check the "status" of the LAST item you looked at instead of the current item.
If that doesn't throw any light, I'll knock up a debug version.
EDIT: I've double-checked this. I've used this module in PMX and lookign at inventory items works fine and doesn't do what you say...
Sounds useful. I myself would have no use for it, but I can relate to having many frivolous variables to keep up with something as trivial as how many times one has glanced at a bookcase. Good job, as usual, SSH.
SSH: I redownloaded and now it seems to be working fine! Thanks for the info.
Hi
I would like too trigger an interaction when last message of a Multi.Sloop has been read.
How is it possible?
I think you meant to post in the MultiResponse thread, but the answer is:
if (Multi.last) {
// do stuff
}
Thanks :)
QuoteI think you meant to post in the MultiResponse thread, but the answer is:
This is no the multiresponse thread here?
added some extender functions for 3.0+ users...
I'm using this module, and it's so good...
but I can only imagine how great it would be when NPC's, not only the player character, could MultiSay...
Eh, dreams...
cWhoever.MultiSay("Whatever?>Whenever?>Why?");
Damnit!!
It was always there and I missed it?
You, mr SSH, are the Master Moduler!
Thank you.
someone have a valid link to download this module? SSH website's is broken :(
I think it should be included in the collection of Modules that Dualnames once posted.
Thread:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=41360.msg577567#msg577567
Module Pack:
http://www.maniac-mansion-mania.de/downloads/AGS/MODULES.rar
Quote from: Loslem on Tue 10/04/2018 08:26:42
I think it should be included in the collection of Modules that Dualnames once posted.
Thread:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=41360.msg577567#msg577567
Module Pack:
http://www.maniac-mansion-mania.de/downloads/AGS/MODULES.rar
woah! Love u guys! thank you so much