AGS 2.71 Final 2 - Politically Correct Edition

Started by Pumaman, Sun 05/06/2005 23:32:14

Previous topic - Next topic

strazer

Would it be possible to make mouse.SaveCursorUntilItLeaves also restore the mouse cursor when leaving a GUI?
It would simplify things like changing the mouse cursor over a GUI so we could do something like

Code: ags

function repeatedly_execute() {

  if (GUI.GetAtScreenXY(mouse.x, mouse.y) == gSomegui) {
    mouse.SaveCursorUntilItLeaves();
    mouse.Mode = eModePointer;
  }

}

Pumaman

Quoteokay.  But I'd still like to see this fixed if at all possible...

I'll bear it in mind, but "void" is not a supported type so it's not really a big issue.

QuoteNow I realise that my module looks REALLY untidy without pointers in structs. I have to leave the strings and dynamc sprites out of the struct that holds everythung else

As I say, hopefully I can add support for this to a future beta.

QuoteUsing "String"s I get these flooding ac.log:

Yes, the last couple of betas have done this -- it's in case anyone has any serious errors with the new Strings, it will help me debug them. Obviously I'll remove the logging before 2.71 Final.

QuoteThere's an interesting issue with the whole object oriented stuff: if you have a script module that uses a struct to OO-ify its things, great, but then if you have any functions like repeatedly_execute, etc.  in the module then you either have to make them have full access to the struct (and thus everything else, too) or you have to make them just call a struct version of the function. Is there a way to have two versions of the struct, one visible inside the module, and one outside? Can the extends functionality do this?

Just making repeatedly_execute call YourStruct.RepeatedlyExecute or whatever is the simplest solution, and I can't think of an easy way to make this much cleaner at the moment. Still, not a big issue.

QuoteWould it be possible to make mouse.SaveCursorUntilItLeaves also restore the mouse cursor when leaving a GUI?
It would simplify things like changing the mouse cursor over a GUI so we could do something like

Sounds like a reasonable request, I'll certainly consider it.

Kweepa

Quote from: Pumaman on Tue 06/09/2005 23:28:46
QuoteUsing "String"s I get these flooding ac.log:

Yes, the last couple of betas have done this -- it's in case anyone has any serious errors with the new Strings, it will help me debug them. Obviously I'll remove the logging before 2.71 Final.

Ok, sorry about that.
My hard drive had gone to sleep and the game paused for a second while it warmed up again to write the file. I thought it might have been an oversight.

I did notice this (with the new left to right precedence enabled):
Code: ags

float x = -y + z;

is equivalent to:
Code: ags

float x = -(y + z);

rather than the expected:
Code: ags

float x = (-y) + (z);
Still waiting for Purity of the Surf II

edmundito

Quote* Implemented lazy evaluation for && and || operators.

Does this mean that if you got...
Code: ags
if (boolean == true && (a > 5))
then if boolean is false it will not check if a > 5?

I could come up with a better example that would actually be useful, but I think you get the idea.
The Tween Module now supports AGS 3.6.0!

Pumaman

QuoteI did notice this (with the new left to right precedence enabled):

float x = -y + z;
is equivalent to:
float x = -(y + z);
rather than the expected:
float x = (-y) + (z);

Hmm yeah, interesting point ... the left-to-right precedence affects only the main operators, and not the - operator. It's probably too late to change it now, though.

QuoteDoes this mean that if you got...
if (boolean == true && (a > 5))
then if boolean is false it will not check if a > 5?

Correct. It is more useful in this situation:

Character* theChar = Character.GetAtScreenXY(mouse.x, mouse.y);
if ((theChar != null) && (theChar.Solid == true)) {

with the previous version, this was not possible since the game would abort with a null reference error if theChar was null.

edmundito

Yeah, that's what I was talking about... I had a problem like that in Saturday School, I believe... it had to do with objects, though, so I had to repeat part of the code to make it work.
The Tween Module now supports AGS 3.6.0!

strazer

Quote from: Pumaman on Wed 07/09/2005 20:29:06
Hmm yeah, interesting point ... the left-to-right precedence affects only the main operators, and not the - operator. It's probably too late to change it now, though.

I completely understand and support your desire to avoid having to break someone's script, but I think in instances like these it's more important to make things correct, consistent and predictable. Just fix it, add a note to the changelog and be done with it.

GarageGothic

Just a quick question for CJ: Will any kind of sprite cropping (other than the current rotate crop) be implemented for 2.71? If not, I won't wait anymore to release my shadowbox-script.

SSH

String related stuff: does using the new String.ReplaceCharAt or whatever its called work like the old one where you could replace the last char with 0 to truncate the string? If not, and maybe a good idea anyway, t would be nice to have a String.Substring function with start are length parametrs which returned any arbitrary substring of the String. I know I could write one by hand-concatenation the individual chars, but there doesn't seem to currently be a neat way to make a string shorter.
12

SSH

Quote from: SteveMcCrea on Wed 07/09/2005 00:10:48

I did notice this (with the new left to right precedence enabled):
Code: ags

float x = -y + z;

is equivalent to:
Code: ags

float x = -(y + z);

rather than the expected:
Code: ags

float x = (-y) + (z);


Also, you can't assign an enum a negative value... dunno if this is related
12

monkey0506

Quote from: SSH on Thu 08/09/2005 22:57:05String.Substring function with start are length parametrs which returned any arbitrary substring of the String.

It wouldn't be too hard to make one...I'll PM you the code since it's not directly related to this beta.

Superman95

#151
I have a couple feature requests, i hope it's in the right place.

Make the module manager, a modeless dialog box.Ã,  I have dual monitor and it would be really helpful to keep it open in the other monitor to easily jump between script and the rest of the editor.

Allow string or String to be in a struct.  This would be VERY helpful to me.

Allow nested types....like this:
Code: ags

struct Statistics
{
  int Strength;
  int Intelligence;
  int Agility;
  .....
}

struct Profile
{
  string Name;
  Statistics Stats;
}


thanks.

monkey0506

Both of those things have already been suggested before you. :=

Seeing as a String is a pointer, pointers will have to (to some extent at least) be allowed within structs for this to work.

As for nested types...it works if the type has previously been imported into the game...but that's not official support.  Official support is being worked on.

And I believe that requests belong in their own thread (except when directly pertaining to features that will definitely appear in the final version of the beta).  But like I said, both of these have already been brought up...

I've been up 26.5 hours and I'm about tired now...so...I'm off to sleep.

SSH

#153
Some String wierdness:

Code: ags

String newroom = Game.InputBox("!Teleport to room:");
if ((newroom!="") && (newroom.AsInt<ROOMS)) {
// some stuff
}


gives the compile error "type mismatch: cannot convert const string to int"

why can't I compare newroom to ""?

I worked around it by using newroom.Length!=0 instead, but I think it deserves some attention. Same happens with ==, so I guess its an empty-string issue.


NB: Changing operator precedence doesn't make a difference
12

edmundito

#154
I'd like to point out that in the manual, under script reference\script language keywords\data types there is no mentioning of the bool type. I assume is a 1bit type, right?

And uh.. is there a size for enums?
The Tween Module now supports AGS 3.6.0!

HeirOfNorton

Quote from: Edmundo on Thu 15/09/2005 06:53:26
I'd like to point out that in the manual, under script reference\script language keywords\data types there is no mentioning of the bool type. I assume is a 1bit type, right?

Actually, the bool in AGS is just a predeclared enum, not a seperate type. And for its size...
Quote
And uh.. is there a size for enums?

As I recall, enums are treated interally as ints, so they are all 4 bytes.

HoN

Pumaman

#156
QuoteI completely understand and support your desire to avoid having to break someone's script, but I think in instances like these it's more important to make things correct, consistent and predictable. Just fix it, add a note to the changelog and be done with it.

Actually, looking into this further it seems that it's not the - prefix that's broken, but actually that + has a higher precedence than -, which means that this:
5 - 3 + 2
is giving 0 rather than 4, even with Left-to-Right enabled.
This is obviously a bug so I'll fix + and - to have the same precedence for the next version.
(Edit by strazer: AGS v2.71 Beta 6: * Fixed + having a higher precedence than - and thus 5 - 3 + 2 giving 0 rather than 4.)

QuoteJust a quick question for CJ: Will any kind of sprite cropping (other than the current rotate crop) be implemented for 2.71? If not, I won't wait anymore to release my shadowbox-script.

Hopefully it will, yes, it's the next task I'm planning to do.

QuoteString related stuff: does using the new String.ReplaceCharAt or whatever its called work like the old one where you could replace the last char with 0 to truncate the string? If not, and maybe a good idea anyway, t would be nice to have a String.Substring function with start are length parametrs which returned any arbitrary substring of the String.

That's a fair point, String.Substring and String.Truncate methods have been added for the next beta. Although you can write your own workaround fairly easily, these seem useful enough that they should be part of the engine.

QuoteAllow string or String to be in a struct.  This would be VERY helpful to me.

Allowing pointers (including Strings) in structs is what I'm working on at the moment, I hope to have it in the next beta but it's proving to be something of a nightmare so no promises yet.

Quotegives the compile error "type mismatch: cannot convert const string to int"

why can't I compare newroom to ""?

Well spotted, the string version of == and != are marked as returning a string rather than a bool so it can't AND them with another comparison. I'll get it fixed, in the meantime you could do:

if (newroom!="") {
  if (newroom.AsInt<ROOMS) {
    // some stuff
  }
}

instead as a workaround (ie. avoid the && operator).
(Edit by strazer: AGS v2.71 Beta 6: * Fixed error trying to AND/OR the string comparison == and != operators with other operators.)

Quote from: ProgZmax on Wed 14/09/2005 19:44:30Ability to set the current loop of heretofore view ONLY settings.  For example, instead of multiple views for speech, blinking, thinking, allow the user to place all the animations in one view and toggle the loop number (say from the dialog script) so you save space.

Bulleted views.  You specify a name and then can click +/- to expand a view list.  This is ideal for characters with a huge number of animations and far more object oriented.

Noted, but can you please put suggestions in a separate thread if they don't directly relate to the functionality of this beta; that way we can keep this thread focussed.

QuoteI'd like to point out that in the manual, under script reference\script language keywords\data types there is no mentioning of the bool type. I assume is a 1bit type, right?

And uh.. is there a size for enums?

enums and bools are both 32-bit integer types.

monkey0506

This next beta sounds good.  How long (abouts) until we get to see it? :=

GarageGothic

Quote from: Pumaman on Thu 15/09/2005 22:55:35
QuoteJust a quick question for CJ: Will any kind of sprite cropping (other than the current rotate crop) be implemented for 2.71? If not, I won't wait anymore to release my shadowbox-script.
Hopefully it will, yes, it's the next task I'm planning to do.

Awesome, thank you so much CJ. I hope I don't seem too greedy if I also remind you of this:

Quote from: Pumaman on Thu 16/06/2005 20:07:24
QuoteI wonder if it would be possible then, as a workaround, to add a function that changes the sprite number of a specific view frame at runtime? Such as SetFrameSprite(int view, int loop, int frame, int slot)?
I'll look into it.

Quote from: Pumaman on Thu 15/09/2005 22:55:35enums and bools are both 32-bit integer types.

LOL - here I thought I was saving memory by using bools instead of chars.

SSH

Quote from: monkey_05_06 on Fri 16/09/2005 00:00:03
This next beta sounds good.  How long (abouts) until we get to see it? :=

betas automatically get delayed if anyone asks when the next one will be  >:(. But CJ usually releases them at a weekend.   :=
12

SMF spam blocked by CleanTalk