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 - Indrid Cold

#1
Thanks for the ideas!

I had thought to use a single custom property and make it a list, using a format like
Code: ags
{x}aaa|{y}bbb

Where x, y would be inventory ID numbers and aaa/bbb the relevant text for each item. I didn't think of using separate custom properties for each item, though.

What I was afraid of concerning the function method, was that the functions for characters and inv. items would get too big (as there would be an "else if" for most characters/items), and therefore it would take "too long" to execute repeatedly. If this is not an issue however, then I guess that method is viable as well.

In any case, thanks again for the suggestions. :)
#2
Hello everyone,

I've been trying to make a GUI that uses some elements from the one used in the Legend games Death Gate and Shannara. Specifically, I've had problems trying to make a different text appear depending on which inventory item is used on which thing.

For example, say there's a door in the room that's locked. If the player's active inventory item is a key, the text should say "Unlock door with key". If it's a hammer, it should say "Break door with hammer". If it's a magic wand, it would say "Make door disappear". And so on.

If there was a "mouseover" function for everything, it would be simple to define specific items and text for each thing (object, hotspot, character, invitem) but as there isn't it all has to go in repeatedly_execute, right?

For objects and hotspots that's not much of a problem, since they're unique to each room. There can be a function called there that checks the current object/hotspot and active inventory and returns the relevant line. Doing the same for characters and inv. items though means there has to be one global function, as they could be in any room, and I'm concerned it would be a problem for memory/performance issues.

Is there something I'm overlooking, or a simpler way to make this work?
#3
Hello everyone,
I'm trying to create an interface which shows a GUI when you right click on any object (including inventory items) and then lets you decide what to do with it by clicking on a button. All this works just fine so far, except when right-clicking on an inventory item, in which case the GUI appears but buttons do nothing.

I've tried to debug and found that the problem is in this piece of code:
Code: ags
function doAction(int x, int y, int actionMode)
{
	InventoryItem* it=InventoryItem.GetAtScreenXY(x, y);
	if(it==null)
	{
		ProcessClick(x, y, actionMode);
	}
	else
	{
		it.RunInteraction(actionMode);
	}
}


Using the debugger (breakpoint on that "if"), I see that even if I right-click on an inventory item, the expression "if(it==null)" evaluates as true! The problem seems to be the same (or similar) as the one in this thread, which is 3 years old and remains unsolved...

I'm positive that InventoryItem.GetAtScreenXY gets the correct X and Y that I originally clicked on, before the pop-up GUI appeared, as I've checked this with appropriate "Display" calls here and there.

Also, in another instance when I call InventoryItem.GetAtScreenXY (to display the item's name in a textbox, called in "repeatedly_execute()") it seems to work fine.

I think once someone finds out what the problem is I'm going to feel really stupid, but as of this moment I can't figure it out... Any ideas?

EDIT: I forgot to add that the visibility of the GUI where the inventory appears on is "Normal, initially on". It's supposed to always be displayed, at the bottom of the screen.

EDIT 2: Um, never mind. It turns out that InventoryItem.GetAtScreenXY was running before the action GUI disappeared, so it checked on this location on it, instead of the inventory GUI. I solved it by making the action GUI disappear before the call to doAction.
SMF spam blocked by CleanTalk