Help requested with object interactions

Started by aureliendela, Fri 31/05/2013 12:48:54

Previous topic - Next topic

aureliendela

Hello,
I'm working on my very first game and I'm training on a "Test" game in order to gather sufficent knowledge.
But I'm facing an issue: I just can't interact with object when running the game: They are perfectly visible, are drawn in front of my character when he's behind them and hidden when he's walking over them, but even after I followed two different tutorials, I can't interact (can't look, can't pickup) even if I have fllowed the scripting instructions in the tutorial.
Please help !
Have a nice day, though.

Slasher

This may sound silly, but it has been done, have you actually entered any interactions into the objects events panel?

These interaction events (interact, look, talk etc) are built-in AGS functions and should NOT be just typed into the room script.

Process of elimination.


aureliendela

Look, when I swicth to the "Object" panel in the Room mode, it shows the key that I added, then I click on it and it display the object's properties panel. Then I click on the Event panel and they I click on the "..." button for "Look at object" and "Interact object".
it display the script sheet with the template I fill like this:

function TestKey_Interact()
{
  TestKey.Visible = false;
  cEgo.AddInventory (iKey);
}

function TestKey_Look()
{
   Display("A key. I wonder why is it in the middle of nowhere.");
}


Is that because the object ID is 0 ?
I'm lost :(

Khris

The key is really small, and you need to click on one of the pixels of the key, not just the rectangular area you can see in the room editor.
Also, the cursor hotspots are at the center of the cursors by default, so you'd have to move the eye's pupil or the hand's center above one of the key's pixels for the click to register.
I'd try adding the "pink poster" and testing that.

What you can also try is this:
-open gStatusline in the GUI section
-add a label to it using the label button in the top bar
-in the label's properties, enter this as text: "@OVERHOTSPOT@" (without the quotes)

Now in-game, the label should show whatever you have entered as the key's description when the mouse is hovering above it.

Phemar

#4
Also, have a look at your on_mouse_click function in the global script to make sure that mouse clicks are actually running interactions.

You should have something like:

Code: ags
function on_mouse_click (MouseButton button) {

  if (button == eMouseLeft)
    ProcessClick (mouse.x, mouse.y, mouse.Mode);

}

aureliendela

I tried with a larger sprite: no changes.
I checked the general script, which seems to be all right
And concerning the label thing: I don't even know what a label is or how to access the propeties.
I suck ! Please help !

aureliendela

Oh I'm sorry !
Actually, it was indeed a pixel issue. After mashing the leftclick, it finally worked.
Thanks you for the support, everybody !

Khris

Quote from: aureliendela on Fri 31/05/2013 18:38:37I suck ! Please help !
LOL :-D

First of all: chill :)

(I'm writing this assuming that you have started a standard default game, with Roger.)

A label is a way of putting text on a GUI.
-In the project tree, open the GUI node and double-click the entry called "gStatusline".
-in the bar at the top, look at the small icons. Hover over them with the mouse to see what they do.
-click the one marked "Add label"
-click and drag on the GUI (the long grey rectangle in the main window) to form a rectangle. You have just added a label
-in the properties window below the project tree, check the dropdown menu. It works the same as the objects one does in the room editor. The first entry is the GUI, below that are the controls. There should only be one additional entry, the label you just created.
-it should say something like "new something". If you can't read it, increase the size of the label by dragging the corners further apart.
-in the properties window, in the text field, remove what it says there ("new label" or whatever) and change it to "@OVERHOTSPOT@"; after you press enter or de-select the text field, it should also say that in the main window, on the GUI.

Now run the game again and move the mouse over the objects.

The other thing you can do is upload the game so we can take a look at it. You'd have to pack it into a single archive file (using Winzip, Winrar, 7zip, what have you) and upload it to mediafire.com or a similar file hoster, then post the download link here.

Edit: yay \o/ :)

SMF spam blocked by CleanTalk