Help for WHAM - All solved

Started by WHAM, Sun 18/03/2007 09:44:41

Previous topic - Next topic

Ashen

Now, see, this is why I recommend people avoid the Interaction Editor like the plague. It's crap.

In this case, learning the difference isn't that hard - open the manual and look up an old command (e.g. SetCharacterView) and it automatically redirects to the current version. And as Khris said, you're already using some of the new style commands, so there mightn't be that much to relearn.
I know what you're thinking ... Don't think that.

WHAM

Yeah, I've been noticing more and more of these nes style commands, and I've started digging them up (but I still wont bother going back and changing them all... nonononono!) so I'll be using purely the new ones in the future.

Easier than I first thought!

The game is getting closer and closer to being done! Only about five more rooms need to be made (easy as I have ready bases made for myself now), and some soundwork (mostly ripping off half life 2 sounds etc) and the theres the voice acting part.

I hope I'll be able to post you guys a finished version of this game in a FEW month's time, unless I get stuck somewhere in the future, but then I'll just return here to bother you guys!  ;)
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

WHAM

Looked up a few threads that seemed like they were about the same thing, found nothing I could get to work.

Deal's this. I'm using a BASS game template as the basis of my game, and as the mouse cursor is moved to the top of the screen, the inventory pops up.

Problem: I have a main menu screen, where it would be very nice if the inventory stayed hidden, no matter what.

Any ideas on how to make the inventory stop popping up? Is there some way to disable the GUI, and enable it again later?

Tampered around with "gBassinv.Visible = false; " but no effect was visible.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

I guess the inventory is a "Mouse YPos" GUI, so according to the manual, setting Visible to false should stop it from popping up.

Where did you put "gBassinv.Visible = false;"?

Ashen

Yeah, more information needed. What template are you using, what have you tried, what are the GUI visibility type (YPos, Popup Modal, etc)...

If you're usng the BaSS template I'm thinking of (v1.1 - I think - from Skimbleshanks/AGS Resources), it's NOT a Mouse YPos GUI, it's done with a check in rep_ex. So, adding an extra check to make sure gMainmenu.Visible == false (or whatever it's called) before turning gBassinv on should work.
I know what you're thinking ... Don't think that.

WHAM

Using the "Beneath a Steel Sky (template 1.1).agt" template.

GUI script:

Code: ags

  if (interface == BASSINV)
  {
    if(game.num_inv_items <= game.num_inv_displayed)	// show all items
    {
      game.top_inv_item = 0;
    }
    else	// have more items than are displayed
    {
      if (button == 2)	// right
      {
        game.top_inv_item += 5;
        if(game.top_inv_item > game.num_inv_items - game.num_inv_displayed)
          game.top_inv_item = game.num_inv_items - game.num_inv_displayed;
      }
      else if (button == 1)	// left
      {
        game.top_inv_item -= 5;
        if(game.top_inv_item < 0)
          game.top_inv_item = 0;
      }
    }
  }


With my limited ideas on how to use the "gBassinv.Visible = false;" I tried using it in the room script basically. If I'm wrong, any advise would be appreciated.

If you need any more info just ask, but be specific too. I have no idea on how to make GUI:s yet, as I only saw hope for making a game when I found an easy to use template for the GUI.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Ashen

OK, that code is useless. As well as being out-of-date (due to the age of the template - interface_click has been obsolete since 2.7), it's not the right part. It deals with the controls on the GUI (the scroll arrows), not turning the GUI on or off.
That's the template I meant, though, so the answer is what I said: "it's done with a check in rep_ex." SO, open the Global Script to the repeatedly_execute function, and find a line that says:
Code: ags

if(mouse.y <= INVHEIGHT)


Changing that to:
Code: ags

if(mouse.y <= INVHEIGHT && gMainmenu.Visible == false)


(Or whatever the GUI is called) should work.
I know what you're thinking ... Don't think that.

WHAM

Cant test this out yet, but if I'm reading the code right here (doubtful but posible) wouldn't this make the inventory not work in the entire game, whereas I only need to turn it off in a certain room?

If I'm wrong and you have a moment to spend, would you mind clarifying a bit on what this actually does, so I can learn a bit about the GUI:s build and perhaps get some basics to make my own similiar ones in the future.

Thanks
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

The GUI doesn't scroll in but is turned in(visible), so I'm not sure if Ashen's code worked.

Replacing the line with
Code: ags
  if(mouse.y <= INVHEIGHT && player.Room != X)

should, however.
Just replace the X with the room number of the main screen.

GuiOn/GuiOff is old-style code for gGuiname.Visible=true/false and will simply change the visibility of the GUI.
So provided the command is used in the right way, gGuiname.Visible=false; won't necessarily turn if off for the whole game, no.

Furthermore, putting it inside an if-condition using == instead of = will only perform a check on the current status, not change it.

Ashen

Sorry, I misunderstood the question - when you said 'Main menu', I was thinking of like a 'Save/Load/Quit' one, that could be called up at anytime during the game. If it's just visible in one room, Khris' code is the way to go. My code works fine for what it was meant to do, however - stop the Inventory GUI from being visible when gMainmenu is on, but let it show at any other time. (I know it works, because coincidentally I'm working on an update to the BASS template including the 'Save/Load/Quit' GUI that's missing from the older one, and that's pretty much the code I'm using.)
I know what you're thinking ... Don't think that.

WHAM

HAA!!!

Khris, you have just made my day!

Am I correct in believing that adding a
Code: ags

if(mouse.y <= INVHEIGHT && player.Room != X or player.Room != Y)

would make it possible to add more rooms to the list? This way Icould be sure that the inventory wont pop out accidentally during the game's intro or outro.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

Jup, that's it.
The exact syntax would be:
Code: ags
if (mouse.y <= INVHEIGHT && player.Room != X && player.Room != Y)


Though I'd code it like this:
Code: ags
int ro=player.Room;
if (mouse.y <= INVHEIGHT && !(ro==4 || ro==5 || ro==7))


- !(..) means NOT ..
- or is done by ||

WHAM

Quote from: KhrisMUC on Thu 19/04/2007 15:04:02
- or is done by ||

I'll have to remember that. My most basic programming goes back to Pascal, that I think used "OR", and that's stuck on me. I'll have to dig up the proper java counterparts somewhere, and print them out.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris


WHAM

Quote from: KhrisMUC on Thu 19/04/2007 21:48:34
Although it probably doesn't matter, I'd rather use AGS's manual for reference ;)
http://www.adventuregamestudio.co.uk/manual/Operators.htm

By the way: Have I been correct in my beliefs that AGS uses Java as its script language. I have a shallow experience in Java, and AGS script seems (at least for its "if" sentences) to be the same. Or are there differences? Should I keep studying Java and AGS separate, or combine them?
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

Study Java to program Java, study AGS to script something in AGS ;)

They are very similar and AGS's scripting language is heavily based on Java, at least syntax-wise. But there are of course many restrictions to AGS's language, as in it's meant to script adventure events only.

There's e.g. no "new" keyword in AGS.

Edit: Added emphasis.
@dkh: Compared to languages like BASIC, AGS & Java are practically identical, don't you think?

DoorKnobHandle

Er, I don't know much Java, but I program in C++, and AGS-script is very similar to C++ and much less to Java, in fact I wouldn't call Java and AGS-script similar at all.

WHAM

I return once more to siphon your endless wisdom!

I have conversations that take place through a radio, that is located on the players  (cEgo) person.

Is there a way to have messages appear above the player character, as if he was talking, except that the text colour is different and the character does not enter the talking view? (There's voices inside his head!)

Thank you.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

Use an invisible character which is the same height as the player's and let him do the talking.

WHAM

Quote from: KhrisMUC on Wed 02/05/2007 17:51:26
Use an invisible character which is the same height as the player's and let him do the talking.

Ummmm... Have this invisible character appear at the players coordinates and then make the talking happen?

Invisible character? Make a character that's only view has only one colour: transparent?

Same coordinates? Wont the game not allow the two characters stand on the same coordinates?
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

SMF spam blocked by CleanTalk