How can I let NPC Memorize all words and repeat what player said? (Solved)

Started by Meystari F, Tue 13/06/2017 08:20:22

Previous topic - Next topic

Meystari F

I'm working now on a very difficult code now.




This is the text from when Larry in the "Leisure Suit Larry 1" is in the shop (Quick Mart) where he can buy condom and other stuff. ,)

I know already I need to add this in the player interact when he touch the object.

Larry:
After looking around to make certain you're alone, you quietly ask the clerk if the has any available behind the counter.

The Clerk:
'Sure, we got lubbers!'

Narrator:
(Obviously you've hit his area of expertise!)

Clerk;
'What kind of lubber you want? Smooth or libbed?'


Now here is my problem. Larry has to choose the kind of condom

Then the Clerk ask Larry 

'Colored or plain?'

then the clerk ask Larry

'Lubricated or rough-cut?'

and again he ask Larry

'Striped or plaid?'

and for last time he ask Larry

'Peppermint or spearmint flavor?'

Then after that he says

'Oakie, doakie Meester!'

'Hey, everybody!! This weird-o just bought a peppermint-flavored, striped, lubricated, colored, libbed lubber!!!'


Now the question is how can I let the clerk in the shop memorize what the player choose.  But as you know we can say different word.
This also happens when Larry are calling on sex-line on the phone. And he is asked a question which player can choose whatever he wants.

I really want to know the code for this.  But I have tried. And this is what I have done so far for the phone sex-line code. I don't work very well but this is a least a good start right?  But I don't know what else I can do next when the phone rings back and when it has memorized what the player typed.

Code: ags
String Phonenumber = Game.InputBox ("Enter a phonenumber:");
if (Phonenumber.CompareTo("5556969" ) == 0) {
Display("'Hello, you have reached the National Hot Line Sex Survey. Please answer the following questions. There may be a wonderful prize waiting for you!!'");  
Display("'What is the name of your favourite sex partner?'");
}
String Phonenumber1 = Game.InputBox ("");
if (Phonenumber1.CompareTo("" ) == 0) {
Display("'What is the best part of your partner's anatomy?'");
}
String Phonenumber2 = Game.InputBox ("");
if (Phonenumber1.CompareTo("" ) == 1) {
Display("'What do the two of you like to do together?'");
}
String Phonenumber3 = Game.InputBox ("");
if (Phonenumber3.CompareTo("" ) == 2) {
Display("'What is the best part of your body?'");
}
String Phonenumber4 = Game.InputBox ("");
if (Phonenumber4.CompareTo("" ) == 3) {
  Display("'And, finally, name your partner's favorite object.'");
}
 String Phonenumber5 = Game.InputBox ("");
 if (Phonenumber5.CompareTo("" ) == 4) { 
 Display("'Thanks for participating. Your prize is...'");
 Display("");
 Display("Hum. Looks like they hung up on you. Oh well. It was probably a bummer prize anyway!");
 }
 String Phonenumber6 = Game.InputBox ("Enter a phonenumber:");
 if (Phonenumber6.CompareTo("2096836858" ) == 0) {
 Display("'Hello. a pleasant voice responds. 'Sierra On-Line.'");
 Display("'We're not open right now, but if you'd call during business hours (and stip using this pretend telephone), we would be happy to sell you a 'Leisure suit Larry Hint Book.''");
 Display("'Written by Al Lowe, the author of Leisure Suit Larry, you know it at least tries to be humorous. The answers are invisible, until you mark them with the special pen provided, so you never have to worry about inadvertently learning something you didn't want to know.'");
 Display("'Thank you for calling Sierra On-Line, and for your purchase of 'Leisure Suit Larry in the Land of the Lounge Lizards.' Good bye.'");
 Display("Such blatant commercialism turns you on. You make a mental note to purchase on of those great, Al Lowe Hint Books!");
 }
}

 

Khris

How are you getting player input? Only by typing into an input box?
What if the player types something other than the two options?

Anyway, here's example code.
Code: ags
String Ask(String question, String option1, String option2) {
  String input;
  while (true) {
    input = Game.InputBox(question);
    if (input.CompareTo(option1) == 0) return option1;
    if (input.CompareTo(option2) == 0) return option2;
  }
}

// to use this:
  String clerk = "";
  String texture = Ask("What kind of lubber you want? Smooth or libbed?", "smooth", "libbed");
  ...
  clerk = String.Format("Hey, everybody!! This weird-o just bought a %s, %s, %s lubber!", texture, ...);  // insert choices
  Display(clerk);

Snarky

If you're using text controls throughout the game, you should really look into the Parser API. It is very simple (even primitive), but it saves you from some of this work (in particular, it is useful if you want to treat a whole bunch of words as synonyms).

Apart from that, Khris already gave you the answer. Just save what the player said as a String variable, and use String.Format to insert it into later statements.


Meystari F

Thanks again Khris.
I have now a another question.
How can I let the clerk repeat the same words I have already chosen again when I go out and visit the shop again.


I used that code in a global script.

Code: ags
String Ask(String question, String option1, String option2) {
  String input;
  while (true) {
    input = Game.InputBox(question);
    if (input.CompareTo(option1) == 0) return option1;
    if (input.CompareTo(option2) == 0) return option2;
  }
}


And this when I talk to clerk.

Code: ags
String clerk = "";
  String texture = Ask("What kind of lubber you want? Smooth or libbed?", "smooth", "libbed");
  ...
  clerk = String.Format("Hey, everybody!! This weird-o just bought a %s, %s, %s lubber!", texture, ...);  // insert choices
  Display(clerk);


But when I want to go out I need him to say the same chosen words again.

I have tried this code again when player leaves room but it wont work. 

So what am I doing wrong?

Code: ags
 clerk = String.Format("Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s, %s lubber!", texture5,texture4,texture3,texture2, texture1);  // insert choices
  Display(clerk);







Mandle

Quote from: Fribbi on Sat 17/06/2017 14:56:09
So what am I doing wrong?

Code: ags
 clerk = String.Format("Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s lubber!", texture5,texture4,texture3,texture2, texture1);  // insert choices
  Display(clerk);


You have four %s but you have five "texture" variables.

Meystari F

oops. I have fixed that.

But I still have a problem with this.

Snarky


Meystari F

Like I said. I can't let the clerk repeat the same words I had chosen when I leave room.

Quoteclerk = String.Format("Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s, %s lubber!", texture5,texture4,texture3,texture2, texture1);  // insert choices
  Display(clerk);

Do I have to add this code again to get it to work?  I thought it was enough if I put this on the Main global script.

Code: ags
String Ask(String question, String option1, String option2) {
  String input;
  while (true) {
    input = Game.InputBox(question);
    if (input.CompareTo(option1) == 0) return option1;
    if (input.CompareTo(option2) == 0) return option2;
  }
}


And what code do I use if I wan the player to say whatever he wants to write and without options? You know when Leisure suit Larry phones to sex-line he could chose any kind of words and when he leaves the room screen and came back to same room screen the phone will suddenly ring and when Larry pick up the phone the woman in the phone says the same words what the player wrote. 

And lastly how do I make a custom GUI inputbox to work?


I'm sorry if my English is terrible for you to understand. But I hope you understood what I am asking for.

 

Snarky

Quote from: Fribbi on Sat 17/06/2017 19:45:16
Like I said. I can't let the clerk repeat the same words I had chosen when I leave room.

Quoteclerk = String.Format("Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s, %s lubber!", texture5,texture4,texture3,texture2, texture1);  // insert choices
  Display(clerk);

And it doesn't work HOW? What happens when your game gets to that point? If it won't compile, or if it crashes, what does the error message say? "It doesn't work" is not a helpful bug description.

Looking at all your different code snippets, my first guess is that all your texture1-5 variables are local within the function, rather than global (defined outside of any function). Variables that are defined inside a function disappear once you exit the function. If you want them to stick around, you have to define them globally.

QuoteAnd what code do I use if I wan the player to say whatever he wants to write and without options? You know when Leisure suit Larry phones to sex-line he could chose any kind of words and when he leaves the room screen and came back to same room screen the phone will suddenly ring and when Larry pick up the phone the woman in the phone says the same words what the player wrote.

You use a TextBox. In the editor for the GUI, in the TextBox's event pane, click to create an event handler for when the user presses enter (OnActivate). In that function, read the TextBox's .Text property and store it in a String variable, as before.

QuoteAnd lastly how do I make a custom GUI inputbox to work?

You follow the instructions in the manual.

Meystari F

QuoteLooking at all your different code snippets, my first guess is that all your texture1-5 variables are local within the function, rather than global (defined outside of any function). Variables that are defined inside a function disappear once you exit the function. If you want them to stick around, you have to define them globally.

Ok I understand. 

Khris

I would also urge you not to name them textureX but condomTexture, condomColor, condomTaste, etc, especially now that they're going to be global variables.

monkey0506

Quote from: Snarky on Sat 17/06/2017 20:37:24And it doesn't work HOW? What happens when your game gets to that point? If it won't compile, or if it crashes, what does the error message say? "It doesn't work" is not a helpful bug description.

Quote from: Fribbi on Sun 18/06/2017 15:16:32Ok I understand.

I lol'd.

Meystari F

Quote from: Fribbi on Sat 17/06/2017 14:56:09
Thanks again Khris.
I have now a another question.
How can I let the clerk repeat the same words I have already chosen again when I go out and visit the shop again.


I used that code in a global script.

Code: ags
String Ask(String question, String option1, String option2) {
  String input;
  while (true) {
    input = Game.InputBox(question);
    if (input.CompareTo(option1) == 0) return option1;
    if (input.CompareTo(option2) == 0) return option2;
  }
}


And this when I talk to clerk.

Code: ags
String clerk = "";
  String texture = Ask("What kind of lubber you want? Smooth or libbed?", "smooth", "libbed");
  ...
  clerk = String.Format("Hey, everybody!! This weird-o just bought a %s, %s, %s lubber!", texture, ...);  // insert choices
  Display(clerk);


But when I want to go out I need him to say the same chosen words again.

I have tried this code again when player leaves room but it wont work. 

So what am I doing wrong?

Code: ags
 clerk = String.Format("Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s, %s lubber!", texture5,texture4,texture3,texture2, texture1);  // insert choices
  Display(clerk);



QuoteLooking at all your different code snippets, my first guess is that all your texture1-5 variables are local within the function, rather than global (defined outside of any function). Variables that are defined inside a function disappear once you exit the function. If you want them to stick around, you have to define them globally.


Well laugh at me if you want, but I thought I would understood this but I was wrong. You know I'm still trying me best to learn on this. :~(

What I did I added this code you can see bellow when I wanted my player to talk to character. It worked fine!

But this code don't work when I want the clerk to say the same line (Hey, Meester!!' yells the clerk. 'I hope you enjoy your %s-flavoerd a %s, %s, %s, %s lubber!), when I step on a region.

So how do I define these code globally so the message which the clerk needs to says to player will always work when I look, touch, or whatever I will do to him, after I have typed in the input box my choices?

I admit I'm not very good on AGS coding. But I'm trying my best.

I promise I will add your nickname on my game when it is ready as a thanks for great help.:smiley:





monkey0506

Quote from: Snarky on Sat 17/06/2017 20:37:24And it doesn't work HOW? What happens when your game gets to that point? If it won't compile, or if it crashes, what does the error message say? "It doesn't work" is not a helpful bug description.



...and the search continues.

We can't help you if you're not describing what is actually happening and what you want/expect to be happening. (wtf) (wrong)

dayowlron

the only question I see you asking is how to make variables global?
There is a global section in the IDE. Look in the manual other features->Global Variables
Manual: http://www.adventuregamestudio.co.uk/manual/
If there is some other problem you are having please specify what it is.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Meystari F

Yes I have finally got this in this time.
And everything works now.  Thanks again.

I only had to remove the "String" after I have added these String in global variables.

instead for using
Code: ags
String clerk;


I only say
Code: ags
clerk;
  without writing "String" in the front.




I have finally learnt how to use this global variables now.

Case closed.

Meystari F

#18
Now I have another questions.

I'm working on a Quiz game which will be included in my game.

This code works only if I don't write nothing in the parser.

Code: ags
if (txtParserInput.Text.CompareTo("" ) == 0) {
Display("Whatever man!);



Yes I know this code works when you say the correct password: Rumplestiltskin

Code: ags
 if (txtParserInput.Text.CompareTo("Rumplestiltskin" ) == 0) {
Display("Correct!);


But what is the code for, if I want the player answer the question with any words he typed in as an answer?

Remember when Leisure Suit Larry make a phone call to the sex-line?
You could type any word you wanted in the parser and you always got a different reply.

After Larry leaves the screen and comes back the screen and answered the phones
the phones replied to you with the words player typed in the input parser.

I need to know the code for that.

???

Meystari F

Are this questions too difficult for you understand again? Or are many of you in summer vacation? :/

I found this old thread which could maybe help me.
The quiz module file in this thread are again gone. Are any chance if you Chris could upload it again? I would like to try it.

http://www.adventuregamestudio.co.uk/forums/index.php?topic=46049.msg618979#msg618979

Khris


horusr

I think the answer could be "rol" or "anyword". This is from manual's text parser part:

QuoteThere are a couple of special words you can use with the Said command. "anyword" will match any word that the user types in. For example, Said("throw anyword away") will match if they type "throw dagger away", or "throw trash away". "rol" (short for Rest-of-Line) will match the rest of the user's input. So, you might want to do:
Code: ags
if (Parser.Said("kill rol")) {
  Display("You're not a violent person.");
}


This way if they try to kill anything they will get the generic response.

Meystari F

No that is not the right answer.
because the game has to remember and repeat the word you typed in.

Lets just say if I ask this.   What is your name?   Your answer: Jon Jonsson (Or just any name you want to say)
and then I will next ask you.  What are you doing now?  Your answer: Nothing...(just type whatever you want to say).
And then again I will ask you.      What would you like to do?    You answer: play computer games (or just type whatever words you want to type)

Later the game will say to you after you have typed in the words of your choice. 

Hello, "Jon jonson", I see you are doing "nothing", I'm also very alone. Come with me and let's "play computer games"!

This is just like it happens when Larry make a phone-call in Leisure suit Larry 1.
   
So do you have any answer how to make a code for this?




Khris

Just create variables and use them, it's really not that hard. Don't just ask for code, try to understand how this works.

Assuming you created a global String variable called phoneName:
Code: ags
  phoneName = txtParserInput.Text;


Later, when you want to use the stored value:
Code: ags
  Display("Hello, %s!", phoneName);



Edit: Snarky posted what I should've posted earlier.

Snarky

Edit: Let me refer you to the title of this thread: "How can I let NPC Memorize all words and repeat what player said? (Solved)"

So you do the same thing we already explained earlier.

You're having the same problem as before: needing to store text input that you will then use later. Why would you think the answer is any different than it was the first time?

We can't keep telling you how to do the same thing over and over again, so when you ask again after we already explained it, that makes us want to give up, because clearly we're not getting through to you.

Meystari F

I'm very close to understand this now.

I'm using a custom GUI for the inputbox which I call gTextparser because the normal game.inputbox are too small to put in the questions.
So what code do I use to change it for my gTxtparser.

This code only works for the normal game.Inputbox.  Is there any way I can enlarge the normal game.inputbox so the question could fit in that inputbox ?


Code: ags
String Ask(String question, String option1, String option2) {
  String input;
  while (true) {
    input = Game.InputBox(question);
    if (input.CompareTo(option1) == 0) return option1;
    if (input.CompareTo(option2) == 0) return option2;
  }
}

[/s]

Nevermind that.   I have a better idea how I should make those question. I use the dialog.

Meystari F

I have finally found the right and final solution for my issue.

First Make a global String called Answer.
or add this in the main room.

Code: ags
String Answer ="";
String Answer1 ="";
String Answer2 ="";
...



After that I make a gui called gQuestion
Then I make a button called OK
and Textbox which I call txtParserInput.
I press on the OK button and add this code in

Code: ags
if (txtParserInput.Text.CompareTo("555-6969") == 0){
gQuestion.Visible = false;
Display("Hello, you have reached the National Hot Line Sex Survey. Please answer the following questions. There may be a wonderful prize waiting for you!!");
Display("What is the name of your favourite sex partner?");
gQuestion2.Visible = true;


Then I make a copy of that same GUI by clicking on Export GUI and after that I import it and name it gQuestion2 and gQuestion3 and so on.

Make sure you change the name on the buttons to Ok2 and OK3  and txtParserInput as txtParserInput2 and txtParserInput3

Then again click on the OK2 button and add this code.

Code: ags
Answer1 = txtParserInput2.Text;
gQuestion2.Visible = false;
Display("Any  question you want to ask");
gQuestion3.Visible = true;


And then you click on the Question3 and the button OK3
and add this code.

Code: ags
Answer2 = txtParserInput3.Text;
Display("Any  question you want to ask");
gQuestion4.Visible = false;


That's it!


And then finally whenever you want to display this message

Code: ags
Display("Whatever you want to say, %s,%s",Answer1,Answer2);


I hope this final solution will help others beginners on codings on AGS like I am.
But I'm too doing my best to understand and learn on AGS.

horusr

Congratz! But I believe there must be better ways than creating same gui again and again.

Meystari F

Perhaps true, but this is at least much easier in this way. I'm not a expert in coding.

Snarky



horusr

I think you can use just an integer and 1 gui for it. Like if int answer_count == 0 then store inputted text into answer1(well I also think you can use array of strings instead of multiple strings).
And this is probably not that good way but easier. I dont know much about text parser.

Meystari F

Quote from: horusr on Mon 24/07/2017 12:51:26
I think you can use just an integer and 1 gui for it. Like if int answer_count == 0 then store inputted text into answer1(well I also think you can use array of strings instead of multiple strings).
And this is probably not that good way but easier. I dont know much about text parser.

Please show me how.   What is the code?

QuoteI don't know much about text parser.
Me neither.
But this is the only room in the game I need to have a Questions with text parser included.
Because I want the player write his own answer on a text parser. That is way this was getting very difficult for me to write a code for it.
My whole game are not going to be text parser game. But just a little bit.



Meystari F

Quote from: Khris on Mon 24/07/2017 12:19:14
It's an egregious violation of https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

Hehe sorry that! But I had no other ideas how to solve this. No one here wanted to help me so I had to figure this out on my own way.


Ps. What does  "egregious" means?  Google translator are not helping me but it don't display the Icelandic words it.

horusr

Can you send full code to let me make changes on it? In spoiler tags?

Meystari F

Can't you use the code I showed above?

Spoiler


function Button15_OnClick(GUIControl *control, MouseButton button)
{
if (txtParserInput.Text.CompareTo("555-6969") == 0){
gSmokkur.Visible = false;
Display("Hello, you have reached the National Hot Line Sex Survey. Please answer the following questions. There may be a wonderful prize waiting for you!!");
Display("What is the name of your favourite sex partner?");
gSmokkur3.Visible = true;
}
}

function OK2_OnClick(GUIControl *control, MouseButton button)
{
phoneName1 = txtParserInput2.Text;
Display("Hello,%s",phoneName1);
gSmokkur3.Visible = false;
gSmokkur4.Visible = true;
}


function OK3_OnClick(GUIControl *control, MouseButton button)
{
phoneName2 = txtParserInput3.Text;
Display("Hello,%s",phoneName1);
gSmokkur3.Visible = false;
gSmokkur4.Visible = true;
}
[close]

horusr

I will try but you need to tell me where do you store normal answers and how you manage different questions.

Let's try:

Code: ags

String phone_name[3];
int answer_count;

if (txtParserInput.Text.CompareTo("555-6969") == 0){
gQuestion.Visible = false;
Display("Hello, you have reached the National Hot Line Sex Survey. Please answer the following questions. There may be a wonderful prize waiting for you!!");
Display("What is the name of your favourite sex partner?");
gQuestion2.Visible = true;
answer_count++;
}

phone_name[answer_count] = txtParserInput2.Text;
Display("Any  question you want to ask");
answer_count++;


kind f this code. It won't work probably and you don't need to create second GUI but I don't know how your code works.

Meystari F

This is just like in Leisure Suit Larry 1 when he make a phonecall.

Scroll to 9:35

Spoiler
I'm trying to remake Leisure suit Larry 1 but I'm going to include Icelandic language with that game.
[close]


Meystari F

Well I tried your code.  It did not work as I wanted it to be.

What happens is this. I don't have a chance to write the answer because all questions display in each time when I click Ok button.

horusr

Simple use if else if statement.

Code: ags
if (answer_count == 1) Display(question) ;
Else if (answer_count== 2) Display(other question); 

Meystari F

Well I tried. I won't work

Spoiler
Code: ags
String phone_name[5];
int answer_count;
[close]


Spoiler


Code: ags
function OK_OnClick(GUIControl *control, MouseButton button)
{

phone_name[answer_count] = txtParserInput.Text; 
if (answer_count == 0){
if (txtParserInput.Text.CompareTo("555-6969") == 0){
Display("Hello, you have reached the[National Hot Line Sex Survey.[Please answer the following[questions. There may be a[wonderful prize waiting for[you!!");
}
if (answer_count == 1){
  Display("What is the name of your favourite sex partner?");
}
else if (answer_count == 2){
Display("What is the best part of your partner's anatomy?");
}
else if (answer_count == 3){
Display("What do the two of you like to do together?");
}
else if (answer_count == 4){
Display("What is the best part of your body?");
}
else if (answer_count == 5){
 Display("And, finally, name your partner's favorite object?"); 
}
answer_count++;

}
[close]

Spoiler
Display("Hello, Larry! This is %s.[Why don't you forget this[silly game, and come over to[my place so we can %s?",phoneName1,Phonename2);

Display("After all, your %s has[always turned me on! So bring[along a %s and come play[with my %s! Bye, now.".Phonename3, PhoneName4,PhoneName5);
[close]

The second and the rest of the questions don't show up after the first question when I try to write in the Text parser box.
What am I doing wrong here?


Well I will stick with my plan of the solution. Since your solution isn't working for me.

horusr

well you have big if on top of every ifs and it won't work if answer_count is more than 0. Just remove first if. And please use insert code button.

Meystari F

Well I made some test demo video for you so you can see my progress.


Spoiler

PS. I know I forgot to turn that text box GUI off as you can see in this video. But this was only made to show you what my problem is.

Questions don't show up.

horusr

You can also change "please enter phone number" text. Did you remove that if I mentioned and tryed again?

Oh and, thank you for video, you are really going good. Did you take original game graphics?

Meystari F

Thanks.

Yes I use original backgrounds and everything else.

But I also made some change too. Like adding a label on the table where the clerk is.
And as you could see some words were in Icelandic. I could upload more demo from my game later but not now.

I going to try your solution again tomorrow. I don't have more time for this now. I have to get to work on my real job. :)

Thanks again for your help.

horusr

I am happy "if" I could help.
Have a nice work day(whatever your job is)!

Meystari F

I'm a paperboy. It is like a mailman. But I'm only mail morning papers and magazines.

But here is a just a little bit longer demo of my game. But as you can see there is still errors I need to fix.
But you can see I add some more funny things in this game just for fun.

Spoiler


horusr

Whay it is only half English?
I tried to play first game, one with larry 7 like graphics and Softporn Adventure, but never be able to finish it :D

Ah, and, yu have some cool job!

Meystari F

Well I haven't yet translate all of the English words.  There are many things I need to fix. But this was only made for you to show you my progress.  Of course there is lots more I have done. Maybe I will upload it later in this week. And thanks again.

horusr

Keep up the good work and thanks for showing!
If you stuck again you can allways ask to Khris, he will be happy to help(me? I am still a noob)

Khris

Since this is about reading a single line of textual input, AGS has a built-in function for that: Game.InputBox()

Here's how to use that for the sex survey:
Code: ags
String name, p_part, like, y_part, p_obj;

function OK_OnClick(GUIControl *control, MouseButton button) {

  String number = txtParserInput.Text;

  if (number.CompareTo("555-6969") == 0) {
     
    Display("Hello, you have reached the[National Hot Line Sex Survey.[Please answer the following[questions. There may be a[wonderful prize waiting for[you!!");
    
    name =   Game.InputBox("What is the name of your favourite sex partner?");
    p_part = Game.InputBox("What is the best part of your partner's anatomy?");
    like =   Game.InputBox("What do the two of you like to do together?");
    y_part = Game.InputBox("What is the best part of your body?");
    p_obj =  Game.InputBox("And, finally, name your partner's favorite object?"); 
    
    Display("Thank you for your answers. Bye!");
  }
  else Display("You let it ring a few times but nobody is answering.");
}


function blah() {
  Display("Hello, Larry! This is %s.[Why don't you forget this[silly game, and come over to[my place so we can %s?", name, like);
  Display("After all, your %s has[always turned me on! So bring[along a %s and come play[with my %s! Bye, now.", y_part, p_obj, p_part);
}


Even if AGS didn't have that function, or if you want to customize the look of it, the solution is to write a custom function and use that, exactly like I showed you in my very first reply in this thread.
Also note how this is instantly more readable due to proper indentation and descriptive variable names.

Meystari F

Thanks Khris for that. I will try this tomorrow.

Here is a another Video demo of my second game I am also working on.  And it is called "Quest for Heroes".

This is just a fan game for Quest for Glory fans.

Quest for Heroes  - Testing video.

Thanks again for this Khris.

Snarky

Khris, you'd set p_part twice and p_obj not at all. I fixed it using magic mod powers. Hope you don't mind.


Meystari F

Ok I have tested this.

Well the questions text line was too small for that inputbox.
But no worries. I edit that part and did this.

Code: ags
Display("What is the name of your favourite sex partner?")
 name =   Game.InputBox();
Display("What is the best part of[your partner's anatomy?");
 p_part = Game.InputBox();


This looks better in this way.

But I wish I could know how to get this works in custom inputbox instead of the normal game.inputbox.

Right now I'm having problem to display the last text after I have clicked on the hotspot I called "hPhone" once.

But as you know Larry has to leave the room and come back in the room
And he has to pick up the phone to get this reply from the sex-line number 555-6969

Code: ags
 function blah() {
  Display("Hello, Larry! This is %s.[Why don't you forget this[silly game, and come over to[my place so we can %s?", name, like);
  Display("After all, your %s has[always turned me on! So bring[along a %s and come play[with my %s! Bye, now.", y_part, p_obj, p_part);
}


All I have done is this .

Code: ags
function hPhone_Interact()
{
  if (Phonecall == 0){
gPhone.Visible = true;
  }
 else if (Phonecall == 1){
  if (HasPlayerBeenInRoom(16)) { 
 if (HasPlayerBeenInRoom(19)) {
gPhone.Visible = false;
String number = txtParserInput.Text;
String name, p_part, like, y_part, p_obj;
Display("Hello, Larry! This is %s.[Why don't you forget this[silly game, and come over to[my place so we can %s?", name, like);
Display("After all, your %s has[always turned me on! So bring[along a %s and come play[with my %s! Bye, now.", y_part, p_obj, p_part);
}  
  }
 }
}


But it is not working.  So what am I doing wrong in this time? Please help me with this.

Khris

Keep track of the survey state:
Code: ags
// room script

String name, p_part, like, y_part, p_obj;
int survey_state = 0; // not called yet

function room_Leave() // this has to be created/linked in the room's events!
{
  // upon leaving the room, if survey was completed, advance state
  if (survey_state == 1) survey_state = 2;
}


Now add a function for the survey to the room script:
Code: ags
function conduct_survey()
{
  if (survey_state == 0) {
    // ask questions here
    survey_state = 1;
  }
  else if (survey_state == 1) Display("some message about trying again later to get results");
  else if (survey_state == 2){
    Display("Hello, Larry! This is %s.[Why don't you forget this[silly game, and come over to[my place so we can %s?", name, like);
    Display("After all, your %s has[always turned me on! So bring[along a %s and come play[with my %s! Bye, now.", y_part, p_obj, p_part);
  }
}


When the player interacts with the phone, show the GUI:

Code: ags
function hPhone_Interact()
{
  gPhone.Visible = true;
}


handle the GUI's OK button click in the global script, but send it back to the room script
Code: ags
function OK_OnClick(GUIControl *control, MouseButton button)
{
  CallRoomScript(1); // 1 = phone call
}


Finally, in the room script, handle making a phone call:
Code: ags
function on_call(int param) {  // clicking OK calls on_call(1);
  if (param == 1) // phone call
  {
    gPhone.Visible = false;
    String number = txtParserInput.Text;
    if (number.CompareTo("555-6969") == 0) conduct_survey();
    else Display("That number is apparently out of service.");
  }
}


Also note how this is instantly more readable due to proper indentation and descriptive variable names.

Meystari F

You are a genius Khris ;-D

It works now!

Thanks again for the wonderful help.


SMF spam blocked by CleanTalk