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

Topics - sven

#1
My apologies if this has been asked before, but I could not find anything in the gazillion "custom quit GUI" topics I found via searching :P

I just set up a custom Quit GUI, and I noticed that while setting the GUI to popup modal stops the game, it still allows me to access other popup modal GUIs (main menu on mouse to top, inventory on mouse to bottom), and my Lucas-ish text bar ("walk to boat", "use rubber lips on yak" etc) also still gets updated while the Quit GUI is visible. The standard Quit GUI, on the other hand, blocks all other GUIs...is there a way to achieve that effect without having to manually check each time I activate a GUI which other GUIs are visible?
#2
I just set up a very basic unhandled_event function, here's what it looks like:

Code: ags
function unhandled_event(int what, int type) {
  if (gInventory.Visible == true) {
    if (mouse.Mode==4) Display ("That doesn't work.");
    return;
  }
  if (what == 4) {
    character[EGO].Walk(mouse.x+GetViewportX(), mouse.y+GetViewportY(), eNoBlock, eWalkableAreas);
    return;
    }
  if (mouse.Mode==1) character[EGO].Say(String.Format("Ah...%s.", Game.GetLocationName(mouse.x, mouse.y)));
  if (mouse.Mode==2) character[EGO].Say("That's useless.");
  if (mouse.Mode==3) character[EGO].Say(String.Format("Hello, %s. How are you?", Game.GetLocationName(mouse.x, mouse.y)));
  if (mouse.Mode==4) character[EGO].Say("That doesn't work.");
  if (mouse.Mode==5) character[EGO].Say("I am not going to carry that around!");
 }


It works fine (on a very basic, still-needs-lots-of-refinement-level), but there are two things I don't understand:

1. The if (what == 4) is supposed to let the player use any cursor mode for walking somewhere if there's no hotspot or object underneath; however, the character moves in a rather erratic fashion, mostly to some place above and to the left of where I clicked  (at varying distances; sometimes, the character will move just slightly away from where I clicked, sometimes it will move all the way across the screen even thoguh I just clicked a few pixels away from the character). Is there anything about mouse.x and mouse.y I don't  understand?

2. The Game.GetLocationName works fine if there's no walk-to point for the object. As soon as I set a walk-to point, the character will move to the walk-to point, the message is displayed, but the object name is missing (so, instead of "Hello, door. How are you?", it will just say "Hello,. How are you?". After the character has reached the walk-to point, I can click on the object again, and this time, the message is displayed correctly. What am I doing wrong?

As always, thanks in advance for your help.

[addition] Ah, I found the answer to my first question: mouse.x and mouse.y of course just return the screen position, not the room position. Replacing mouse.x with mouse.x+GetViewportX() solved that problem. I'm still stumped on the second one, though...
#3
My apologies if this is answered somewhere already, but I could not find it anywhere. The problem I am having is as follows:

I want to use sprites for inventory objects that are a bit larger than standard (100x100, to be exact). This is working fine and looks good, but the problem is that AGS will only register clicks on my inventory object in the top-left corner (I suspect it registers clicks in the top-left 50x50 pixels since that seems to be the standard size for inventory items). If the top-left of the picture is transparent, clicks are not registered at all. Is it possible to change the size of the inventory item's clickable area? Or am I restricted to using 50x50 (or whatever it is exactly) inventory items? I couldn't find anywhere in the settings or any script command that lets me change this.
#4
Maybe I'm just too stupid to do it, but this is giving me a headache...I'm trying to create a simple end credit-like room where text messages are visible for a set time, then there's a pause of a set length etc. I cannot use wait() since I want the palyer to be able to interact with the GUI, and I cannot for the life of me figure out how to do it with overlays.

If I just say Overlay* foo.Overlay = CreateTextual(thingy); in the "player enters room after fadein"-script, then set a timer and try to remove the overlay in repeatedly_execute, the repeatedly_execute script complains that foo is not defined. So I'm trying to define the Overlays at the beginning of the script (see following example code), but then the game crashes with a null pointer error. I'm sure I' missing something glaringly obvious, but I'd appreciate if somebody could tell me what it is  :P

Code: ags
// room script file
Overlay* c1Overlay;
Overlay* c2Overlay;
Overlay* c3Overlay;

#sectionstart room_b  
function room_b() {
  // script for Room: Repeatedly execute
if (IsTimerExpired(1)==1) {
  c1Overlay.Remove();
}  

if (IsTimerExpired(2)==1) {
  c2Overlay.Remove();
} 

if (IsTimerExpired(3)==1) {
  c3Overlay.Remove();
} 
}
#sectionend room_b  



#sectionstart room_c  
function room_c() {
  // script for Room: Player enters room (after fadein)

c1Overlay.CreateTextual(50,50,120,1,14,"Wall wall");
SetTimer(1, 100);

c2Overlay.CreateTextual(50,50,120,1,14,"Wull wull");
SetTimer(2, 100);

c3Overlay.CreateTextual(50,50,120,1,14,"Will will");
SetTimer(3, 100);
#sectionend room_c    
}
SMF spam blocked by CleanTalk