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

#1
Quote from: Crimson Wizard on Fri 19/04/2013 12:35:38
Hmm, probably this:
Code: ags

GUIControl *ctrl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (ctrl == gInvWindow /* use your actual inventory gui script name here */)
{
   // do something
}


Sorry for the late reply. I've been trying to implement dialogues and finishing off a few other rooms. The submission for a prototype is in a few hours so I'm pretty swamped. Anyways, when I try to use this code it gives me an error and says that it
cannot convert 'GUIControl*' to 'GUI*'

I've pasted it in the repeatedly_execute function.

EDIT:

Okay, i changed it to GUI from GUIControl and it started working. But, there's a new problem now. When you end up selecting at item from the inventory window, it's supposed to switch to the cursor mode for that item.
However, since the mouse is on the inventory when you select it, the code executes and turns it into eModeInteract again.

EDIT 2:

Okay, never mind. Turns out, all I needed to do was add a code which checks if the character's current active inventory is null or not with a simple If statement and then execute the code accordingly.
No more errors. :) :-D
#2
This is excellent. I'll try using the general method.

One more query, if you don't mind -

Some of my hotspots take you to a different room while others initiate pick up events or interacting with characters. Is there a way to tell the code what "type" of hotspot it is and get it to differentiate cursors for the different types?
Also, I have an always on Inventory System. So what I need is for the cursor to automatically change to the interact icon when you hover over the GUI with the inventory system, It only covers the top 110 pixels of the screen.
#3
I tried looking for it everywhere but couldn't find the answer. The thing I'm trying to do is have the mouse cursor change automatically over certain objects.

For example, if the cursor mouses over an object, it changes to an interact button; if you mouse over an area transition hotspot, it changes to a WalkTo icon, etc.

However, while it works well enough for the hotspots, I can't get it to work for objects, the primary reason being that objects don't seem to have  Mouse Over event. Is there a way to do it without the Event or should i start drawing hotspots around the objects to simulate the effect?

EDIT

Also, while I'm at this, I'm finding the giant part of Global Script to be a big mess as it contains stuff related to Mouse Wheel North, Middle Mouse Click and other stuff I do not want and just keeps interfering with the game mechanics.
What should I replace all of this with so that the "Any Click" event of every kind of hotspot, object, etc. can be tied to the Global Script?
#4
Yeah, still using the default mouse click code.

Also, I tried putting line 2 at the top and the rest with the interact command and it still gives me an error. Should I try using List Boxes? She only has 2 fixed items so maybe I can fake them as part of the UI when she gets them?
#5
It's still giving me the error. Maybe I didn't do it properly. I put it at the top of the code before any function and it gave me the following error -

GlobalScript.asc(5): Error (line 5): cannot assign initial value to global pointer

And when I put it right after the game_start function, I still get an error. Even after removing the "==" with a single one, the game runs okay but if I try using her item, it crashes again.

I've limited her to carrying just 2 items now. So will the other method work better or was i just messing up with the code?
#6
Okay yeah, the second issue's resolved now. Thanks.

As for the first one, I am making new interfaces for everything but have only gotten to the graphical aspect of them so far. Most of the code in the global.asc is from the default game that AGS creates. However, I think I'll remove the code for all the cursors save for one as what I want is for the cursor to automatically change depending on the situation.
There won't be the need to scroll between Walk, Talk, Interact, etc. Ex. when you hover over a walkable area, the cursor automatically changes to the walk one and when you hover over interactive ones, it changes to the hand icon.

How would you recommend using the one in which you temporarily transfer it to the player's inventory before setting it active?
#7
Thanks a lot, guys. I got it working finally but ran into another problem.
I posted it here - http://www.adventuregamestudio.co.uk/forums/index.php?topic=48042

Thanks for the help with this GUI!
#8
I have another query regarding the inventory system. I had asked earlier how to implement an always present Inventory Screen and I figured it out thanks to your help.
(Source: http://www.adventuregamestudio.co.uk/forums/index.php?topic=48040)

In my game, there is a second character who always walks with the first one and as you pick up items, some go to your inventory while some go to hers. There are some situations in which you have to use her items.
However, in AGS, when I try doing that, it tells me that it's not my main character's items and crashes.

Is there a work around for this?

P.S. this isn't related to the main problem at all but I'm also having some problems with the mouse cursors. I have a puzzle in which you have to takes items from the inventory and put them in very specific places on the room. For that, the cursor needs to change to an image of the item so you know exactly where to put it.
For this, I made a mouse cursor and gave it the same image as the inventory item. Here's the script I used in global.asc -

function iP1_Interact()
{
  mouse.UseModeGraphic(eModeP1);
}

Now the cursor works fine on it's own. I put it's StandardMode to True and was able to switch to and fro but it doesn't function properly like it's supposed to by the script. Any suggestions as to what I might be doing wrong?
#9
Yeah, basically, at any time, the player will have a maximum of 6 objects in the inventory.

So my only option is the trial-and-error method of making sure that the image fits nicely? Okay, thank you for your time and input.
#10
Well, I thought that instead of an actual Inventory Screen, I could fake it by keeping invisible buttons and labels and tying the images of the items with them when I needed to.

I still don't understand how the InvScreen GUI properly works so I thought I couldn't do it like how I wanted. The following image shows how I want the Inventory to look like -



Basically, the Inventory item will pop up on top of the grey ovals in order any time you pick something up. Can you please tell me how exactly to implement that?
#11
Greetings,

I've been trying to do a custom Inventory Screen for an adventure game in which the Inventory Window can hold a maximum of 6 objects at any time and this inventory screen is always visible in the game.
So it's basically the entire width of the game screen and around 110 pixels in height at the top of the game screen with 6 item spots. Any time you pick up an object, it get's added to one of these slots. Should I make an Inventory Window and then script it so that it appears how I want or is there another way to do it involving labels and buttons?

#12
Okay, I got it working. Problem solved.
Much obliged for the information and help.
#13
Thank you for the quick reply.

For point 2, wouldn't that make the character crawl to the point? I need something like a teleportation so that the character instantly moves there and then shifts to the different view.
For 3, apologies, instead of area, i meant to say room. So that when you use the ChangeRoom command, it returns to the default view.
#14
I recently started work on a side-scrolling adventure game. There's this one thing I wanna know if it's possible or not.

I don't want to have any walking animations in the game. So any time the main character clicks on a hot-spot to move to a new area, I want the editor to do the following in order -

1) Move him to a location near where the hot spot is.
2) Change his sprite to a different one, for 1.5 seconds.
3) Transition to a different area while returning his sprite to the default one.

Please let me know if this is even possible or if I should just stick to walking animations.
If possible, please elaborate on how I can implement it.

Any help or feedback would be much appreciated. I can provide more detail also if you believe it's necessary.
SMF spam blocked by CleanTalk