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 - Crimson Wizard

#11061
Frankly, I would question why would you need to show/hide ALL labels altogether: this kind of action sounds is too general IMO. Imagine you will add more guis with labels, that should not be hidden, somewhere on later stages of development...

Perhaps using properties may help to distinguish labels, or guis with special labels.
#11062
Hmm, I just found that crash dump is not written on "out of memory" error. :(
Is there any pattern for when and/or where this happens?
#11063
This never worked in AGS 3.2.1. I was fixing this for 3.3.0 beta literally couple of days ago.
#11064
Quote from: monkey_05_06 on Wed 30/10/2013 22:31:54
If the engine is keeping track of it for any reason (I'll take a look at the code) then it wouldn't hurt to expose it, but I see no reason to add the additional burden for those who wouldn't be using it. ;)
Actually it does, in global array per each control type, although the reason might be simply a choice of architecture rather than necessity... I recall I was planning to change that in "develop" branch at some point.
#11065
Ooh. In such case you would need a Map. AGS does not have such built-in class, but you can emulate that (sort of) by using the struct that holds two strings: bad one and good one (a replacement).

Declaration:
Code: ags

// Declare the struct
struct StringReplacement
{
    String Bad;
    String Good;
};

// Declare the array of structs:
#define TOTAL_BAD_STRINGS 2 // increase this if you need more
StringReplacement NickServ_BadString[TOTAL_BAD_STRINGS];


Setup values in pairs (bad/good):
Code: ags

NickServ_BadString[0].Bad = String.Format("If this is your nickname, type /msg NickServ %cIDENTIFY%c <password>", 2, 2);
NickServ_BadString[0].Good = "Loading...";
NickServ_BadString[1].Bad = String.Format("Type /msg NickServ HELP %cIDENTIFY%c for more information", 2, 2);
NickServ_BadString[1].Good = "Click to continue...";


New replacement code (only shown the part that has to be modified):
Code: ags

<...>
      if (newString == NickServ_BadString[bad].Bad)
      {
         // bad string matched! replace
         newString = NickServ_BadString[bad].Good;
<...>
}
#11066
Quote from: Radiant on Wed 30/10/2013 03:50:33
With the new build, we're occasionally getting this error which I'd never seen before: "error: Out of memory: failed to allocate 903224498 bytes (at PP=77)"
Did it start to happen with beta 9, or after last engine update?
Do you have any crash dumps?
#11067
Quote from: Creator on Wed 30/10/2013 08:06:18
So, without creating an object out of the structure, there's no real point in having one.
No, there is of course a point of having a structure without making objects, which you named few posts above: to group related functions. This is a quite common practice in programming.
Also, when you want to allow strictly one object of that type.
AGS has a number of built-in structs that has only static members, like Game, or System.

The question is, do you need to have any data in structure, applicable per individual object, or not. If not, then there's no sense in making objects of that structure, neither have non-static functions.
#11068
Quote from: Construed on Wed 30/10/2013 00:18:39
One question though, Is it possible to assign different messages to the different NickServ_BadString's?
Can you elaborate?
#11069
Quote from: Radiant on Tue 29/10/2013 20:23:06
I believe monitors have a function that enumerates display resolutions; wouldn't it help to simply use that? Then out of those, pick the highest supported multiple of the game resolution (if none, pick the highest supported multiple of the game's vertical resolution and the lowest corresponding horizontal resolution that still fits).
But that is what it currently does.

Quote from: Radiant on Tue 29/10/2013 20:23:06
Incidentally, I'm getting this in my script now: "import int IntVar_Global_1;" as an automatically converted interaction variable. It doesn't seem to do anything, but what is it for?
Hmm, maybe a forgotten global variable?
#11070
@Knox, sorry, I've read your post in other thread, but could not find time to look into this until now.

@Radiant, I changed how it detects the diff in the ratios, yet there's still not 100% guarantee the borders will be added, because this build requires resolution height to stay the same, so it all depends on what resolutions are supported.

Please, replace the engine: http://www.mediafire.com/download/3q6b28afpkyzced/acwin.exe
#11071
You do not need two "newString" variables. If you need to do same action in two or more cases, combine conditions with OR (||) operator:

Code: ags

if (ircFrom == "NickServ")
{
   String newString = ircMessage;
   
   if (newString == NickServ_BadString || newString == NickServ_BadString2)
      newString = "Loading...";
   Display(newString);
}


Now, assuming there may be more "bad" strings, it is better to make an array of "bad" strings instead, and check for every element of that array.
Declaration:
Code: ags

#define TOTAL_BAD_STRINGS 2 // increase this if you need more
String NickServ_BadString[TOTAL_BAD_STRINGS];

In game_start():
Code: ags

NickServ_BadString[0] = String.Format("If this is your nickname, type /msg NickServ %cIDENTIFY%c <password>", 2, 2);
NickServ_BadString[1] = String.Format("Type /msg NickServ HELP %cIDENTIFY%c for more information", 2, 2);

Replacing bad strings:
Code: ags

if (ircFrom == "NickServ")
{
   String newString = ircMessage;

   // Compare with all bad strings and replace if needed
   int bad = 0;
   while (bad < TOTAL_BAD_STRINGS)
   {
      if (newString == NickServ_BadString[bad])
      {
         // bad string matched! replace
         newString = "Loading...";
         // since we do not need to check any more, this trick will force the loop to end prematurely
         bad = TOTAL_BAD_STRINGS;
      }
      else
         bad++; // increase index by one, will try next bad string next time
   }

   Display(newString);
}
#11072
Might be a bug, can't test right now.

Here's a tip, though: if you are not adding any variables to struct, then declare all functions as "static" and use the struct without creating actual object, i.e.:

Code: ags

struct thing
{
  import static void Thisfuction();
};

thing.Thisfuction();
#11073
Quote from: Frostfalk on Tue 29/10/2013 14:15:34
So it's similar to the difference between strings and C-strings in C++/C?
Yes, to some degree.
For example, you can convert real array of chars to old string, as shown in the example on this wiki page:
http://www.adventuregamestudio.co.uk/wiki/Array_decay
#11074
Quote from: Ghost on Tue 29/10/2013 13:54:53
string is used by the engine to hold "constant" values.
No, not constant values. These are old-style strings which were 200 characters max.
In exotic cases they may be more effective to work with, because they are practically raw arrays of chars. But they have their limitations, and probably tad less safe. (edit: fixed last sentence)
#11075
Quote from: Radiant on Tue 29/10/2013 13:22:34
So that's basically what the ac2game.ags file was in earlier versions of the engine, yes?
Maybe, I did not work with pre-3 AGS much.
The engine looks for data in following files: "*.exe" (added to run windows exes on other platforms even without renaming), "ac2game.dat" and "*.ags".

Quote from: Radiant on Tue 29/10/2013 13:22:34
Anyway I can do that, but if selecting 'split resource files' does it automatically, then I'd prefer that. As I recall, it keeps the sprite file (and sound files) in the main executable, then if the executable is over the given split size (which, given the size of a sprite file, is pretty much guaranteed), it will put room files in separate files which are no bigger than this split size. I'm pretty sure that should still work.
Well, it does not do precisely that, since some data may stay in exe, but it's up to you. Also, leaving some data attached to executable will guarantee that by running exe you will run exactly your game, and not some random data file found in the folder.
#11076
Compiled.exe = engine.exe + attached data.
The data is surrounded by special symbols, which are easy to find (like, in hex editor).
You can cut the attachment (e.g. by some tool) into separate file. The engine is capable of finding data in a separate file too.

I explained this several times in the past year, here're some of the related posts:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=46152.msg636445497#msg636445497
http://www.adventuregamestudio.co.uk/forums/index.php?topic=44768.msg636469632#msg636469632
#11077
Heh, I forgot this version does not write real resolutions, but emulated ones. Anyway, this is irrelevant.

I think this problem should usually be solved by setting "enable side-borders" option in setup, which must be set by default for 320x200 games.
I now recall Ali mentioned the bug, which caused game to fail detect when side-borders actually needed.

This log entry should not be there, it means the engine failed to detect a difference in ratios:
Quote
Widescreen side borders: disabled (not necessary, game and desktop aspect ratios match)
#11078
I added a note in the post above regarding sprite cache.
Quote from: Radiant on Tue 29/10/2013 12:35:04
  • Use winsetup to set the sprite cache size to something bigger than the ACSPRSET.SPR file
This will not affect this issue, because sprite cache keeps a file opened, unlike others.
Changing sprite cache size may improve game speed, but this won't have much effect (if any) for low res games.

Regarding room files: I don't know, we need to check the Editor code first to see what the splitting actually does.


EDIT: uh, *self-facepalm*.
You know what you can do? You can fully split the attached data from compiled exe, as the Wadjet Eye did for ported games.
#11079
Hmm, well, that option does not applies resolution on its own, it chooses the max multiplier that fits in screen.
Therefore the resolution it will try to apply will be exactly (320x200) * N.
What happens next is other issue... sometimes engine may try to change resolution if it failed to apply chosen one. We have also received report that on some occasions the graphics driver automatically switches resolution: http://www.adventuregamestudio.co.uk/forums/index.php?issue=440.0

Some info could be seen in the log.
#11080
Quote from: Radiant on Tue 29/10/2013 12:19:30
Well, the EXE should be kept open (since sound effects are also streamed from it, and the sprite file is in there), and the scanner should not repeatedly scan it anyway
Frankly, I do not know how scanners know when to re-check the file, but when the resource is being read from the EXE, it opens it over again every time, and not keeping it open at all times.

The only exception AFAIK is sprite cache.
SMF spam blocked by CleanTalk