ok so i am creating a dialog and i type the following:
run-script 1
in the tutorial it says the following:
run-script X
Runs global text script function "dialog_request", with X passed as the single parameter. This allows you to do more advanced things in a dialog that are not supported as part of the dialog script. The "dialog_request" function should be placed in your game's global script file, as follows:
function dialog_request (int xvalue) {
// your code here
}
so i go to script > edit global script and type the following:
function dialog_request (int 1) {
(and i insert my code here)
}
ok, i save it and now i am going to save the game...
now, here is where i get my proplem:
there was an error compiling your script. The proplem was in the Main script
error (line **): PE02: Parse error at '1
and now he takes me here:
function dialog_request (int 1) {
Can anyone help??? i have tried everything
Might I suggest removing the "int" from your script? IE:
function dialog_request(1){
//blah blah blah
}
or perhaps leave the int as xvalue?
function dialog_request(int xvalue){
//blah blah blah
}
I'm not sure, as I haven't done much work with dialogs yet, but, one of the two might be correct...
Okay. Very simple.
function dialog_request (int param)
Leave this as is.
Then for "run-script 1" Put
if (param ==1) {
//code here
}
Thats about the long and short of it. i personally think it isn't verywell covered by the manual, so don't be embarrassed.
Thanks a lot ;)
it works
but still, i cant put 'if' in it
oh well, thanks for the help ;)
Well, you can't mix dialog script with regular global script and neither can you do vice versa.
I forget the exact code for this, so I can't really help.
You could do a run script to check global ints to see if the merchant has something in stock, then RunDialog.
thanks, i will remember that,
thanks for the help
this is driving me crazy. i want an object to turn on at the end of the conversation. in my dialog script i have put:
run-script 1
and in the global script i wrote this from scatch:
#sectionstart dialog_request// DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int value) {
if (value == 1) {
//ObjectOn (4)
}
}
#sectionend dialog_request// DO NOT EDIT OR REMOVE THIS LINE
But nothing happens? any help is apreciated
The reason is obvious, as you did nothing in the function, since you commented the line in it, remove the // and it should work:
#sectionstart dialog_request// DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int value) {
if (value == 1) {
ObjectOn (4)
}
}
#sectionend dialog_request// DO NOT EDIT OR REMOVE THIS LINE
It also needs a ; at the end of it
yeah right
oh thanks loads i'll try it in a bit, where do i put the ; though?
function dialog_request(int value) {
if (value == 1) {
Ã, ObjectOn (4);
Ã, }
}
#sectionend dialog_request// DO NOT EDIT OR REMOVE THIS LINE
It goes in after the ")" to tell AGS that it has come to the end of a line, so anything after is a new statement.
// are comment lines. AGS will not read them; they are little notes for your benefit.
eg. ObjectOn(4); // the vase
thanks for your help. I got the item to swtich on just fine now. but when i tried to have another 'run-script' option in my dialog i messed up again. i wanted the characters view to change at the end of the conversation and I've got this in my script:
function dialog_request(int value) {
if (value==1) {
ObjectOn (4);
if (value==2) {
SetCharacterView (JAY, 4);
}
}
}
nothing happens, the veiw does not change.
i think it is suposed to be like this:
function dialog_request(int value) {
if (value==1) {
ObjectOn (4);
}
if (value==2) {
SetCharacterView (JAY, 4);
}
}
or this:
function dialog_request(int value) {
if (value==1) {
ObjectOn (4);
elseif (value==2) {
SetCharacterView (JAY, 4);
}
}
solved it. sorry my stupid fault. i was changing it to the wrong view number ::)