Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Mon 22/05/2006 17:54:12

Title: dialog_request help
Post by: on Mon 22/05/2006 17:54:12
Hi, I'm having a wee problem with dialog_requestage under AGS 2.7. I've read the manual thoroughly and it still doesn't explain what's going on here, I still don't get it. And to be honest, in all versions of AGS - I've never really understood, so perhaps this will finally help put my mind to rest the weirdness of executing this command.

In my dialog 0 script, I ask it at one point to Run-Script(1);

In my main game script, I have

function dialog_request (int mod)
{ blah
}

Now what confuses me is that the manual says that where I've put "int mod", I should put a number, like 1, 2 or 3 etc, so that in my dialog script I could put:

Run-Script(2)

and then effectively called dialog_request(2)

But that doesn't seem to work. I can't create a new function called dialog_request because it already exists.

So my main question is this, I want to call a brand new dialog_request script but I don't know how to do it. I really don't want to have to use GlobalInts and variables in that ONE dialog_request part - I just want to be able to manipulate my Run-Scripts(x) over and over so that the number in the X spot actually means something, and I don't have to name dialog_request "int mod" or "int what the hell" etc.

Could someone please explain to me how to work this? It'd be a great help :)

Thanks!
Title: Re: dialog_request help
Post by: strazer on Mon 22/05/2006 18:07:39

// dialog script

@1 // dialog option 1
player: Yo!
run-script 3 // runs dialog_request function and passes 3 as parameter value
stop



// global script

function dialog_request(int flubber) { // it really doesn't matter what you call the variable

  if (flubber == 1) { // if "run-script 1" called
    // do this
  }
  else if (flubber == 2) { // if "run-script 2" called
    // do that
  }
  else if (flubber == 3) { // if "run-script 3" called
    Display("Blah!");
  }
  // and so on

}


Simply searching the forum for dialog_request should have yielded similar results. :)
Title: Re: dialog_request help
Post by: Ashen on Mon 22/05/2006 18:36:30
This is also in the BFAQ (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#Running_regular_code_inside_dialog)
Title: Re: dialog_request help
Post by: on Mon 22/05/2006 18:49:15
Thanks strazer, thanks Ashen! I'll try and resort to less n00b tactics next time :) Still, what counts is you took the time to answer and not just delete it :D