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

Messages - rockitship

#1
Great! I figured it was something along those lines, thanks alot for the detailed explanation. Next up are dialog trees.
#2
Thanks, that works great for 90% of my functions. Is there a global equivalent of CallRoomScript, or would I have to make a separate global yes/no button?

The situation i'm still having trouble with is for inventory interactions. Since they occur in the global script the CRS won't reach them. For now I have just created a craft station and tied the combining functions to that room.


So this is my working item combining code
Code: ags

function iTGlove1_UseInv()
{
  if (cEgo.ActiveInventory == iBattery)
  {
    if (cEgo.Room == 1)
    {
      gInventory.Visible = false;
      show_yes_no(eYNTGlove1);
    }
    else
    {
      gInventory.Visible = false;
      Display ("'Note to self, make screwdriver gloves' For now you should go back to your craftbench.");
    }  
  }
}


and then this is in the rooms on_call function
but I'd like this to run in the global script.

Code: ags

else if (vP == eYNTGlove1)
  {
    if (vYon == 1)
    {
      cEgo.LoseInventory(iTGlove1);
      cEgo.LoseInventory(iBattery);
      cEgo.AddInventory(iTGlove2);
      Display("The glove powers up, your arm starts to tingle.");
      gInventory.Visible = true;
    }
    else
    {
      gInventory.Visible = true;
    }
  }


ideally i'd like to be able to combine items anywhere, i.e. screwdriver gloves. Thanks again for tipping me off to function on_call, when I read CallRoomScript in the manual I didn't really understand it. Now i see possibilities.
#3
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