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

#1
Thanks for the tip, that's at least easier than scripting every GUI call manually :P
This is more of a feature request than anything else, but it wuld be really nice to have a GUI mode like, oh, let's call it "popup modal blocking" or "popup modal exclusive" that would make custom GUIs behave exactly like the standard quit GUI.
#2
Thanks for giving it a shot, but that doesn' solve my problem...my explanation was probably a bit confusing.

You can see what I mean by creating a little test game with the standard GUIs and one additional GUI:

*Set up a new GUI called QUITGUI, give it two buttons. One calls a script that does Quitgame(0);, the other calls a script that does gQuitgui.visible=false;
*Set Quitgui to popup modal
*Place a button somewhere that sets gQuitgui.Visible=true;

Now, if you click the button, the simple test GUI is called; if you hit ctrl-q, the standard quit GUI is called. You will notice that with the test GUI, moving the mouse to the top of the screen will still activate the standard Statusbar GUI (that is activated by mouse ypos). The standard quit GUI will disable the Statusbar GUI (and also disable all other popup modal or mouse ypos GUIs, and stop the updating of custom statuslabel GUIs). I'm looking for a way to emulate that behavior with my custom Quit GUI that doesn't involve lots of if (gQuitgui.visible==true)&&(gSavegui.Visible==true) etc. everytime I activate another GUI element - just setting the other GUIs to invisible will not work because they will be set to visible again as soon as I move the mouse to the screen edge.

I should probably add that I'm only asking this because I'm lazy - the problem can be solved with a bit of scripting work, I'm just a bit worried that I maybe overlooked something obvious and that after I spent an hour scripting the GUIs to behave the way I want, someone tells me that there's a BlockAllGuis command or something :P
#3
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?
#4
Thanks, that worked perfectly...I suspected it had something to do with the delay and movement during walking but couldn't quite get my brain to handle the situation :P
#5
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...
#6
You cannot do that with the dialog editor (at least there's no way I can think of), but it's perfectly doable with scripts. Basically, you create an array for each paladin that contains every possible question/answer combination plus a flag to check if the player already knows the correct answer. If the player encounters a paladin, you call a script that sets two counters (one for the player, one for the paladin), then randomly chooses a question and checks if the opponent knows the answer. Then you display question and answer via character[foo].say and increment the counter of the winning side; if one counter reaches three, you exit the fighting script and pass some variable to determine what happens next. I'm too lazy to put it in code right now, but check the manual entries on variables and character interaction - that should answer everything :)
#7
Ah, thanks. Must have overlooked that :P
#8
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.
#9
If you don't want to let your character walk off the screen edge but rather transport him to another room from somewhere in the middle of the room (if, for example, the first room shows a wall with a doorway in the middle and you want the character to walk through the door to the second room), you would use regions. This is also very easy: in your first room, go to "areas" (where you defined walkable areas etc), and in the selection box in the upper left (where you can select walkable areas, hotspots etc), select "regions". Now, draw a region in front of the door (the same way you created walkable areas). Then click on "interaction", select "player walks onto region", and from there on proceed as Jonez described above.
#10
I've also struggled with this for a while - the solution is to draw all walkbehinds in the same mask, as KhrisMUC said. Different walkbehinds are distinguished by color, in palette order - palette color#0 is the non-walkbehind backround, color #1 is walkbehind 1, #2 walkbehind 2, etc. (it does not matter which colors you use, you can paint them black, purple, pink, whatever, as long as the color has the correct palette index)
#11
Thanks both of you, that was really helpful. Being able to script my own timers takes care of lots of problems (not only with the end credits, but some stuff I was not quite sure how to do in other areas of the game). Thanks a lot!
#12
That last one was one line too many I removed when I cleaned up the code before posting :P

Thanks for your hints, I've now finally figured out the correct syntax for what i want to do...well the first part, anyway. Here's what my sample script looks like now:

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

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: Repeatedly execute
if (IsTimerExpired(1)==1) {
  c1Overlay.Remove();
  c2Overlay = Overlay.CreateTextual(50,50,120,1,14,"Wull wull");
  SetTimer(2, 100);
}  

if (IsTimerExpired(2)==1) {
  c2Overlay.Remove();
  c3Overlay = Overlay.CreateTextual(50,50,120,1,14,"Will will");
  SetTimer(3, 100); 
} 

if (IsTimerExpired(3)==1) {
  c3Overlay.Remove();
} 
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_c  // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
  // script for Room: Player enters room (after fadein)

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

}
#sectionend room_c  // DO NOT EDIT OR REMOVE THIS LINE


(for the record, the problem I mentioned earlier was caused by me using "Overlay* c1Overlay = blahblah" in the room_c section, which of course leads to an error message  "Overlay c1Overlay already defined" or similar)

Ok...now I'm able to have overlays appear and disappear after a set time while the player can still control the mouse. I'm still trying to figure out how to wait a set time between the messages, but I think I'll eventually find out :)

One final question, am I correct to assume that when using this method, I am in effect limited to 20 overlays because there's only 20 timers? That's not too many for the kind of sequence I had in mind...
#13
Thanks for the quick reply - I suspected something like that, but that brings me back to my initial problem: if I do it like this...

Code: ags

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

#sectionstart room_c 
function room_c() {
  // script for Room: Player enters room (after fadein)
Overlay* c1Overlay = Overlay.CreateTextual(50,50,120,1,14,"Wargl!");
SetTimer(1, 100); 
}
#sectionend room_c  


...then the repeatedly_execute complains that c1.Overlay is undefined - that's why I tried to define the overlays at the beginning, which apparently does not work either. Is there any other way to have overlays appear and disappear after a defined time?
#14
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