Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - rockitship

#1
Hello, I'm very new to AGS so I've been working very simply to get a feel for scripting. I am trying to create a yes no button for any situation. in this case giving the player the option to look closer or not, but really I want to use it for combining items and other interactions. I believe my problem has to do with something i don't understand about the blocking. The problem comes from the results trying to run simultaneously with the function bringing up the GUI.

First I created a GUI with two buttons, then made the yes or no function, imported the function, and made the global variable, and was able to get the question to appear at the appropriate time. Then I ran into a problem. At first clicking the button appeared to do nothing. clicking a second time would also result in nothing. When I take out the line that resets the variable back to neutral I get a different result. On the first try there is nothing, but on try to i get the original desired result at the same time as the GUI appears. Most likely because the variable was set from the first click.

so first the global script

function show_yes_no()
{
  vYon = -1; // this resets the variable back to neutral, and may be part of the problem
  gYON.Visible = true;
  mouse.UseModeGraphic(eModePointer);
}

function Yes_OnClick(GUIControl *control, MouseButton button)
{
vYon = 1;
gYON.Visible = false;
mouse.UseDefaultGraphic();
}

function No_OnClick(GUIControl *control, MouseButton button)
{
vYon = 0;
gYON.Visible = false;
mouse.UseDefaultGraphic();
}

then the room script

//sheets
function hsheets_Look()
{
  Display("A thread bare sheet that smells of mold.");
  Display("Look under the sheet?");
  show_yes_no();
  if (vYon == 1) Display("Eww");
  else if (vYon == 0) Display("Good idea.");
}

Thanks for taking a look.
SMF spam blocked by CleanTalk