Easy Dialog Problem(SoLvEd)

Started by Saemtyh1, Wed 09/04/2008 18:10:24

Previous topic - Next topic

Saemtyh1

Ok here it is call me silly... :P

This is my dialog
@1 What a wonderful day.
@2 What a crappy Day.
@3 I pooped my pants.

Here is the code.

function talk_score()
{
if Parser.Said("What a wonderful day.");
{
  GiveScore(100);
 


}

it give me an error...
Error (line 6): expected '('

What i want is 100 points for the first answer,  -100 for the second, and finally 1 point added for pooping your pants.  Then I want to exit the dialog. 

::)
Thanks for not calling me stupid in advance.

Ubel

I don't really know how parsers work or what exactly you're trying to achieve but there is one error in your code. In an if-statement you don't use the semicolon. Also, you need to put brackets around an if-statement. So in this case it would be:

Code: ags
if (Parser.Said("What a wonderful day.")) {

TwinMoon

If you're only using three preset answers you'd be better off using the dialog system (see the help file about it).

Saemtyh1

Thanks pablo that solved the error! ;D  But unfortunately it is not activating the topic.  I dont wat to put it in the global, or it will do it in every room.  I can get the dialog to fire off by putting it in.

function cEgo_Talk()
{
  dDialog0.Start();
}
In the global.asc

But then it doesnt go away no matter what choice i pick and its in every room!  Thats no good.

And HEY TWIN! If you diddnt want to help.  Dont post!  >:( I am using the friggin dialog system!  I read the G/D help file and it was informitive but useless for what  I need.   

I want to fire off my dialog right off the bat, as soon as the room opens, then give the dude three choices and reward him accordingly.  If there is an easyer way to add points to dialog please tell me.

I cant just add "dDialog0.Start();" to the top of my room either.  It says "unexpected dDialog0."  I know I need to go back to school, but dammit. 

I need a function that starts dialog, checks for the right answer and gives score.

The parser is only there because I thought I had no other way Of checking to see if he said that.  I have "show" and "say" both on so it shows you the the options and when you pick one he says it.  I just want to tack on some points thats all.  Ending it is also hard?

Khris

Do you know about the dialog script and its special commands?

TwinMoon

Quote from: Saemtyh1 on Wed 09/04/2008 19:15:58And HEY TWIN! If you diddnt want to help.  Dont post!  >:( I am using the friggin dialog system!  I read the G/D help file and it was informitive but useless for what  I need.

I don't know why I bother:
In the properties for the room, look for Enters room after fade in.
Add dDialog0.Start(); here:

Code: ags
function room_AfterFadeIn()
{
    dDialog0.Start();
}


An example of the dialog script:

// Dialog script file
@S  // Dialog startup entry point
return
@1
give-score 100
stop

and so on for all the answers there are.
For an explanation of 'give-score' and 'stop' read the G/D help file.

Saemtyh1

You bother because you have the answer.   ;) Thank you.   ;D Thats what I wanted to know!  You do have to have it inside a function.  I shall read more of the G/D help file in the future. 8) 

SMF spam blocked by CleanTalk