AGS v2.7 Final: Yet Another Edition

Started by Pumaman, Sat 13/11/2004 21:02:00

Previous topic - Next topic

RickJ

Quote
I just tried this out and the button text was re-centered correctly when I changed the width. Can you provide an example where it doesn't work?
Here is a code snippet where I was trying to modify button width depending upon how wid the text is.  Previously I was calculating a width but in light of your response I tried just setting it to a constant value (i.e. thinking that I may have calculating crap).  So I still get the same behavior.  I am using a the control index/pointer/casting thing so I wonder if that has something to do with it?   

I still have this gut wrenching feeling that it is I who is in error rather than the engine.  Anyway here is the code snippet and a  zip file of the whole thing in case you need it.
//-------------------------------------------------------------------
   function show_menu(string widget) {
//
//    External References:
//    gMenu - Main menu bar containing buttons as menu items.
//-------------------------------------------------------------------
   int wid, iid, event;
   GUIControl *gui_element;
   
   string item;
   string action;
   
   // Find the specified widget
   wid = 0;
   while (wid<WinBlu_MAXWIDGETS) {
      if (StrCaseComp(widget, Widget[wid].Name)==0) {
         iid = 0;
         while (iid<WinBlu_MAXITEMS) {
            gui_element = gMenu.Controls[iid];  
            if (gui_element==null) {     // No more menu slots available
               iid = WinBlu_MAXITEMS;
            }
            else {                       // OK found a menu slot
               event = get_item(wid, iid, item,  action);
               if (event==WinBlu_NULL) {
                  gui_element.AsButton.Visible = false; 
                  gui_element.AsButton.SetText("");
               }
               else {
                  gui_element.AsButton.Visible = true; 
                  gui_element.AsButton.SetText(item);  

                 // Button width was originally 25 in editor.  
                 // Text is not centered correctly after change
                  gui_element.AsButton.Width = 18;     
                                                                      
               }
            }
            iid++;
         }
         return true;
      }
      wid++; 
   }
   return false;
}

TheMagician


Just wanted to mention that "SetChannelVolume" does not work if the specified channel is not currently playing.

Perhaps the manual could mention that.

RickJ

#522
Btw,  I have started using the new GUI stuff with a companion module and it's working out very well.   It takes a little getting used to ... I think because of being familiar with the old way rather than having difficulty understand the new one.   I am really enjoying working with the new stuff.

I know this was previusly requested and noted but I would like to briefly mention it again in light of my recent experiences.  In doing the above work it quickly became apparent that both gui and companion module must travel toghter.  Having a way of combining a module and one or more GUIs into a single exportable/importable would be really cool and useful IMHO.  So I am hopeful something like this can make it's way in to some future version of AGS. 

Anyway, I just wanted to let you know how much fun I am having  :D

Cheers
Rick

TheMagician

#523
Hi again.

Noticed some more things:

1. I think I found a bug in "character.AddWaypoint".   
    Here is a little example script:

====
#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: Player enters screen (after fadein)
  cFra.Walk(100,100, eBlock, eWalkableAreas);
  Wait(30);
  SetGlobalInt(66, 1);
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for room: Repeatedly execute
  if((cFra.Moving == false) && (GetGlobalInt(66) == 1)) {
    cFra.Walk(100,100,eNoBlock,eAnywhere);
    cFra.AddWaypoint(84,164);   // MoveCharacterPath(FRA,84, 164);    //  <-- Error in this line ------
    cFra.AddWaypoint(76,164);   // MoveCharacterPath(FRA,76, 164);
    cFra.AddWaypoint(63,169);   // MoveCharacterPath(FRA,63, 169); 
  }
}
====

The error reads: "character.move: int direct must be eANYWHERE or eWALKABLEAREAS" 
which I think is a wrong error message.

I assume that "character.AddWaypoint" always needs a preceeding "character.Walk". However, in the example above the character already stands on the coordinate the "character.Walk" points to. Therefore it is skipped and the script continues with "character.AddWaypoint" which then doesn't work anymore.


Also, "character.AddWaypoint" produces the same (incorrect) error message if you have a plain room script with only this in your "Player enters screen after fade in" section:

====
cFra.Walk (100,100,eBlock,eAnywhere)
cFra.AddWaypoint (84,164);      //   <-- Error in this line --------
cFra.AddWaypoint(76,164);
====

I think this is caused because "cFra.Walk" is set to blocking. Perhaps the manual could mention that.

btw: in AGS 2.62 you could have both these things without problems.

~~~~~~~~~~~

2. In the auto-complete of "game. "  in the script editor there is an entry called "game_speed_modifier". I couldn't find anything about it in the manual ... so what does it do?

~~~~~~~~~~~

3. In the global variables section the AGS help says:

mouse.y       Mouse Y co-ordinate when the script was started (0-199) 

I think it can take more values than 0-199 can't it?

strazer

#524
1.) Hm, if I add a seventh script module to my game, it crashes on startup with

QuoteError: Unable to create local script: Runtime error: too many active instances

regardless of what room the player starts in.
If I remove the module, it works fine. Nothing special in it, only a struct with one static member function (Edit: It also quits if the module is completely empty.).
Is there some kind of limit to anything that we should know of?

2.) Is there currently way to make characters completely black other than using additional views and sprites?
Since there's no Character.Tint function, I tried using Region.LightLevel 0 (editor)/ -100 (script), but that doesn't make him completely black for some reason.
If I then try to also tint the region 0,0,0/100, the lightlevel automatically increases to 200. ???
I currently use a black-tinted object as character replacement, but that's kind of awkward. Why aren't there saturation and luminance parameters for regions? (Not that I understand what they are, but at least it works. :) )
Can someone explain the difference between brightness and luminance to me?

3.) I've noticed something:

Code: ags

// room script

function repeatedly_execute_always() {

	if (object[0].Moving == false) {
		if (object[0].X == 300) object[0].Move(0, object[0].Y, 3);
		else object[0].Move(300, object[0].Y, 3);
	}

	string labeltext;
	StrFormat(labeltext, "%d / %d", object[0].X, object[0].Y);
	lblTestlabel.SetText(labeltext);

}

function on_mouse_click(MouseButton button) {

	if (button == eMouseMiddle) object[0].Y = GetViewportY()+mouse.y;

}


If you click the middle mouse button while the object is moving, the object's Y-coordinate changes to the current mouse Y-position, it keeps moving, and it displays the new Y-coordinate in the label, as it should be.
However, once the object reaches either end of the screen, it jumps back to the Y-coordinate it started from and the label displays this Y-coordinate again.

4.) Since the Character.View property holds only the currently used/locked view, how about a NormalView property so we can determine the normal view of the character?
It could even replace the ChangeView function since that takes a single parameter anyway.
If that's too much to ask, would you be so kind to make the (undocumented) .defview variable available in strict mode as well? That's the one holding the normal view number, right?

5.) If objects have "Use region tint and lighting" enabled, shouldn't they also be affected by SetAmbientTint?

Pumaman

Quote from: RickJ on Wed 09/03/2005 02:30:26
Here is a code snippet where I was trying to modify button width depending upon how wid the text is.

Rick, the text is correctly being centered within the button. However, it looks wrong because you have a fixed 25x20 image for the button, so even if the button is only sized 18x20, the 25x20 image is drawn and will run off the right side of the button.

QuoteJust wanted to mention that "SetChannelVolume" does not work if the specified channel is not currently playing.

Fair point -- I'll mention it in the manual.

QuoteHaving a way of combining a module and one or more GUIs into a single exportable/importable would be really cool and useful IMHO.  So I am hopeful something like this can make it's way in to some future version of AGS. 

Yeah I can appreciate that -- maybe that's something for 2.71.

Quote
Anyway, I just wanted to let you know how much fun I am having 

Glad you're enjoying it :)

Quote1. I think I found a bug in "character.AddWaypoint".   
    Here is a little example script:

Well spotted, thanks for the bug report. This is indeed broken, I shall get it fixed.

Quote2. In the auto-complete of "game. "  in the script editor there is an entry called "game_speed_modifier". I couldn't find anything about it in the manual ... so what does it do?

There are several properties in the "game" object that are internal and shouldn't be touched by the script. Basically, if it's not documented in the manual, you don't need it.

Quotemouse.y       Mouse Y co-ordinate when the script was started (0-199) 

I think it can take more values than 0-199 can't it?

If your game is 320x240/640x480 then yes it could be up to 239; I'll reword it to say "320-resolution" to clarify what it means.

QuoteHm, if I add a seventh script module to my game, it crashes on startup with

Ah crap, adding rep_exec_always support for modules has had a side effect of limiting the number of modules you can have. I'll look into it.

QuoteIs there currently way to make characters completely black other than using additional views and sprites?
Since there's no Character.Tint function, I tried using Region.LightLevel 0 (editor)/ -100 (script), but that doesn't make him completely black for some reason.

Well, setting the LightLevel to 0 should make him as good as completely black. I suppose you could use SetAmbientTint but that would have an effect on everything else on the screen as well, obviously.

I agree that the whole tinting this is rather inconsistent at the moment. Because regions originally only worked on characters, the objects had a specific Tint function added. But now that objects can use region tints, it would make sense for characters to be able to have a specific tint setting as well.

QuoteIf you click the middle mouse button while the object is moving, the object's Y-coordinate changes to the current mouse Y-position, it keeps moving, and it displays the new Y-coordinate in the label, as it should be.
However, once the object reaches either end of the screen, it jumps back to the Y-coordinate it started from and the label displays this Y-coordinate again.

Ah -- as with characters, you shouldn't change an object's position while it's moving. I'd better document that.

Quote4.) Since the Character.View property holds only the currently used/locked view, how about a NormalView property so we can determine the normal view of the character?
It could even replace the ChangeView function since that takes a single parameter anyway.

That's a good point -- should have thought of that originally. I'm a bit concerned about removing ChangeView now that we're into the RC stage although it would be a clean way of doing it. I'll certainly add a read-only NormalView property, anyway.

Quote5.) If objects have "Use region tint and lighting" enabled, shouldn't they also be affected by SetAmbientTint?

Hmm that's an odd one, I'll look into it.

strazer

#526
QuoteI'm a bit concerned about removing ChangeView now that we're into the RC stage although it would be a clean way of doing it.

I say do it while you still can. I doubt most people have started a serious project with v2.7 yet.
Either way, thanks! :)

Quote
Quote
5.) If objects have "Use region tint and lighting" enabled, shouldn't they also be affected by SetAmbientTint?
Hmm that's an odd one, I'll look into it.

I'm sorry, it does indeed work. I was using a sprite where you can't see that effect very well. I've tested it with a white one and it works. Sorry for the trouble.

Another small suggestion: How about the PlaySound function returning the chosen channel?

Vel

Hey CJ, I found a bug, but I am not quite sure if it is a feature or a bug. If it is a feature, though, it doesnt make much sense:

In 2.7 RC2, if there is a hotspot, and an object above it, but the object is not visible, the interaction with the object runs.
I dont know whether it was like that in previous releases.

RickJ

Quote
Rick, the text is correctly being centered within the button. However, it looks wrong because you have a fixed 25x20 image for the button ...
Ah man... I knew it was me but I just couldn't see the obvious.  Sorry for the false alarm...  :-[

Pumaman

QuoteAnother small suggestion: How about the PlaySound function returning the chosen channel?

That'd be easy to do, so I think I can slip that in.

QuoteHey CJ, I found a bug, but I am not quite sure if it is a feature or a bug. If it is a feature, though, it doesnt make much sense:

In 2.7 RC2, if there is a hotspot, and an object above it, but the object is not visible, the interaction with the object runs.
I dont know whether it was like that in previous releases.

I just tried it but it worked fine for me. Which interaction is running, and can you provide an example of the problem?

Vel

Whoops, my bad.
I had changed the cursor marker positions...

Pumaman

Ok, RC3 is now up. That's it for 2.7 -- there will be bug fixes only between now and the Final.

RickJ

Possible Bug: After copying Room2.crm to game directory, RoomEditor->RefreshList doesn't add the new room file to the list of editable rooms.  If I am misunderstanding the purpose of the RefreshList function then I appologize for being a nusiance.  ;)

Radiant

Would you please consider fixing GUI button image clipping, as it would be something I'd be heavily using? (plus it seems to be a matter of simply adding a boundary check)...

You suggested implementing a per-button flag, for backwards compatibility, that sounds like a good idea (a SetGameParameter would also be fine)

Pretty please with sugar on top?

Quote
Quote
Quotethe image on a GUI button is not clipped to the size of the button; instead, if it's larger than the button, it is drawn fully even outside the button.
This is by design, the button enlarges to fit the image. It'd cause too much confusion and "bug reports" if it clipped the image.

Er, no, not exactly. If you do 'change button image', then yes indeed, the button resizes to the image you select. That is useful. However, if you change the button size afterwards (either in the GUI editor, or with GUISetButtonSize), the button's clickable area does change, but the image is not cropped or clipped or panned or anything.

I'm making a resizable GUI. To do this I have images of the four edges at maximum size. They'll have to be clipped if the GUI is less than maximum size. And that's not currently possible :(

Vel

Quote* Increased max overlays from 10 to 20.

Cheers.

Pumaman

Quote from: RickJ on Mon 14/03/2005 06:51:21
Possible Bug: After copying Room2.crm to game directory, RoomEditor->RefreshList doesn't add the new room file to the list of editable rooms. If I am misunderstanding the purpose of the RefreshList function then I appologize for being a nusiance. ;)

I just tried this out but it worked fine -- does it fail repeatedly for you, or was it just the once?

QuoteWould you please consider fixing GUI button image clipping, as it would be something I'd be heavily using? (plus it seems to be a matter of simply adding a boundary check)...

Sorry, but I have to draw the line somewhere. There are always more features that people want slipped in, and then the new version never gets released.

Besides, there's nothing to stop it being added in 2.71 beta 1, it's just that I really want to get 2.7 out there so people can start getting used to OO scripting.

Kinoko

I have to agree. There are a couple of features I'd like to suggest but holy bajeebers, I really want this version released properly so I can start using it ^_^ It feels like it's been an eternity. I'm one of those people who won't touch the program until it's in it's absolute final release.

Gilbert

Yeah, just check the date of the original beta release, it's exactly 4 months and a day already, if it's not going to be released soon, we'll all rot. :=

RickJ

Quote
I just tried this out but it worked fine -- does it fail repeatedly for you, or was it just the once?
It failed a couple of times but it was during the same session.   I'm upgrading a game to the new version and so created a temp directory and moved all the room files there and reintroduce them back into the game one at a time.  The first and second rooms seemed to have a problem being updated in that session.

I just tried adding a third room and  UpdateList works now.  The editor is now in a new session and I have activated the compiler via "Test" several times.   I can't reproduce it now nor can I say fo certain what happened the first time.  So I suppose we just write it off as a Windowism. 

strazer

#539
Code: ags

  CursorMode prevmode = mouse.Mode; // save current cursor mode
  mouse.Mode = 7; // change to Wait cursor mode
  mouse.UseModeGraphic(prevmode); // override cursor graphic to look like the previous one
  player.Say("I say some stuff."); // <- problem: Wait cursor reverts to default
  mouse.UseDefaultGraphic(); // restore Wait mode graphic to default
  mouse.Mode = prevmode; // change to previous cursor mode


It seems the Say command changes to the Wait cursor mode, even if it is already the current cursor mode, thereby restoring the cursor mode graphic, so the Wait cursor is displayed as usual.
Strangely, if I use "Wait(40);" instead of the Say command, it works like intended.

Shouldn't the Say command leave the Wait cursor graphic alone?

(I could of course use mouse.ChangeModeGraphic, but how do I return the sprite slot of the current cursor mode other than (non-universal) if-clauses? Seems like a mouse.Graphic property would be needed for this. And what about animated mouse cursors?)

Edit:

I just realized I could use SayBackground and Wait together, but I really need Say because I want all other background speech to be removed.

Edit 2:

Spelling error in manual: SetGlobalString example: contian -> contain

SMF spam blocked by CleanTalk