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

#1341
Note that if you do

Code: ags

  if (character[GetPlayerCharacter()].inv[18] == 1) { // if player character has EXACTLY ONE inv item 18


the condition will only be true if the character has exactly one inv item 18.
So if you picked up inv item 18 two times or more, the following code won't be executed.

To be on the safe side, do it like this:

Code: ags

  if (character[GetPlayerCharacter()].inv[18]) { // if player character has ONE OR MORE of inv item 18
#1342
I think in the documentation for the RawDraw functions, it should be made clear that the coordinates are room coordinates.
Currently, it says "onto the screen at location (X, Y)" which is a bit misleading IMO.
#1343
1.) Multi-dimensional arrays are currently not supported (directly) so you have to work around it.
Take a look in the Technical Archive for solutions.

2.) SetVoiceMode

3.) How do you change rooms? When the player walks onto a region or hotspot or when you click on the door?
Not everybody does things the same way so please elaborate on how you do it (room setup, code examples etc.).
#1344
In AGS v2.62 it's
  character[GetPlayerCharacter()].inv[18] = 0; // player character loses ALL of inv item 18
  LoseInventory(18); // player character loses ONE instance of inv item 18
  LoseInventoryFromCharacter(MAN, 18); // character MAN loses ONE instance of inv item 18

cEgo and the like will only work with the upcoming AGS v2.7.
And there it's
  player.InventoryQuantity[iThing.ID] = 0; // player character loses ALL of inv item iThing
  player.LoseInventory(iThing); // player character loses ONE instance of inv item iThing
  cMan.LoseInventory(iThing); // character MAN loses ONE instance of inv item iThing
#1345
You could do something like this for example:

Make a view with each loop containing a different animation of a rain drop falling down, then:

Code: ags

// room script file

#define RAINDROP_AMOUNT 100 // number of rain drops to draw
#define RAINDROP_VIEW 21 // view number containing animation loops
#define RAINDROP_ANIMDELAY_MIN 5 // animation speed will be randomized between these two values
#define RAINDROP_ANIMDELAY_MAX 20

struct RainDrop {
  int loop; // stores current loop
  int frame; // stores current frame
  int framedelay; // stores delay until next frame
  int animationdelay; // stores overall animation speed
  int x; // stores x-location
  int y; // stores y-location
};

RainDrop raindrops[RAINDROP_AMOUNT];


function room_a() {
  // script for room: Player enters screen (before fadein)

  RawSaveScreen(); // save default (clean) background frame

}


function repeatedly_execute_always() {

  RawRestoreScreen(); // restore clean background frame

  int dropid = 0; // start with first drop
  while (dropid < RAINDROP_AMOUNT) { // loop for each drop

    if (raindrops[dropid].framedelay) raindrops[dropid].framedelay--; // if delay until next frame has not elapsed, decrease it
    else { // if delay until next frame has elapsed

      if (raindrops[dropid].frame >= GetGameParameter(GP_NUMFRAMES, RAINDROP_VIEW, raindrops[dropid].loop, 0)) // if animation has finished
        raindrops[dropid].frame = 0; // go to first frame

      if (raindrops[dropid].frame == 0) { // if at first frame (new animation)
        raindrops[dropid].loop = Random(GetGameParameter(GP_NUMLOOPS, RAINDROP_VIEW, 0, 0) - 1); // randomly select new loop from rain drop view
        raindrops[dropid].animationdelay = RAINDROP_ANIMDELAY_MIN + Random(RAINDROP_ANIMDELAY_MAX - RAINDROP_ANIMDELAY_MIN); // randomize overall animation speed
        raindrops[dropid].x = Random(game.room_width); // randomize x-location
        raindrops[dropid].y = Random(game.room_height); // randomize y-location
      }

      raindrops[dropid].framedelay = raindrops[dropid].animationdelay + GetGameParameter(GP_FRAMESPEED, RAINDROP_VIEW, raindrops[dropid].loop, raindrops[dropid].frame); // set delay until next frame

      raindrops[dropid].frame++; // go to next frame
    }

    RawDrawImage(raindrops[dropid].x, raindrops[dropid].y, GetGameParameter(GP_FRAMEIMAGE, RAINDROP_VIEW, raindrops[dropid].loop, raindrops[dropid].frame - 1)); // draw rain drop on background

    dropid++; // loop to next drop
  }

}


Or you could use a single image and automatically draw it resized with RawDrawImageResized. I can whip something up later if you're interested.
#1346
The char data type can only store values 0-255. If you pass -1, it seems to get converted to 255. So the error messages are correct.

QuoteError: Cannot display message with extended characters in SCI font

SCI fonts only have ASCII characters 1 to 127 so trying to display ASCII code 255 doesn't work of course. Only TTF fonts support extended characters.

QuoteError: Array index out of bounds (index: 255, bounds: 0..4)

Obvious.

Do I understand correctly that you think the conversion is a bug and want AGS to abort the game if you try to assign a value to a variable that exceeds the bounds defined by its data type?
#1347
Beginners' Technical Questions / Re: Room Lost
Sat 23/04/2005 02:54:28
QuoteAll I have is backups of the game data.

If you have a backup of the room file itself, you can simply copy it back in the game folder. Otherwise I'm afraid you'll have to redo the room.
#1348
(Btw, Mist)

If you make your own SCI font, and if you replace a special character like # with the Ã,, for example, you have to use # in the message text instead:

DisplaySpeech(MAN, "#tzend!");

It might be easier to use a TrueType font. I think the Maniac Mansion Mania Starterpack has a good looking one.
#1350
Does everybody agree that with the new Button.ClipImage the ProgessBar GUI control is not needed anymore?
I feel it's now easy enough to workaround that it doesn't warrant a specialized GUI control that wouldn't get used that often anyway.
#1351
With AGS v2.7, you could use a button with graphic clipping enabled and adjust its width.
#1352
Good idea!

I've abandoned this since you can't use it with dialog scripts and I decided to just use a TTF font instead.
My main gripe with TTF fonts was that it's hard to find a font with a fitting accompanying outline font. I don't like the look of the automatic outlining feature so I'm in the process of making a fixed-size TTF font & outline myself. Works great so far.
#1353
Advanced Technical Forum / Re: editor.dat
Thu 21/04/2005 22:22:00
Look if there's a file called backup_editor.dat in the game folder.
Rename the original editor.dat and rename backup_editor.dat in editor.dat, then try opening the game again.
#1354
Quote
Quote
In that case, since someone might rely on GUI controls still being clickable when disabled, how about a GUIControl.Clickable property?

What are we talking about here? Having a disabled control that it still clickable, or an enabled control that is not clickable?
Either way, this is leading to feature creep again, so can we please not have any new suggestions in this thread.

GUI controls that are disabled are still clickable, aren't they?
I just suggested it as a workaround in case you decided to leave the z-order as it is.

Edit:

As Rui said, by clickable I mean they won't let clicks through to the GUI control beneath it.
#1355
Hehe, you're welcome.  :)
#1356
That's because there are braces missing:

function on_event(int event, int data) {
  //...

  if (event == LOSE_INVENTORY) { // if player just lost an inv item

    if ((IsGUIOn(INVENTORY)) && (GetCursorMode() == MODE_WALK)) {
      SetCursorMode(MODE_USE);
      SetMouseCursor(6);
    }

  }

  //...
}

If you add more than one line after an if-clause, you have to enclose them in braces for them to be included:

if (a) {
b;
c;
}

If you do

if (a)
b;
c;

only b gets included in the if-clause. It's the same as if you would do

if (a) b;
c;
#1357
QuotePreferably NO SCRIPTING

Haha, you wish! ;)

There's the TPC/IP plugin, but there are no games that use it yet. Good luck!
#1358
Quote from: Pumaman
Quote from: strazer
Shouldn't the Say command leave the Wait cursor graphic alone?

Currently the Say command does
mouse.UseModeGraphic(6);

I'll modify it to check if the current mode is already Wait, and if so not change the cursor.

A blocking Object.Animate (and I suspect a lot of other blocking functions) seems to do the same.

The reason I asked for this in the first place is because in some situations I want the user not to notice that the game is blocked for a moment.
To do this, I change to the Wait cursor first, change its graphic to the previous cursor mode, do the stuff, then revert to the previous mode.

So wouldn't it be better to modify Mouse.UseModeGraphic itself to check if the cursor is already in the same mode, and if so, not change the cursor?
#1359
QuoteI don't understand the Mac comment though - that still seems like a random nitpick.

I think s/he meant that it is an abbreviation of Macintosh, not an acronym, hence it is written Mac, not MAC.
#1360
Try this:

Code: ags

function on_event(int event, int data) {
  //...

  if (event == LOSE_INVENTORY) { // if player just lost an inv item

    if ((IsGUIOn(YOURCUSTOMINVGUI)) && (GetCursorMode() == MODE_WALK)) // if the inv GUI is displayed and mouse has changed to walk mode (lost active inv item)
      SetCursorMode(7); // set mouse to pointer mode

  }

  //...
}
SMF spam blocked by CleanTalk