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 - Rub

#1
What about using a GUI Label, which does wrap text, then you make a button that is transparent (or made to blend in someway) over the GUI Label.
Below the GUI Label you just need something to fit your menu or background.
#2
@Khris

Thanks, I better start reading up on overlays in the manual then XD, can't say I've used them before.

Cheers!
#3
Quote from: heltenjon on Tue 12/12/2023 07:41:56
Quote from: Rub on Mon 11/12/2023 23:50:20I think the idea of having the item in every room might work somehow. But the scrip might get messy. If the player enters the room with iKey from room 1, then iKey2 can't be visible
and if the player drops the iKey, then iKey2 is visible, etc... I can already feel my head spinning trying to make that work.

No, the iKey is the key that is in your inventory. The Key you see on screen if it is lying around in the current room, must be coded as an object (oKey) or a character (cKey). If you want the key to be droppable in every room, it will be easiest to code it as cKey. What you do then, is that if you drop the key (lose iKey from inventory), you have cKey arrive in the current room at coordinates you set.

If you want to put the oKey (object that is limited to a room) in every room, you set it as invisible everywhere except where it starts out. Then you need to make it visible in the current room if iKey is dropped on the floor. Doable, but cumbersome.

Disclaimer: I have no experience with the parser template. This reply deals with the general AGS behaviour only.

Hey @heltenjon yes, sorry I didn't type the oKey or iKey last night. But I understand the differences.
True that it might be a bit tedious. But I will try nevertheless.
#4
@Khris

I don't have a function textBoxParser_OnActivate in the Global Script. All of those are under a function interface_click(int interface, int button) and then

Code: ags
Parser.ParseText(input); //parses the 'input' variable through our list of known words
  
//Place all global parser commands here! :)
  if (Parser.Said("quit [game]")) { QuitGame(1); }
    else if (Parser.Said("save [game]")) { SaveGameDialog(); }
    else if (Parser.Said("load [game]")) { RestoreGameDialog();}
    else if (Parser.Said("restart [game]")) { gRestartgui.Visible= true; Mouse.Mode= eModePointer;}
  else if (Parser.SaidUnknownWord()) { // if an unknown word has been said
  Display("Please use another word for '%s'.", Parser.SaidUnknownWord()); // %s will be replaced with the unknown word and printed on screen
  }
  else if (Parser.Said("drop key")){
    player.LoseInventory(iKey);
  }
  else if (Parser.Said("inv")) { ShowInv(); } //show inventory
  
  else if (Parser.Said("look key") && (player.InventoryQuantity[iKey.ID])) { 
    ShowInvCloseup(42, "This is the ugliest key you have ever seen."); //This shows a closeup of the inventory item Key when looked at. 42 is the number of the key sprite (not the meaning of life!).
  }
  
    else { //if none of the previous commands matched
  CallRoomScript(1); }

Thanks guys for all the input. @Crimson Wizard I will check that template out.

I think the idea of having the item in every room might work somehow. But the scrip might get messy. If the player enters the room with iKey from room 1, then iKey2 can't be visible
and if the player drops the iKey, then iKey2 is visible, etc... I can already feel my head spinning trying to make that work.

Cheers!

#5
Quote from: heltenjon on Mon 11/12/2023 03:04:58Items are in your inventory, while objects are visible (or not) in a room. You need to make an object in the room (oKey) which you turn invisible when the player picks it up, and visible when the player drops it.

So you should code that the oKey turns invisible and that the player gets the iKey. Likewise, if your player loses the iKey, the oKey gets its visbility turned on again. You also need another if to check whether the oKey is visible in this room before letting the player pick up the iKey.

Thanks, so obvious, I cannot believe I overlooked that.

Cheers!
#6
Hello friends

I'm trying to allow the player to drop an item from their inventory.

So far I'm working with if
Code: ags
 if (Parser.Said("drop key")){
    player.LoseInventory(iKey);



I've tried some other variations of this with no luck. For example placing this under the "Parser.ParseText(input); line in the Global settings. Also using player.LoseInventory(InventoryItem *item) <--- this one turned up errors I think are well beyond my understanding right now.

I've also tried static InventoryItem* iKey.GetAtScreenXY(int x, int y)

The manual suggests cEgo.LoseInventory(iKey); then directs me to Character.InventoryQuantity

But I could not figure out (without errors) where to place it  in the global  settings properly. I'm guessing I need to use the correct function, but I just can't think of which one it is.

I should mention, just in case, that my game has no characters visible in any room. Although they do exist. The way the player picks items is through the parser, which in the script triggers the item within a region which covers the entire room.

Thank you guys for any help, even if it's just direction.

*UPDATE*

Using else if (Parser.Said("drop key")){
    player.LoseInventory(iKey); within the Parser.ParseText(input);

The player indeed drops the item but now the item is nowhere to be seen, however the player CAN pick it up again. I'd imagine this has something to do with InventoryItem* iKey.GetAtScreenXY(int x, int y). Perhaps the items is being returned to a "hidden" place, or something along those lines. I should mention that after testing. If the player drops the key in a different room than where it was found, the player cannot recover it from there. It only works in the place were the object/inventory item was originally. However it doesn't visibly return to its starting place.

Any direction is appreciated!

Cheers
#7
Hi Khris

Yes the script in the global section of the template has this also

Code: ags
#sectionstart ShowInvCloseup
function ShowInvCloseup(int sprite, String description)
{
  gCloseup.BackgroundGraphic=sprite; //This changes the closeup sprite.
  gCloseup.Visible= true; //This turns the GUI on.
  Wait(1); //This just fixes an odd bug.
  DisplayAtY(130, description); //This is the closeup text description, displayed right below the closeup image.
  gCloseup.Visible=false; //And finally the closeup GUI turns off again.
  }

So together with the previous script I wrote there, it makes the ability to bring up a detailed view possible.
This is all from the template I have not written anything myself nor tried to implement it yet.
#8
So I actually did more digging.

Code: ags
else if (Parser.Said("look itemname") && (player.InventoryQuantity[iItem.ID])) { 
    ShowInvCloseup(number of the sprite for closeup,  "Add extra comment here."); 
  }
This  is a global command. Exactly what I was looking to do. Perfect.

To add the score.

I figured out how to add score after looking at something.

Code: ags
else if (Said("look [spoiler]boar's head[/spoiler]")) {
    Display("Its a [spoiler]wild Boar's head mounted on the wall[/spoiler], it looks...well preserved.");
    GiveScore(5);
But I don't know how to stop it from giving score. Like a exploit. Any ideas welcomed!

Cheers

#10
Hello guys!

Thank you in advance for any help.

I'd like to include code for  two things in order to advance development of my free game.

It is a text parser. So far I just need two things added to complete the main structure.

One is a high score and the ability to inspect items. Both in the way the SQ3  does it.

I've had no luck trying to use the manual for this. My Script is set to 3.2.1 compatibility since I've been using a template from an 
older version of AGS the whole time. So perhaps this has also caused some issues for me.

I also attached a GIF of the SQ3 inventory interaction I'm  speaking of.

Again, any direction at  all even so I can figure it out on  my own is appreciated. If in the end I truly understand the code involved
in this, then that's even better.

Any advice welcomed!

Cheers!



https://pasteboard.co/hGtLBjVTF1Io.gif[/img]]
#11
Hello!

Just to be clear, you want to be able to see the verbs while looking at the inventory, like this?

https://pasteboard.co/maAcuUDbX0re.png
SMF spam blocked by CleanTalk