Now i need help with Text parser when two chars in the same
-
- Verpackungs-Wegwerfer
- Beiträge: 76
- Registriert: 14.03.2006, 21:45
Now i need help with Text parser when two chars in the same
Its just a test I'm doing. But I'm trying to make it so you can Talk to NPC by typeing useing the Text parser It works real good But
only if one NPC is in the room at a time or they both talk GRRR
I been working on this for a few hours
When 2 NPC are in the same room both say someing and i only Want one of them to talk to me The NPC thats in Dialog Mode:
here some code
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request (int param){
if(cSyd.room) // If your in the room And what Char you are
{
if (Parser.Said("whats going on")) { // you Type
cSyd.Say("Whats going on"); // What you say
if(cBernhard) // NPC just a test // i want this NPC only to talk if I'm in Dailog with him
{
cBernhard.Say("Nothing Much"); // what they say
}
if(cDrfreddytest) // NPC the same // i want this NPC only to talk if I'm in Dailog with him
{
cDrfreddytest.Say("Takeing over the WORLD"); // and so on
}
}
}
I need to state that the one I'm talking to will only talk back
Im useing
// script for Character 106 (Dr Freddy Test): Talk to character
if(player.Room == cDrfreddytest.Room) // All Chars
{
dDrFreddy.Start();
player.FaceCharacter(cDrfreddytest);
cDrfreddytest.FaceCharacter(player);
}
// script for Character 4 (Bernard): Talk to character
if(player.Room == cBernhard.Room) // All Chars
{
dTalktest1.Start();
player.FaceCharacter(cBernhard);
cBernhard.FaceCharacter(player);
}
only if one NPC is in the room at a time or they both talk GRRR
I been working on this for a few hours
When 2 NPC are in the same room both say someing and i only Want one of them to talk to me The NPC thats in Dialog Mode:
here some code
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request (int param){
if(cSyd.room) // If your in the room And what Char you are
{
if (Parser.Said("whats going on")) { // you Type
cSyd.Say("Whats going on"); // What you say
if(cBernhard) // NPC just a test // i want this NPC only to talk if I'm in Dailog with him
{
cBernhard.Say("Nothing Much"); // what they say
}
if(cDrfreddytest) // NPC the same // i want this NPC only to talk if I'm in Dailog with him
{
cDrfreddytest.Say("Takeing over the WORLD"); // and so on
}
}
}
I need to state that the one I'm talking to will only talk back
Im useing
// script for Character 106 (Dr Freddy Test): Talk to character
if(player.Room == cDrfreddytest.Room) // All Chars
{
dDrFreddy.Start();
player.FaceCharacter(cDrfreddytest);
cDrfreddytest.FaceCharacter(player);
}
// script for Character 4 (Bernard): Talk to character
if(player.Room == cBernhard.Room) // All Chars
{
dTalktest1.Start();
player.FaceCharacter(cBernhard);
cBernhard.FaceCharacter(player);
}
- KhrisMUC
- Adventure-Gott
- Beiträge: 4674
- Registriert: 14.03.2005, 00:55
- Wohnort: München
First of all: indent your code. AGS even does it automatically. It'll make the code way more readable.
It's no wonder that they all talk back; e.g. if (cBernhard) will always be true, no matter in which room Bernard is or if you talked to him or not.
AGS has no way of knowing that you mean to check for the NPC by writing if (cBernhard), and since cBernhard!=null, the condition will be true.
There's only one dialog_request() to handle all parser input, so you'll need to distinguish between the NPCs by some way.
Using the parser in dialogs will call dialog_request with the number of the dialog as parameter.
We can use that to determine which char we are talking to.
If there's only one dialog per character, we can do this by checking param. If there's going to be more, depending on the game situation, we'll need a function.
It's not obligatory to use a separate function, but I like to keep things organized.
Adjust the SetNPC-function according to the numbers of the dialogs you've used.
Notice that in the character's talk-to interactions, it's not necessary to check the player's room. There's no way you could talk to a character that isn't in the player's room:You'll notice that I've indented the lines here, too. That's because the code window shows you the contents of a function.
And please: it's "taking" and "using", not "takeing" and "useing".
It's no wonder that they all talk back; e.g. if (cBernhard) will always be true, no matter in which room Bernard is or if you talked to him or not.
AGS has no way of knowing that you mean to check for the NPC by writing if (cBernhard), and since cBernhard!=null, the condition will be true.
There's only one dialog_request() to handle all parser input, so you'll need to distinguish between the NPCs by some way.
Using the parser in dialogs will call dialog_request with the number of the dialog as parameter.
We can use that to determine which char we are talking to.
If there's only one dialog per character, we can do this by checking param. If there's going to be more, depending on the game situation, we'll need a function.
Code: Alles auswählen
Character*npc;
function SetNPC(int param) {
// we use the dialog's number to set the npc:
if (param==1 || param==2 || param==10) npc=cBernhard;
if (param==3 || param==4) npc=cDrfreddytest;
...
}
function dialog_request(int param) {
SetNPC(param); // set the character we are talking to
if (Parser.Said("whats going on")) {
player.Say("What's going on?");
if (npc==cBernhard) npc.Say("Nothing much.");
if (npc==cDrfreddytest) npc.Say("Taking over the WORLD!");
...
}
}
Adjust the SetNPC-function according to the numbers of the dialogs you've used.
Notice that in the character's talk-to interactions, it's not necessary to check the player's room. There's no way you could talk to a character that isn't in the player's room:
Code: Alles auswählen
// script for Character 106 (Dr Freddy Test): Talk to character
player.FaceCharacter(cDrfreddytest);
cDrfreddytest.FaceCharacter(player);
dDrFreddy.Start();
And please: it's "taking" and "using", not "takeing" and "useing".
Use gopher repellent on funny little man
-
- Verpackungs-Wegwerfer
- Beiträge: 76
- Registriert: 14.03.2006, 21:45
Thank you for the help
Its not working at all The player speaks but the npc wont talk back
//Is this right
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
Character*npc;
function SetNPC (int param) {
if (param==1 || param==2 || param==10) npc=cBernhard;
if (param==3 || param==4) npc=cDrfreddytest;
///... <--- whats this
}
function dialog_request (int param){
SetNPC(param); // set the character we are talking to
if (Parser.Said("whats going on")) {
player.Say("What's going on?");
if (npc==cBernhard) npc.Say("Nothing much.");
if (npc==cDrfreddytest) npc.Say("Taking over the WORLD!");
// ...
}
}
Its not working at all The player speaks but the npc wont talk back
//Is this right
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
Character*npc;
function SetNPC (int param) {
if (param==1 || param==2 || param==10) npc=cBernhard;
if (param==3 || param==4) npc=cDrfreddytest;
///... <--- whats this
}
function dialog_request (int param){
SetNPC(param); // set the character we are talking to
if (Parser.Said("whats going on")) {
player.Say("What's going on?");
if (npc==cBernhard) npc.Say("Nothing much.");
if (npc==cDrfreddytest) npc.Say("Taking over the WORLD!");
// ...
}
}
- KhrisMUC
- Adventure-Gott
- Beiträge: 4674
- Registriert: 14.03.2005, 00:55
- Wohnort: München
Did you bother to actually read my post? Or did you just copy & paste the code? (You probably didn't, cause the indentations are all gone...)
The "..." in the SetNPC function suggest that you'll have to add your own stuff there.
Go to the dialog pane and note the numbers in front of the Conversation Dialog Topics. Which number is next to dTalktest1 (Bernard's dialog)? Replace the X with this number.
And "#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE" is supposed to go directly before "function dialog_request...", like this:
The "#sectionstart" lines are used by AGS to manage adding/removing its functions.
READ my posts. I can tell if you don't, and I'm not going to help any further if you refuse to do it.
And it bothers me that you obviously didn't make the least attempt to UNDERSTAND my code.
Say we are talking to Bernard. The dialog's number is 2 (I made that up as an example.)
We enter "whats going on" in the textbox -> dialog_request(2) gets called.
Inside dialog_request, SetNPC(2) gets called -> inside SetNPC, param equals 2 -> npc is set to cBernhard.
The function returns -> dialog_request continues to run.
The if Parser.Said stuff is true -> player says "What's going on?"
if (npc==cBernhard) is true -> npc (a.k.a. Bernard/cBernhard) says his line.
You apparantly did neither.khrismuc hat geschrieben:First of all: indent your code.
[...]
Adjust the SetNPC-function according to the numbers of the dialogs you've used.
The "..." in the SetNPC function suggest that you'll have to add your own stuff there.
Go to the dialog pane and note the numbers in front of the Conversation Dialog Topics. Which number is next to dTalktest1 (Bernard's dialog)? Replace the X with this number.
Code: Alles auswählen
if (param==X) npc=cBernhard;
The "#sectionstart" lines are used by AGS to manage adding/removing its functions.
READ my posts. I can tell if you don't, and I'm not going to help any further if you refuse to do it.
And it bothers me that you obviously didn't make the least attempt to UNDERSTAND my code.
Say we are talking to Bernard. The dialog's number is 2 (I made that up as an example.)
We enter "whats going on" in the textbox -> dialog_request(2) gets called.
Inside dialog_request, SetNPC(2) gets called -> inside SetNPC, param equals 2 -> npc is set to cBernhard.
The function returns -> dialog_request continues to run.
The if Parser.Said stuff is true -> player says "What's going on?"
if (npc==cBernhard) is true -> npc (a.k.a. Bernard/cBernhard) says his line.
Use gopher repellent on funny little man
Ausnahmsweise mal auf deutsch (Sorry, Sinitrena! ):
Jetzt nervt er auch im MMM-Forum rum:
http://www.maniac-mansion-mania.de/foru ... topic=76.0
http://www.maniac-mansion-mania.de/foru ... topic=78.0
Auch wenn er dort einen anderen Namen trägt, kann man sofort erkennen, dass es Rubacant ist.
Ich hab die MMM-User schon darauf vorbereitet.
Jetzt nervt er auch im MMM-Forum rum:
http://www.maniac-mansion-mania.de/foru ... topic=76.0
http://www.maniac-mansion-mania.de/foru ... topic=78.0
Auch wenn er dort einen anderen Namen trägt, kann man sofort erkennen, dass es Rubacant ist.
Ich hab die MMM-User schon darauf vorbereitet.
- KhrisMUC
- Adventure-Gott
- Beiträge: 4674
- Registriert: 14.03.2005, 00:55
- Wohnort: München
Posting like this will put a lock on your threads quicker than you can lie about using a different nick.
You even wrote "Mad House" when posting as Uancon, too, although that's the translation of "Tollhaus" which in turn is the german title of "Maniac Mansion"...
And I'm pretty sure that Mulle's well aware of your ability to use babelfish...
You need to understand that people are picking on you because you're acting like an immature troll yourself.
And about your desperate attempts to create an MM-game: I'm through with helping you.
It's like you've just received your driver's license and now want to win at Indianapolis.
Or like you've found out how the oven works and now want to open a three star restaurant in Paris.
Now add your complete stubbornness when it comes to accepting that you're aiming way to high, add the fact that you don't want to learn but instead expect ready-made, working solutions for every little problem of yours, and finally, add a bad attitude when posting here.
And you're wondering why Mulle is mad at you and warns others about you? Please.
You even wrote "Mad House" when posting as Uancon, too, although that's the translation of "Tollhaus" which in turn is the german title of "Maniac Mansion"...
And I'm pretty sure that Mulle's well aware of your ability to use babelfish...
You need to understand that people are picking on you because you're acting like an immature troll yourself.
And about your desperate attempts to create an MM-game: I'm through with helping you.
It's like you've just received your driver's license and now want to win at Indianapolis.
Or like you've found out how the oven works and now want to open a three star restaurant in Paris.
Now add your complete stubbornness when it comes to accepting that you're aiming way to high, add the fact that you don't want to learn but instead expect ready-made, working solutions for every little problem of yours, and finally, add a bad attitude when posting here.
And you're wondering why Mulle is mad at you and warns others about you? Please.
Use gopher repellent on funny little man
-
- Verpackungs-Wegwerfer
- Beiträge: 76
- Registriert: 14.03.2006, 21:45
- KhrisMUC
- Adventure-Gott
- Beiträge: 4674
- Registriert: 14.03.2005, 00:55
- Wohnort: München
This forum is there to help people who are stuck with difficult scripting problems and other AGS-related stuff.
It is NOT an automatic problem-solver for people who don't have a clue about programming.
The reason why there aren't more tuts about MM coding is simple: the source wasn't meant to go public by the time it was written.
It is an extension of Proskrito's LA-template and contains many things specifically included for MM Deluxe.
LucasFan published a stripped-down version which IMO wasn't supposed to contain the hunting functions in the first place.
Look, the scripting language AGS uses is similar to Java or C, and mastering it is a piece of cake, if you already are an experienced programmer.
I've started to program over ten years ago, that's why it took me "only" a few months to familiarize myself with AGS, and even I occasionally have a hard time figuring out how a certain thing is implemented best.
There is no quick way, unless you're some sort of programming prodigy who graduated summa cum laude from the university at the age of 14 and have been working in the MIT's cybernetics department since.
And to make this clear: you don't need "here and there", unless by "here and there" you mean "all over the place."
Like I said: put MMD2 aside for now, start making a small game from scratch, solve the "usual" beginner's problems by yourself or by looking at old forum threads and the manual, and when you feel you're experienced enough, get back to it.
You'll find that it's very rewarding to figure out (even basic) stuff on your own.
It is NOT an automatic problem-solver for people who don't have a clue about programming.
The reason why there aren't more tuts about MM coding is simple: the source wasn't meant to go public by the time it was written.
It is an extension of Proskrito's LA-template and contains many things specifically included for MM Deluxe.
LucasFan published a stripped-down version which IMO wasn't supposed to contain the hunting functions in the first place.
Look, the scripting language AGS uses is similar to Java or C, and mastering it is a piece of cake, if you already are an experienced programmer.
I've started to program over ten years ago, that's why it took me "only" a few months to familiarize myself with AGS, and even I occasionally have a hard time figuring out how a certain thing is implemented best.
There is no quick way, unless you're some sort of programming prodigy who graduated summa cum laude from the university at the age of 14 and have been working in the MIT's cybernetics department since.
And to make this clear: you don't need "here and there", unless by "here and there" you mean "all over the place."
Like I said: put MMD2 aside for now, start making a small game from scratch, solve the "usual" beginner's problems by yourself or by looking at old forum threads and the manual, and when you feel you're experienced enough, get back to it.
You'll find that it's very rewarding to figure out (even basic) stuff on your own.
Use gopher repellent on funny little man
Okay. These are my last sentences to you, Rubacant. And in contrast with you, I mean it serious!
It is true. I don't like the idea from your game, because it is, from my eyes, a bad copy from the original game. You want to make a kind of remake, which is much better and much more brutal than the original one. In other words: You just want to rebuild the original game in your imagination. But the consequence is that not everybody will be happy with your plans. Before you told me the story about your game, I already thought that you didn’t have any idea for an own story. And unfortunately, you had confirmed this. Then you showed us some of your backgrounds for the game. When I saw your pictures, I get a bad feeling about your coming game. Sorry, when I say that, but I thought you put your backgrounds in a dustbin first and scanned them in your PC later. They look really unprofessional. And when some people criticized your pictures, you began to offend them. I almost wonder why you didn’t get a warning from the administrators for this later, because your reaction wasn’t really okay.
And then there are your questions about the scripts from AGS. It is normal, when some people ask the users how a global int or a background-talk functions. But your questions aren’t really normal. You asked some people for some help. But you didn’t tell them what your real problem is. You only put the script in the forums with the hope that someone will correct your script, so that the game will function later. And that is not the real sense of the technical forum of this website. And khrismuc told you this exactly. You can’t suspect that someone should do your work anyway. So I can understand how Sinitrena, khrismuc and some other persons are feeling, when you perforate them with TOO MANY questions and favours. I always have the feeling through your replies that you don’t have any knowledge about AGS and that you only need a poor fool, who you should do your work anyway. And I don’t respect such a thing. So I feel sorry for these persons, whose you exploit out for your project. And that you don’t say “thank you” to the most persons isn’t really gentle. So don’t wonder why some persons make some fun about you.
When I made my first game, I worked with the AGS engine without any help from this or other forums. And I made a LITTLE game, because I hadn’t much experience to make a big project. Okay, I had some bugs in my first game, but I tried to learn the AGS script for myself. And through this I learned much more about the functions of AGS than through some questions (with a few exceptions)! I don’t take care, what you think about my games anyway, because I know, how much work I put in them. A few of them weren’t so brilliant, that’s true. But in the opposition to you, I didn’t exploit some people for my games. No, I respect and help them too. But you don’t do this. You only bleat the whole time, when some people don’t like or criticize your ideas. Okay, the warning in the MMM-forums wasn’t okay from me, of course. But I don’t want that the users should be attacked from you also. So I took this risk for myself. And that you attack me, because I just wanted to defend some people, is not a great wonder. In my eyes, you are a great egoist, who wants to become a great programmer about a game, which is just a bad copy of one of the brilliant adventure games of the 80s. But you make one thing clear; you can’t be a great programmer, as long you don’t collect experiences about AGS for your own and use the users to create your game. When you really want that someone should make your game, then simply click at the button “Make a Game” in AGS! Maybe it functions.
But I give you two friendly advices:
1. Begin with a little game. Through this you can collect some experiences about AGS much better than with a big game. Trust me! It is really better.
2. Build up a team of three till five people, if you really want to make a big game (like Maniac Mansion Deluxe). You work with some people, who have knowledge around the creating of graphics, the programming of a game or the creating of a good story. This could have a better effect to your project.
So, that’s enough. I don’t want to have anything to do with you in the future anymore. That you attacked me wasn’t really okay from you, because you broke one rule from the forums (again!!!). You should have luck that you don’t get a warning anyway. You were banned from the MMM-forums through your bad behaviour anyway. As long you don’t change your mind, you won’t get many friends, but fiends anyway. And that was my last advice for you!
It is true. I don't like the idea from your game, because it is, from my eyes, a bad copy from the original game. You want to make a kind of remake, which is much better and much more brutal than the original one. In other words: You just want to rebuild the original game in your imagination. But the consequence is that not everybody will be happy with your plans. Before you told me the story about your game, I already thought that you didn’t have any idea for an own story. And unfortunately, you had confirmed this. Then you showed us some of your backgrounds for the game. When I saw your pictures, I get a bad feeling about your coming game. Sorry, when I say that, but I thought you put your backgrounds in a dustbin first and scanned them in your PC later. They look really unprofessional. And when some people criticized your pictures, you began to offend them. I almost wonder why you didn’t get a warning from the administrators for this later, because your reaction wasn’t really okay.
And then there are your questions about the scripts from AGS. It is normal, when some people ask the users how a global int or a background-talk functions. But your questions aren’t really normal. You asked some people for some help. But you didn’t tell them what your real problem is. You only put the script in the forums with the hope that someone will correct your script, so that the game will function later. And that is not the real sense of the technical forum of this website. And khrismuc told you this exactly. You can’t suspect that someone should do your work anyway. So I can understand how Sinitrena, khrismuc and some other persons are feeling, when you perforate them with TOO MANY questions and favours. I always have the feeling through your replies that you don’t have any knowledge about AGS and that you only need a poor fool, who you should do your work anyway. And I don’t respect such a thing. So I feel sorry for these persons, whose you exploit out for your project. And that you don’t say “thank you” to the most persons isn’t really gentle. So don’t wonder why some persons make some fun about you.
When I made my first game, I worked with the AGS engine without any help from this or other forums. And I made a LITTLE game, because I hadn’t much experience to make a big project. Okay, I had some bugs in my first game, but I tried to learn the AGS script for myself. And through this I learned much more about the functions of AGS than through some questions (with a few exceptions)! I don’t take care, what you think about my games anyway, because I know, how much work I put in them. A few of them weren’t so brilliant, that’s true. But in the opposition to you, I didn’t exploit some people for my games. No, I respect and help them too. But you don’t do this. You only bleat the whole time, when some people don’t like or criticize your ideas. Okay, the warning in the MMM-forums wasn’t okay from me, of course. But I don’t want that the users should be attacked from you also. So I took this risk for myself. And that you attack me, because I just wanted to defend some people, is not a great wonder. In my eyes, you are a great egoist, who wants to become a great programmer about a game, which is just a bad copy of one of the brilliant adventure games of the 80s. But you make one thing clear; you can’t be a great programmer, as long you don’t collect experiences about AGS for your own and use the users to create your game. When you really want that someone should make your game, then simply click at the button “Make a Game” in AGS! Maybe it functions.
But I give you two friendly advices:
1. Begin with a little game. Through this you can collect some experiences about AGS much better than with a big game. Trust me! It is really better.
2. Build up a team of three till five people, if you really want to make a big game (like Maniac Mansion Deluxe). You work with some people, who have knowledge around the creating of graphics, the programming of a game or the creating of a good story. This could have a better effect to your project.
So, that’s enough. I don’t want to have anything to do with you in the future anymore. That you attacked me wasn’t really okay from you, because you broke one rule from the forums (again!!!). You should have luck that you don’t get a warning anyway. You were banned from the MMM-forums through your bad behaviour anyway. As long you don’t change your mind, you won’t get many friends, but fiends anyway. And that was my last advice for you!
-
- Verpackungs-Wegwerfer
- Beiträge: 76
- Registriert: 14.03.2006, 21:45
What you cant take my Crits Mulle The Maniac.
I think your game and Backgrounds Look very unprofessional and you CRIT me for useing sprites from MM and MMM Look at you.
And you offend Me in every post you post in.
I mean it serious! LOL LOL LOL
Come on now lets all feel sorry for Mulle The Maniac and takeup for him.
If i CRIT you! You start to CRY. When you read my post did you throw a TAMTRUM.
I think your game and Backgrounds Look very unprofessional and you CRIT me for useing sprites from MM and MMM Look at you.
And you offend Me in every post you post in.
I mean it serious! LOL LOL LOL
Come on now lets all feel sorry for Mulle The Maniac and takeup for him.
If i CRIT you! You start to CRY. When you read my post did you throw a TAMTRUM.
- TheRock
- Rätselmeister
- Beiträge: 2136
- Registriert: 21.05.2006, 19:13
- Wohnort: Berlin
- Kontaktdaten:
How often do we have to tell you that there really are no offenses.
And Mulle was not the one to open a thread for you to tell you that you are the one who has to grow up...
I mean I made a lot of stupid questions and i was critblabla too but you....
wow...
And Mulle was not the one to open a thread for you to tell you that you are the one who has to grow up...
I mean I made a lot of stupid questions and i was critblabla too but you....
wow...
"Er schaute mich an, als hätte ich auf einer Beerdigung gepupst"-George Stobbart, Philosoph
"Kreativität ist so lange in der Scheiße wühlen, bis man den Nugget findet!"-Peter Schindhelm, Kunstlehrer
"Kreativität ist so lange in der Scheiße wühlen, bis man den Nugget findet!"-Peter Schindhelm, Kunstlehrer