What's wrong with this?
function dialog_request (int 1) {
if (value == 1)
{
// Takes the reporters away.
MoveCharacter(BBC,0,0);
MoveCharacter(BBCTWO,0,0);
}
The editor is saying this:
Error (line1) PE02: Parse error at "1".
If I remove the 1, it still says something of the dialog_request... Is it because of that I have one another dialog_request in the script?
Here's your problem.
Where it says :
---------------
function dialog_request (int 1) {
---------------
The 1 should be a variable word such as, talk. So change the code to this.
function dialog_request (int talk) {
if (talk == 1)
// Takes the reporters away.
MoveCharacter(BBC,0,0);
MoveCharacter(BBCTWO,0,0);
}
You can put any other word for the variable, talk is just an example.
It is not "function dialog_request (int talk)", it is "function dialog_request (int parameter)
That's not actually true, you can name the parameter whatever you want.
If dialog_request is not defined, then you probably missed a closing brace in the preceding function. If not, look up what the error was exactly.
Meh, that was his problem. A closing brace.
function dialog_request (int 1) {
if (value == 1)
{
// Takes the reporters away.
MoveCharacter(BBC,0,0);
MoveCharacter(BBCTWO,0,0);
}
}//This is the closing brace for the function. You forgot it in your original script
Hmm... sorry for any confusion I caused before.
I think I see your problem right here, it's that you're replacing the wrong items with "talk."
Replace the first INT and VALUE with talk (or any other variable word). So your code should look like this.
function dialog_request (int word) {
if (word == 1)
// rest of code
function dialog_request (int runscript) {
if (runscript == 1)
{Ã, Ã,Â
// Takes the reporters away.
Ã, Ã, MoveCharacter(BBC,0,0);
Ã, Ã, MoveCharacter(BBCTWO,0,0);
Ã, }
}
Maybe this?
Translation: | If, in your dialog, you choose to run the script #1, it takes the reporters away.
|
Hmm, now I understand more about the AGS language.
If it still don't work, catch me on MSN later today, and I'll see what's wrong... this seems like one of those things again which AGS does not know how to report where the problem is...
----- EDIT -----
Quote from: Tuntis on Sat 13/11/2004 18:58:47Is it because of that I have one another dialog_request in the script?
Yes, could be. Nest all your run-scripts under one dialog_request:
function dialog_request (int data) {
if (data == 1) {
// code for run-script 1
} else if (data == 2) {
// code for run-script 2
}
}
and so on...
So, like Ishmael says in the post just above yours,
QuoteNest all your run-scripts under one dialog_request
E.g.:
function dialog_request (int runscript) {
if (runscript == 1) {
// Takes the reporters away.
MoveCharacter(BBC,0,0);
MoveCharacter(BBCTWO,0,0);
}
if (runscript == 500) {
SetGraphicalVariable("Fakestreet 13", 1);
}
}
Then, any other
run-script x commands get added in there as more
if (runscript == x) conditions.
you cant have 2 different functions in the script with the same name, so you must merge the two functions into one, like:
function dialog_request (int runscript) {
if (runscript == 1)
{
// Takes the reporters away.
MoveCharacter(BBC,0,0);
MoveCharacter(BBCTWO,0,0);
}
else if (runscript == 500)
{
SetGraphicalVariable("Fakestreet 13", 1);
}
// more 'else if's for other values of runscript...
}
hope it helps : )
EDIT: d'oh! ashen was quicker : )
If you've got the newest release of AGS (2.62), you can use NewRoomNPC (CHARID, ROOM, X, Y),
e.g.
if (runscript == 1) { // Takes the reporters away.
NewRoomNPC (BBC, -1, 0, 0);
NewRoomNPC (BBCTWO, -1, 0, 0);
}
Otherwise, you'll have to change it manually,
e.g.
if (runscript == 1) { // Takes the reporters away.
character[BBC].room = -1;
character[BBCTWO].room = -1;
}
But, I'd recommend NewRoomNPC (), so try that first.
If it doesn't work, you can download AGS v2.62 from here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=17579.0).