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

#221
Okay, I'm trying to set my label's text to Game.GetLocationName because it seems that if I use @OVERHOTSPOT@ it will be translated even if the game is paused...

In any case, the game crashes out with an error as soon as I load it:

Quote---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0043F6FD ; program pointer is -42, ACI version 2.72.920, gtags (35,24)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

in MonkeyTemplate (line 86)
from MonkeyTemplate (line 112)


Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OK   
---------------------------

Line 86 reads as:

Code: ags
  lblVerbbar.Text = lblVerbbar.Text.Append(Game.GetLocationName(mouse.x, mouse.y));


I've also tried storing the name into a String first, but it crashed on the line where I called Game.GetLocationName.

I'm not entirely sure if it's relevant, but I am calling the function from repeatedly_execute_always(), however, appending the text from within rep_ex_al itself (of course adding a check to prevent it being appended several times) seems to work.
#222
Okay, here I go again. :D

I've noticed that it seems the space between listbox items is fixed at 3 pixels*. I can't seem to change it at all even with all my efforts in modifying my fonts and whatnot.

The reason I need to change this is because I need my listbox to fit inside of a certain area, however there are several extra pixels at the bottom because the items are spaced incorrectly.

Please can we get this changed? :'(

:=

[EDIT:]

In all my n00bly glory I managed to look up the related tracker entry, (after posting... :-[), but still, I would find this useful, and it's been nearly a year since the tracker entry.

*This is based off of one test with one font. I didn't actually attempt any other fonts, although I did try adding extra blank space at the bottom to no avail. It could be the case that this amount depends somewhat on the size of the font instead of just being 3 pixels as stated.
#223
Okay, nice and simple. This is the first time I've ever really attempted something like this, so please don't be too harsh (;)), but I'd like some C&C.

Original Picture:


Modified Picture:


I realize that a lot more work could have been done to try and match the sizes and lighting levels, but I wasn't feeling that ambitious. Also I realize his hair looks like it's severely matted, but I didn't have a large sample to clone from.

Thanks for any comments!
#224
I made a video...with Windows Movie Maker. And it repeats part of the video at the end. And I was also wearing socks on a linoleum floor.

"A video"

[EDIT:]

And just for reference, here's the link for the original Numa Numa Dance.
#225
EDIT: I've changed the title thread again, because apparently this is some type of bug as you should already be able to have up to 15 parameters per function.

Okay, I'm converting this thread to a suggestion thread. Simply because it was already here, the situation is explained below, and Rui seconded the motion here.

The suggestion is that we can (please?) have more parameters allowed for each function (9 is the current limit).

Question involving the game crashing with function using 10 parameters

I have the following code for my PersistentSpeech module:

Code: ags
// module header
managed struct PersistentSpeech {
  /* ... */
  import static Overlay* Say(int index, Character* Char, String Text, int width, int font, int xOffset = 0, int yOffset = 0, bool runanim = false, int loops = -1/*, bool ignorePausedStatus = true*/);
  };

// module script
static Overlay* PersistentSpeech::Say(int index, Character* Char, String Text, int width, int font, int xOffset, int yOffset, bool runanim, int loops/*, bool ignorePausedStatus*/) {
  if ((Char == null) || (Text == null) || (loops < -1) || (width < 0) || (font < 0) ||
  (PersistentSpeech_CharacterInUse(Char, index)) || (index < 0) ||
  (index >= ePersistentSpeech_MaxItems)) return null;
  if (loops == -1) loops = GetGameSpeed() * FloatToInt(IntToFloat(Text.Length + 1) / 15.0, eRoundUp);
  PersistentSpeech_Character[index] = Char;
  PersistentSpeech_Loops[index] = loops;
  PersistentSpeech_Text[index] = Text;
  if ((PersistentSpeech_Overlay[index] != null) && (PersistentSpeech_Overlay[index].Valid))
    PersistentSpeech_Overlay[index].Remove();
  ViewFrame* frame = Game.GetViewFrame(Char.View, Char.Loop, Char.Frame);
  int x = Char.x + xOffset - (GetTextWidth(Text, font) / 2);
  int y = Char.y + yOffset - FloatToInt(IntToFloat(Game.SpriteHeight[frame.Graphic]) * 1.5);
  frame = null;
  int t_width = GetTextWidth(Text, font);
  if (t_width > width) t_width = width;
  if (x < 0) x = 0;
  if (x + t_width > System.ViewportWidth) x = System.ViewportWidth - t_width;
  if (y < 0) y = 0;
  if (y + GetTextHeight(Text, font, width) > System.ViewportHeight) y = System.ViewportHeight - GetTextHeight(Text, font, width);
  PersistentSpeech_Overlay[index] = Overlay.CreateTextual(x, y, width, font, Char.SpeechColor, Text);
  if ((runanim) && (Char.SpeechView > 0)) {
    Char.LockView(Char.SpeechView);
    Char.Animate(Char.Loop, Char.AnimationSpeed, eRepeat, eNoBlock, eForwards);
    PersistentSpeech_CharacterViewLocked[index] = true;
    }
  else PersistentSpeech_CharacterViewLocked[index] = false;
  /*PersistentSpeech_IgnorePaused[index] = ignorePausedStatus;*/
  return PersistentSpeech_Overlay[index];
  }


I commented out the bool ignorePausedStatus because without it, the game compiles and runs fine. However when I include it (and yes I am sure the parameter is included in both the header and the script), it crashes the game with the following error:

Quote---------------------------
Adventure Game Studio
---------------------------
Script link failed: Runtime error: unresolved import 'PersistentSpeech::Say^10'

---------------------------
OK   
---------------------------

I understand that this means it can't find the function definition, however I don't see why it can find it when it has 9 parameters but it can't when it has 10.

BTW, I am trying to add the parameter because the way it is set up now the persistent speech ignores whether the game is paused. This could be considered a feature so I don't want to remove it, however the user could also want the Overlay to remain valid as long as the game is paused (in addition to the set amount of game loops).
#226
Overlay.CreateTextual optional alignment parameter

I've been working on updating my PersistentSpeech module because I plan to make it compatible with my QueuedSpeech module so that you can run queued persistent speech. However, I've noticed in some of my testing that when using Overlay.CreateTextual the text is automatically left-aligned. I know how to center the text using GetTextWidth, however if the text spans more than one line the second line of text is left-aligned and there's no way to center it.

I'm not sure how difficult (and/or reasonable) to implement it would be, but I think it would be nice if there was an optional Alignment parameter for Overlay.CreateTextual (default to eAlignLeft) so that we could align the text to the right or to the centre. That way I could make these overlays look more like Character speech handled by the engine looks (automatically centred).

GetSkipSpeech

There's an option to set the skip-speech style, but nothing to retrieve it. This would be useful for my modules so they could remove the speech based on this setting.

Game.FontCount

This would be useful to know how many fonts are actually included in the game. Currently there's no way to get this number so font parameters to custom functions are potentially hazardous because there is no maximum bounds checking.

[EDIT:]

I edited this thread to add two more suggestions instead of creating two more threads. Go me. :P
#227
Here at my parents house we have DSL. It's pretty nice, and we had a router so that my mom could get on the internet from her laptop from anywhere in the house. Her laptop has completely died now, but that's okay. :D

The reason I'm posting is because for the past few weeks whenever my little sister turns on her computer the main computer as well as hers completely lose internet access. My sister's computer is directly wired to the modem and it worked perfectly fine before (although it did slow down the connection when we were both on).

Both computers are running Windows XP (although how my sister's computer runs XP is beyond me...it only has a 2 GB HDD and 512 MB RAM...slow as crap too). My sister started complaining about her computer asking her what connection she wanted to use or some such and I wasn't exactly a good big-brother and help her out...so she decided to take care of it herself.

Now it seems (I'm not really sure because I don't know all that much about networking) that her computer is trying to assign the same IP address to her computer as the main computer is already using (I say this because once or twice an error message has said there was an IP address conflict with another computer on the network).

I've tried to remove and re-setup the connections and run all the Windows XP network wizards and searched the Windows help-file (lot of good that did me -.-")...and I'm at a loss. I'm hoping that perhaps someone around here that knows a bit more about networking than myself can help me out here.

Thanks,
monkey_05_06
#228
Don't call it a rewrite! :-D

For the first time in years, the ScrollingDialog module is back! And what's more, it actually works this time!!! := This is a major overhaul, written entirely from scratch and is in no way comparable or compatible with the older versions of the module.

You will need AGS 3.4.0.6 or higher to use this module. You will also need the MathsPlus module, which is included in the download.

DOWNLOAD

Why do you need another dialog module? Well, because this one's pretty cool, and if you want to be a cool guy, you'll use it. Just look at this actual, functioning code sample:

Code: ags
function game_start()
{
  ScrollingDialog.Width = 320;
  ScrollingDialog.Height = 75;
  ScrollingDialog.Padding.Top = 5;
  ScrollingDialog.Padding.Left = 5;
  ScrollingDialog.Padding.Bottom = 5;
  ScrollingDialog.Padding.Right = 5;
  ScrollingDialog.X = 0;
  ScrollingDialog.Y = 125;
  ScrollingDialog.TextColorNormal = player.SpeechColor;
  ScrollingDialog.TextColorActive = 14;
  ScrollingDialog.TextColorChosen = player.SpeechColor;
  ScrollingDialog.LineSpacing = 3;
  ScrollingDialog.Bullet.ActiveGraphic = 6;
  ScrollingDialog.Bullet.Padding.Top = 2;
  ScrollingDialog.Bullet.Padding.Right = 3;
  ScrollingDialog.Bullet.Float = eFloatLeft;
  ScrollingDialog.ScrollArrows.Float = eFloatLeft;
  ScrollingDialog.ScrollArrows.Up.NormalGraphic = 10;
  ScrollingDialog.ScrollArrows.Up.MouseOverGraphic = 9;
  ScrollingDialog.ScrollArrows.Up.PushedGraphic = 13;
  ScrollingDialog.ScrollArrows.Up.Padding.Top = 4;
  ScrollingDialog.ScrollArrows.Up.Padding.Bottom = 2;
  ScrollingDialog.ScrollArrows.Up.Padding.Right = 5;
  ScrollingDialog.ScrollArrows.Down.NormalGraphic = 8;
  ScrollingDialog.ScrollArrows.Down.MouseOverGraphic = 7;
  ScrollingDialog.ScrollArrows.Down.PushedGraphic = 12;
  ScrollingDialog.ScrollArrows.Down.Padding.Top = 2;
  ScrollingDialog.ScrollArrows.Down.Padding.Right = 5;
  ScrollingDialog.NumberStyle = eDialogOptionNumbersDrawn;
  ScrollingDialog.TextAlignment = eAlignRight;
  ScrollingDialog.AutosizeHeight = true;
  ScrollingDialog.AnchorPoint = eAnchorBottomLeft;
  ScrollingDialog.Background.Color = 1632;
  ScrollingDialog.Background.Transparency = 75;
  ScrollingDialog.Background.Graphic = 11;
  ScrollingDialog.Background.AnchorPoint = eAnchorCenter;
  ScrollingDialog.MinWidth = 107;
  ScrollingDialog.SetTag("%LOCATION%", "SPARTA");
  ScrollingDialog.Background.BorderDecoration.Top = 6;
  ScrollingDialog.Background.BorderDecoration.Bottom = 6;
  ScrollingDialog.Background.BorderDecoration.TopLeftCorner = 6;
  ScrollingDialog.Background.BorderDecoration.TopRightCorner = 6;
  ScrollingDialog.Background.BorderDecoration.BottomLeftCorner = 6;
  ScrollingDialog.Background.BorderDecoration.BottomRightCorner = 6;
  ScrollingDialog.Background.BorderDecoration.Left = 6;
  ScrollingDialog.Background.BorderDecoration.Right = 6;
  ScrollingDialog.Font = eFontBlackAdder;
}


There isn't a demo game for this (yet), but one may be made (I'm going to ask Secret Fawful to make graphics for it, so if it never happens, blame him).

For the most part, the properties should all speak for themselves as to what they do, and there's some limited documentation in the module. One really cool feature that the module includes is dialog option tagging. What that means is that you can create a custom tag that you will later replace with some other text, such as a character's name. You tell the module what you want to replace the tag with (using ScrollingDialog.SetTag), and then when the dialog options are drawn, the module will handle it for you!

Code: ags
  cPet.Name = "Spike";
  ScrollingDialog.SetTag("%PETNAME%", cPet.Name);


Then if you have a dialog option set to "My dog's name is %PETNAME%." (for example), then the text would be displayed as "My dog's name is Spike.".

There is also a built-in tag for the player name (ScrollingDialog.PlayerNameTag), which is always replaced with the current player name. This will save you from having to change the tag if you change the player, as it will always stay up-to-date with the current player character.

NOTE: If you are using a tagged dialog option, you should always leave the Say check-box unchecked. The module can't overwrite the actual dialog option text, so if the player reads that option, they would end up saying the original text, as set up in the editor. If you want the player to read that option, then instead include a line such as this in your dialog script:

Code: ags
// dialog script
@S
return;
@1 // My dog's name is %PETNAME%.
  player.Say(ScrollingDialog.SelectedOption.Text); // say "My dog's name is Spike."
return;


This will ensure that the dialog tags are replaced appropriately.
#229
As a bit of coding practice, I've been playing around with making my own string class for C++. For the most part it will be based off of the std::string class's functionality, but I'm trying to include a formatting function that works like AGS's String.Format (except that, like the other std::string functions, it does modify the string).

However, I've apparently ran into some sort of memory management issues or something as my program keeps crashing.  This is what I'm doing:

Code: ags
#ifndef __STRING_H
#define __STRING_H 1
#ifndef _GLIBCXX_IOSTREAM
#include <iostream>
#endif
#ifndef _STDARG_H
#include <stdarg.h>
#endif
#ifndef _STDLIB_H_
#include <stdlib.h>
#endif

class String {
  protected:
    char* __buffer;
  public:
    typedef unsigned int size_type;
    String();
    String(const char letter);
    String(size_type char_count, const char letter);
    String(const char* newstr, size_type index = 0, size_type length = 0);
    String(const String& newstr, size_type index = 0, size_type length = 0);
    ~String();
    size_type find(const char letter) const;
    size_type find(const char* str, size_type index = 0, size_type length = 0) const;
    size_type find(const String& str, size_type index = 0, size_type length = 0) const;
    String& format(const char* fmt, ...);
    String& format(const String& fmt, ...);
    String& replace(size_type index, size_type length, const char letter);
    String& replace(size_type index, size_type length, const char* str);
    String& replace(size_type index, size_type length, const String& str);
    static inline const size_type length(const char* str);
    inline const size_type length() const;
    friend std::ostream& operator<<(std::ostream& __out, const String& str);
    static const size_type npos = 4294967295U;
  };

String::String() {
  delete [] __buffer;
  __buffer = new char('\0');
  }

String::String(const char letter) {
  delete [] __buffer;
  __buffer = new char(letter);
  *(__buffer + 1) = '\0';
  }

String::String(const char* newstr, size_type index, size_type length) {
  delete [] __buffer;
  if ((!String::length(newstr)) || (index >= String::length(newstr))) {
    __buffer = new char('\0');
    return;
    }
  if ((!length) || (length > String::length(newstr))) length = String::length(newstr) - index;
  __buffer = new char[length];
  for (size_type i = 0, j = index; i < length; i++, j++)
    *(__buffer + i) = *(newstr + j);
  *(__buffer + length) = '\0';
  }

String::String(const String& newstr, size_type index, size_type length) {
  delete [] __buffer;
  if ((!newstr.length()) || (index >= newstr.length())) {
    __buffer = new char('\0');
    return;
    }
  if ((!length) || (length > newstr.length())) length = newstr.length() - index;
  __buffer = new char[length];
  for (size_type i = 0, j = index; i < length; i++, j++)
    *(__buffer + i) = *(newstr.__buffer + j);
  *(__buffer + length) = '\0';
  }

String::size_type String::find(const char letter) const {
  for (size_type i = 0; i <= length(); i++) if (*(__buffer + i) == letter) return i;
  return npos;
  }

String::size_type String::find(const char* str, size_type index, size_type length) const {
  for (size_type i = 0; i <= String::length(); i++)
    if (*(__buffer + i) == *str)
      for (size_type j = i, k = 0; ; j++, k++) {
        if (k == String::length(str)) return i;
        if ((j > String::length()) || (*(__buffer + j) != *(str + k))) break;
        }
  return npos;
  }

String::size_type String::find(const String& str, size_type index, size_type length) const {
  for (size_type i = 0; i <= String::length(); i++)
    if(*(__buffer + i) == *str.__buffer)
      for (size_type j = i, k = 0; ; j++, k++) {
        if (k == str.length()) return i;
        if ((j > String::length()) || (*(__buffer + j) != *(str.__buffer + k))) break;
        }
  return npos;
  }

String::size_type string_format_get_index(String& fmt) {
  if ((fmt.find("%d") == String::npos) && (fmt.find("%s") == String::npos) &&
  (fmt.find("%f") == String::npos)) return String::npos;
  String::size_type index = fmt.find("%d");
  if (fmt.find("%s") < index) index = fmt.find("%s");
  if (fmt.find("%f") < index) index = fmt.find("%f");
  return index;
  }

String& String::format(const char* fmt, ...) {
  // support %d for ints, %s for Strings, and %f for floats
  *this = fmt;
  if ((find("%d") == npos) && (find("%s") == npos) && (find("%f") == npos))
    return *this;
  va_list ap;
  va_start(ap, fmt);
  for (size_type index = string_format_get_index(*this); index != npos; index = string_format_get_index(*this)) {
    char type = (*this)[index + 1];
    char* temp;
    if (type == 'd') {
      replace(index, 2, itoa(va_arg(ap, int), temp, 10));
      delete [] temp; // this is to try and make sure the string isn't stored in dynamic memory as I'm not sure how itoa works....
      }
    if (type == 's') replace(index, 2, va_arg(ap, char*));
    if (type == 'f') {
      // no support for adding floats to Strings yet!
      }
    }
  va_end(ap);
  return *this;
  }

String& String::replace(size_type index, size_type length, const char letter) {
  if (index >= String::length()) return *this;
  if ((!length) || (length > String::length())) length = String::length() - index;
  char temp[(String::length() - length) + 1];
  for (size_type i = 0; i < index; i++)
    *(temp + i) = *(__buffer + i);
  *(temp + index) = letter;
  for (size_type i = index + 1, j = index + length; j <= String::length(); i++, j++)
    *(temp + i) = *(__buffer + j);
  delete [] __buffer;
  __buffer = new char[String::length(temp)];
  for (size_type i = 0; i <= String::length(temp); i++)
    *(__buffer + i) = *(temp + i);
  return *this;
  }

String& String::replace(size_type index, size_type length, const char* str) {
  if (index >= String::length()) return *this;
  if ((!length) || (length > String::length())) length = String::length() - index;
  char temp[(String::length() - length) + String::length(str)];
  for (size_type i = 0; i < index; i++)
    *(temp + i) = *(__buffer + i);
  for (size_type i = index, j = 0; j < String::length(str); i++, j++)
    *(temp + i) = *(str + j);
  for (size_type i = index + String::length(str), j = index + length; j <= String::length(); i++, j++)
    *(temp + i) = *(__buffer + j);
  delete [] __buffer;
  __buffer = new char[String::length(temp)];
  for (size_type i = 0; i <= String::length(temp); i++)
    *(__buffer + i) = *(temp + i);
  return *this;
  }

String& String::replace(size_type index, size_type length, const String& str) {
  if (index >= String::length()) return *this;
  if ((!length) || (length > String::length())) length = String::length() - index;
  char temp[(String::length() - length) + str.length()];
  for (size_type i = 0; i < index; i++)
    *(temp + i) = *(__buffer + i);
  for (size_type i = index, j = 0; j < str.length(); i++, j++)
    *(temp + i) = *(str.__buffer + j);
  for (size_type i = index + str.length(), j = index + length; j <= String::length(); i++, j++)
    *(temp + i) = *(__buffer + i);
  delete [] __buffer;
  __buffer = new char[String::length(temp)];
  for (size_type i = 0; i <= String::length(temp); i++)
    *(__buffer + i) = *(temp + i);
  return *this;
  }

inline const String::size_type String::length(const char* str) {
  if (!str) return 0;
  for (size_type i = 0; ; i++) if (*(str + i) == '\0') return i;
  }

inline const String::size_type String::length() const {
  return length(__buffer);
  }

String::~String() {
  delete [] __buffer;
  }

std::ostream& operator<<(std::ostream& __out, const String& str) {
  return (__out << str.__buffer);
  }

#endif


I've also overloaded all the appropriate operators...if you want those just ask. I figured this code was long enough as it was.

Anyway, I can format strings like this:

Code: ags
String str;
str.format("this is some %s that has been %s", "text", "formatted");


And the like. However, if I try to insert integers:

Code: ags
String str;
str.format("the answer is %d", 42);


The program terminates...somewhere after properly formatting the string, but before it manages to return....

Just curious if anyone had any ideas on what I could do to resolve this problem.
#230
It's been asked a billion times over, and CJ has said several times he would consider it for a future version of AGS. It has plagued the nightmares of wanna-be adventure game makers for years. And the question is this:

When will AGS support structs within structs?

I understand CJ has said that he will implement it, but the question remains, when? CJ has a lot of bugs and suggestions to implement, but it seems this isn't even on the tracker?

As for the forum I'm putting this in, the question doesn't seem very technical any more as it is not a question of "can it be implemented", just rather a question of how high a priority it is and how soon one could expect to see it.

Tonight I was working on an old project of mine when I realized I can't put a vector as a data member of a struct...:D. Now it could be worked around in this case...but it makes it a lot more difficult.

In any case, I'd like to say that I appreciate all CJ has done in making AGS the best game engine available.
#231
UPDATE 20 MARCH 2009: In addition to the download links being long broken, this module is now officially deprecated. See the new and improved Stack module which provides similar functionality (still vectorized!), in a generic manner.

Quote from: VectorClass manual[/url]/*****************************
Description:

Provides vector (dynamic array) classes for  use  with  integers,  Strings,  and
floating point decimals. Based on a script by HeirOfNorton.
*****************************/

Vectors are dynamically sized arrays. They are useful when you don't know the size of array demanded. You can't create a #define based on a variable so the alternative in this situation would be creating a very large array, or limiting the size of the array.

With vectors you don't have to worry about setting the size as it can change dynamically as needed.

They can also save memory if you use a vector instead of a large array that may not be entirely used...

For example, as a make-up project for my seminary class last school year, I used AGS to make a very simple program to place the 20 students into 3 groups randomly. Supposing we had gained more students, and had I used a vector in designing the program and made it so new students could be added and students could be removed...it would be easier to just allow the user to increase the size of the array (vector) rather than having to recompile...considering when I made it I only made it with the 20 spaces for the 20 existing students.

I've put three vector classes (iVector (integer vector), sVector (String vector), and fVector (float vector)) into one module:

Requires AGS v2.71 or higher!

Download the VectorClass v1.0 module here
Mirror Thanks Neole!

And I exported the classes to their own modules (Require AGS v2.71 or higher!):

Download the IntVector v1.0 module here
IntVector Mirror Thanks Neole!
Download the StringVector v1.01 module here
StringVector Mirror Thanks Neole!
Download the FloatVector v1.01 module here
FloatVector Mirror Thanks Neole!

If the downloads don't work, try going to my website and clicking the appropriate link...it should work from there.

Thanks to HeirOfNorton for the idea and his code which I referred to in writing these modules.

Edit:

13 July 2006 - Uploaded StringVector v1.01 which is compatible with the new VectorClass module.
13 July 2006 - Uploaded FloatVector v1.01 which is compatible with the new VectorClass module.
15 August 2006 - I'm changing my host, so you may need to right-click and choose "Save as..." (in my experience trying to link directly to the files opens it as if it were a text file). If that doesn't work, feel free to PM me and let me know. I'll try and have this issue resolved as quickly as possible. Thanks.
#232
The Properties module provides methods for the user to create, edit, and delete custom properties via the script at run-time.

06 October 2008

Okay, I'm fairly certain this is the last major bug fix. Originally the point of eProperties_MaxRooms was to prevent the property functions being used in rooms numbered higher than that, but I forgot one line of code (in 12 places!) and it would crash the game if you didn't manually specify a room while the player was in an unsupported room.

I've also implemented default interaction methods. In the included documentation they're listed at the very bottom with a special note that they are only included pending the definition of the PROPERTIES_DEFAULTINTERACTION macro (which is defined by default). This defines the property DefaultInteraction to simplify the process for games which would like the ability to define default interactions (for example, the default for the property is eModeWalkto but for oDoor you may want to change the default interaction to eModeOpen (SCUMM interfaces) or eModeInteract).

05 October 2008

No point bumping this thread again, I'll just put the update here and be on my way. I realized in using the module that I'd mucked up the inventory functions which have now been fixed. Unlike Characters, InventoryItems are indexed from one not zero. All the room-based functions are handled differently anyway and are unaffected. But it's been fixed as of v3.11.

30 September 2008

This isn't a major update over v3.0, but there are some important changes. The module now defines static limits on the number of properties. These can be changed, but if you're going to change them you should read the included documentation/commentation first.

Also, you can once again delete properties. Instead of "removing" the entry, I simply reuse the slot and keep track of the lowest available slot number.

Aside from that this release is largely the same as 3.0. If you have any questions, comments, or otherwise, feel free to post or PM me. -monkey

[Module Pros:]

  • Create custom properties at run-time.
  • Delete custom properties at run-time.
  • Edit custom properties at run-time.

[Module Cons:]

  • All properties must be created, deleted, and set from within the script. You can't use the built-in Properties Schema Editor.
  • There is currently no "friendly" description of the properties. If requested this may change. Actually since the "name" of the property is a String, you can make the name as friendly as you'd like.


Download here (Requires AGS v3.1.0 or higher)
View the manual online
v3.0 Mirror 1
v3.0 Mirror 2 Thanks again Neole!
Download v2.0 (for use with AGS 2.72)
Mirror v2.0 Thanks Neole!
Mirror v1.0 Thanks jasonjkay!

For more information on what custom properties are, RTFM n00b! :=
#233
************************
The PersistentSpeech Module
************************

A module for creating speech that lasts for extended periods of time.

************************

Download the PersistentSpeech module v3.0
Mirror

[NOTES:]

*This module now uses extender methods and is NOT compatible with any version of AGS prior to AGS 3.1!
*This module uses new-style Strings and is NOT compatible with any version of AGS prior to AGS 2.71.

[EDIT:]

30 December 2008 - After only 2 1/2 years I decided it was time I update this (as well as the download link! :P). The module now uses extender methods and supports optional blocking, animation direction, and text alignment! Yay!

02 June 2006 - Uploaded v. 2.1 which contains a grammatical fix (PersistantSpeech to PersistentSpeech), positions text automatically above Character's head, renamed PersistentSpeech.GetLoops to PersistentSpeech.GetFramesRemaining, and made xOffset and yOffset parameters for PersistentSpeech.Say optional.
#234
While trying to make a demo for my latest module, LineBreak, I encountered some strange feedback that I thought was some crazy bug in my module.

However, I have done extensive testing with Display checking things out as they are run, and the problem is actually with String.Contains.Ã,  I have even taken the problem String away from all module functions and checked the results, and finding the same problem.

I have the following code in game_start:

Code: ags
String Text = "The lines read as follows:\\LineBreak: R\\This is just some \\LineBreak: R\\example text for the \\LineBreak: R\\LineBreak module demo,\\LineBreak: R\\set up to flood the line \\LineBreak: R\\and show how the module\\LineBreak: R\\can be utilized.";
Display("Contains: %d", Text.Contains("\\LineBreak: H\\"));


There is a reason why I'm testing for "\\LineBreak: H\\" (which clearly isn't in the String) and not "\\LineBreak: R\\" (which is). The number displayed is 212.

This has caused a lot of problems with my module because it's very confused and there's some other crazy crap happening because of it.

The String I searched clearly didn't contain the String I was searching for. So why is String.Contains saying it does?Ã,  My only guess is that it has to do with the length of the String...?

[EDIT:]

Quote from: Pumaman on Sat 14/01/2006 22:47:30* Fixed String.Contains not working properly with strings >200 characters.

Fixed as of AGS 2.72 Final. Thanks Chris! ;D
#235
Quote from: The LineBreak v1.0 Manual[/url]/*****************************
Description:

The LineBreak module was written with the intent to provide functions to insert,
remove, and manage line-breaks within  Strings  of  text.  The  module  contains
functions for adding line-breaks (a String which is interpreted by the  module),
testing whether a String contains any line-breaks, converting module  line-break
Strings into AGS compliant line-breaks (an  opening  bracket  ('[')  within  the
text), converting AGS bracketed line-breaks into  module  line-breaks,  counting
the lines a String contains, retrieving the type of line-break a String contains
(hyphenated, broken based on width, or based on a set of  delimiters),  removing
line-breaks from a String, parsing a String which is then read back  by  another
function a single line at  a  time,  and  retrieving  the  last  parsed  String.
*****************************/

******************
The LineBreak Module
******************

A module for creating and managing line-breaking text.

Now verified to work better and be more stable than AGS itself!*
******************

That's right people. I actually finished a module this time. I tested it rather rigorously to make sure everything works the way I intend it to (this means if you encounter any errors they were intentional and not bugs :=).

There is a related discussion here (which should now be closed ;)), but please post further comments/questions here.

Download the LineBreak module v. 1.0a
Read the LineBreak module manual

[NOTES:]

  • This module was written with AGS 2.72 RC1 and may or may not be compatible with earlier versions of AGS (verified 01 July 2006 by monkey_05_06 to work with AGS 2.71).
  • This module contains new-style Strings and is NOT compatible with any versions of AGS prior to AGS 2.71.
  • String.Contains is currently bugged, so this module will NOT work with any Strings longer than 200 characters. (Fixed as of AGS 2.72 Final; using Strings longer than 200 characters with this module and prior versions of AGS is unsupported as String.Contains is bugged in prior versions)

    [EDIT:]

    25 June 2006 - Updated to version 1.0a with a minor bug fix which was returning invalid Strings from LineBreak.AddLineBreaks.

    *Just kidding. There's currently a bug with String.Contains which causes the function to return junk values with Strings greater than 200 characters. This function is extensively used by the module, so if you try to pass Strings greater than 200 characters it won't work (yet).

    Quote from: Pumaman on Sat 14/01/2006 22:47:30* Fixed String.Contains not working properly with strings >200 characters.

    The bug with String.Contains has been fixed.

    15 August 2006 - I'm changing my host, so you may need to right-click and choose "Save as..." (in my experience trying to link directly to the files opens it as if it were a text file). If that doesn't work, feel free to PM me and let me know. I'll try and have this issue resolved as quickly as possible. Thanks.
#236
Okay, so we can't have String values implemented as enumerated values, but I've come up with an idea for a workaround...basically it goes like this:

Code: ags
enum LineBreak_Defaults {
  eLineBreak_DefaultDelimiters, // this is for autocompletion, the String value cannot be set here
  // ...
  };

#define eLineBreak_DefaultDelimiters " .,\"'\\})-"  // this is where the value for eLineBreak_DefaultDelimiters is set


If I try to compile, I get the following error:

Quote---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:

In: 'LineBreak'



Error (line 63): Parse error: invalid use of operator '/'



Do you want to fix the script now? (Your game has not been saved).
---------------------------
Yes   No   
---------------------------

So, I try to use a block comment, and get this error:

Quote---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:

In: 'LineBreak'



Error (line 63): Parse error: unexpected operator '*'



Do you want to fix the script now? (Your game has not been saved).
---------------------------
Yes   No   
---------------------------

Shouldn't these be interpreted as comments?

It works fine without the comment on the #define line.
#237
I've had an idea for a new module, and is one that I will use even if no one else does (and yes, it's one that I plan to complete (properlyÃ,  ;)) before release (bugs are one thing, completely broken modules are another :=)).

Its tentative name is LineBreak, and as the name may (or may not, I don't know how you might interpret it...) imply, will be designed to manage line-breaks (such as word-wrapping).Ã,  There's still a lot up in the air about the module, but some of the basic ideas I have at this point are:

- A function to add line breaks to a String (based upon strictly the width of the text, the end of the word (based upon a user-defined String of Delimiters), or a hyphenated line-ending).Ã,  The line breaks would be inserted as some type of text-based identifyer, such as "\\LineBreak: H\\" for a hyphenated line break.
- A function to remove the line breaks.
- A function to parse text containing line breaks with a separate function to retrieve a single line at a time.
- A function to test whether a String contains line breaks.

In essence the function the module would set out to perform would be a simple one, but then aren't some of the other modules out there somewhat simplistic as well?

A tentative example of how the module might be used follows:

Code: ags
String Sentence = "From what you can tell the old moth-eaten leather jacket bares little real value, however, the old man clings to it as if it were made of gold.";
Sentence = LineBreak.AddLineBreaks(Sentence, eLineBreak_Hyphenate, 2, 45); // text, line type, font, width
LineBreak.Parse(Sentence);
String Line = LineBreak.GetLine();
while (Line != null) {
  Display(Line);
  Line = LineBreak.GetLine();
  }


That would display the text as it would be broken up if displayed in font 2 with 45 pixel lines.

Anyway, the module is still under production (and it could be slow as I don't live with my parents anymore so I can't work on it everyday (probably only on the weekends) (but it will be coming)), and I just wanted to see what you guys thought.

My mom is bugging me to get off her laptop so I have to go.
#238
General Discussion / SSH not required!
Fri 21/04/2006 20:58:42
Well...I've always liked to show my contempt for that module producing Scottsman.

Just kidding.  I like SSH.  But get a load of what I just got in my email.  Perhaps taken into context it's not funny at all...but it caught my eye and I ended up reading it first.  :D

At 50% (click to see full size):


P.S....Look at my Spam folder!!! LOL!

[EDIT:]

Image mirror at ImageShack
#239
Would it be possible for static functions to have access to writeprotected members of instances of the same struct?

i.e., say I have a struct like this:
Code: ags
struct MyStruct {
  writeprotected int wpInt;
  import bool SetInt(int value);
  import static void RandomizeInt();
  };

(not a particularly good example...)

SetInt can be used to assign a new value to wpInt, but RandomizeInt has no access to it.  This is seemingly pretty similar to the question I asked before about struct member access specifiers.

I understand that it has been looked into, and people have gotten used to the way things are and I can't expect AGS to simulate C++ exactly...it's just a feature I would find very useful (and furthermore, there's no tracker entry for it).

In any case, I'd really like to see this implemented in this version of AGS.  And it seemed safer to ask here than create another thread very similar to the one I started before or dragging it back up after 8 months.
#240
Here lately I've been working with the function GetTextWidth(const string text, int font), and I've been thinking...wouldn't it make more sense if there was some sort of function like String.Width(int font) to handle this?

Of course this would mean the text would have to be stored into a String, but I don't think that would be such a big deal.

Also, String.Height(int font) could be created to take the place of GetTextHeight(const string text, int font).
SMF spam blocked by CleanTalk