Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: SSH on Mon 21/08/2006 12:34:48

Title: MODULE: MultiResponse v1.2
Post by: SSH on Mon 21/08/2006 12:34:48
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
Title: Re: MODULE: MultiResponse v1.1
Post by: strazer on Mon 21/08/2006 14:04:35
Nice idea!

How is the response displayed? player.Say speech text? Is there an option to use a simple Display text box?
Title: Re: MODULE: MultiResponse v1.1
Post by: SSH on Mon 21/08/2006 14:37:57
Forgot to say. It uses Display at the moment. I'll probably add another function/option for using player.Say at some point...
Title: Re: MODULE: MultiResponse v1.1
Post by: jasonjkay on Tue 22/08/2006 12:36:41
It sounds great, should speed up some scripting times. I'll add it to my site.
Title: Re: MODULE: MultiResponse v1.1
Post by: GarageGothic on Wed 23/08/2006 18:25:11
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);
Title: Re: MODULE: MultiResponse v1.1
Post by: SSH on Wed 23/08/2006 18:37:15
That's another possibility. I might make a new version that lets you do it eitehr way..
Title: Re: MODULE: MultiResponse v1.1
Post by: Dave Gilbert on Wed 23/08/2006 19:26:12
SSH, this is GREAT!  Thanks so much for this.
Title: Re: MODULE: MultiResponse v1.1
Post by: Candle on Wed 23/08/2006 21:00:45
Nice work.
Title: Re: MODULE: MultiResponse v1.1
Post by: Kweepa on Thu 24/08/2006 02:55:10
Wow! It's like magic!
Title: Re: MODULE: MultiResponse v1.1
Post by: Dave Gilbert on Thu 24/08/2006 21:39:01
Quick question, SSH.  Will this function support voice speech?
Title: Re: MODULE: MultiResponse v1.1
Post by: GarageGothic on Thu 24/08/2006 22:37:51
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".
Title: Re: MODULE: MultiResponse v1.1
Post by: SSH on Fri 25/08/2006 08:27:35
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
Title: Re: MODULE: MultiResponse v1.1
Post by: Besh on Sat 26/08/2006 02:43:00
Great great great work!!!
Title: Re: MODULE: MultiResponse v1.1
Post by: Goldmund on Fri 08/09/2006 00:35:10
This module is wonderful!
It will allow me to drown players in plethora of zany responses more easily! Also random!
Hooray!
Title: Re: MODULE: MultiResponse v1.1
Post by: Dave Gilbert on Sat 09/09/2006 17:29:04
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. 
Title: Re: MODULE: MultiResponse v1.1
Post by: SSH on Sat 09/09/2006 22:59:57
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...
Title: Re: MODULE: MultiResponse v1.1
Post by: Akumayo on Sun 10/09/2006 05:41:22
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.
Title: Re: MODULE: MultiResponse v1.1
Post by: Dave Gilbert on Fri 15/09/2006 22:08:52
SSH: I redownloaded and now it seems to be working fine!  Thanks for the info.
Title: Re: MODULE: MultiResponse v1.1
Post by: riseryn on Fri 18/04/2008 16:13:53
Hi
I would like too trigger an interaction when last message of a Multi.Sloop has been read.
How is it possible?
Title: Re: MODULE: MultiResponse v1.1
Post by: SSH on Fri 18/04/2008 16:18:53
I think you meant to post in the MultiResponse thread, but the answer is:


if (Multi.last) {
  // do stuff
}

Title: Re: MODULE: MultiResponse v1.1
Post by: riseryn on Fri 18/04/2008 17:01:54
Thanks :)

QuoteI think you meant to post in the MultiResponse thread, but the answer is:
This is no the multiresponse thread here?
Title: Re: MODULE: MultiResponse v1.2
Post by: SSH on Mon 12/05/2008 14:53:35
added some extender functions for 3.0+ users...
Title: Re: MODULE: MultiResponse v1.2
Post by: Goldmund on Sat 24/05/2008 16:06:43
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...
Title: Re: MODULE: MultiResponse v1.2
Post by: SSH on Sat 31/05/2008 19:29:21
cWhoever.MultiSay("Whatever?>Whenever?>Why?");
Title: Re: MODULE: MultiResponse v1.2
Post by: Goldmund on Tue 01/07/2008 21:36:02
Damnit!!

It was always there and I missed it?

You, mr SSH, are the Master Moduler!

Thank you.
Title: Re: MODULE: MultiResponse v1.2
Post by: Narehop on Sun 01/04/2018 21:47:15
someone have a valid link to download this module? SSH website's is broken :(
Title: Re: MODULE: MultiResponse v1.2
Post by: 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
Title: Re: MODULE: MultiResponse v1.2
Post by: Narehop on Tue 10/04/2018 14:24:14
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