function dialog_request(int value) {
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
}
"int value" means that the value of the parameter (the "1" in "run-script 1") you pass to this function is stored in the integer variable named value.
With
if (value==1) {
you check if this variable is set 1 (i.e. "run-script 1" was used). The code enclosed in the brackets is then executed.
To check if "run-script 2" was used, you just have to check if value is 2. Thus you would do:
function dialog_request(int value) {
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
else // value is something else than the above
if (value==2) { // run-script 2 was used
// do stuff
}
// check for value==3 and so on
}
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
}
"int value" means that the value of the parameter (the "1" in "run-script 1") you pass to this function is stored in the integer variable named value.
With
if (value==1) {
you check if this variable is set 1 (i.e. "run-script 1" was used). The code enclosed in the brackets is then executed.
To check if "run-script 2" was used, you just have to check if value is 2. Thus you would do:
function dialog_request(int value) {
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
else // value is something else than the above
if (value==2) { // run-script 2 was used
// do stuff
}
// check for value==3 and so on
}