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

#1541
I think he knows how to move characters and that the problem is moving the character while he is performing an animation.

I've tested it and it seems the walking loops of the locked animation view are used when moving the character with the MoveCharacter* commands.
All I can think of at the moment is modifying the character.x variable directly with something like this:

Code: ags

  SetCharacterView(THECHAR, 10); // lock view 10 for animation
  AnimateCharacter(THECHAR, 3, 0, 1); // start repeating animation using view loop 3

  int i = 0; // declare loop counter
  while (i < 30) { // repeat the following 30 times:
    character[NAME].x -= 1; // move character 1 pixel to the left
    Wait(1); // wait 1 game loop
    i++; // increase loop counter
  }

  ReleaseCharacterView(THECHAR); // stop animation and restore normal view
#1542
QuoteWhat is the difference between the two (capitalized and small) ? Which one should I use?

The capitalized versions are the names of the structs from which entities are derived:

managed struct Object {
  // a lot of properties and functions, among other things:
  import static Object* GetAtScreenXY(int x, int y);    // $AUTOCOMPLETESTATICONLY$
  import attribute int  X;
};

All room objects are instances of this struct, so you can do:

oSomeobject.X = 100;

The lowercase versions are arrays with which you can access entities by their number instead of their script o-name:

object[1].X = 100;

structs can also have static member functions. GetAtScreenXY is a static member function, in effect a global function that returns an Object:

Object *myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
myobject.X = 100;


It's kinda hard to explain, I hope this makes it a bit more clear.
#1543
I beg to differ. (AGS v2.7 RC2)

Edit:

To clarify what I mean:
When you create a png, the default layer is called "Background". Now add another layer and delete the background layer. If you use this png as your GUI background, buttons on this GUI are drawn with an alpha-channel (everything in 32-bit of course).
#1544
You'd have to set the label text yourself in rep_ex to do this.

Try this:

Code: ags

// main global script file

char mouseoverdescription[200];
export mouseoverdescription;

function repeatedly_execute_always() {
  //...

  if (StrComp(mouseoverdescription, "") == 0) // if string is empty
    GetLocationName(mouse.x, mouse.y, mouseoverdescription); // get name of entity under mouse cursor
  lblDescription.SetText(mouseoverdescription); // set label text
  StrCopy(mouseoverdescription, ""); // empty string

  //...
}


Code: ags

// main script header

import char mouseoverdescription[200];


Code: ags

// room script file

function repeatedly_execute_always() {

  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hSomeHotspot) && (somecondition)) // somecondition = e.g. already examined?
    StrCopy(mouseoverdescription, "new name");

}


I agree Object.SetName and Hotspot.SetName are badly needed.
#1545
My guess is the ClaimEvent command is invalidated when you change rooms.
You could work around it by setting a global variable/GlobalInt in your first room's on_mouse_click and check it in the on_mouse_click of the new room and running ClaimEvent there.
#1546
I've noticed that if you use a GUI background image without a background layer (i.e. a png), the GUI Buttons on this GUI are drawn with an alpha-channel.
#1547
Code: ags

function unhandled_event(int what, int type) {

  if (what == 5) { // if clicked on an inventory item
    if (type == 3) { // if inv item cursor mode used
      int resp = Random (2);
      if (resp == 0) DisplaySpeech(GetPlayerCharacter(), "That doesn't work.");
      else if (resp ==1) DisplaySpeech(GetPlayerCharacter(), "They don't go together.");
      else if (resp == 2) DisplaySpeech(GetPlayerCharacter(), "I can't use this like that.");
    }
  }
  else if (what == 3) { // characters
    if (type == 3) { // inv item cursor mode
      int resp = Random (2);
      if (resp == 0) DisplaySpeech(GetPlayerCharacter(), "I won't give that away.");
      else if (resp ==1) DisplaySpeech(GetPlayerCharacter(), "I don't think that would be appreciated.");
      else if (resp == 2) DisplaySpeech(GetPlayerCharacter(), "No, I might need it later.");
    }
  }
  // else if (what == 2) { // objects
  // ...

}


Quote from: strazer
Check the manual for all number combinations you can use.
#1548
Barbarian:
Quote(Without having to put in the command for absolutely every different object/item/character combination).

hogie, or click menu "Script" -> "unhandled_event". This takes you directly to the function within the global script if it is already present.

Edit: I see you have worked it out. Good job.
#1549
The unhandled_event function is called everytime you do something for which you haven't defined an interaction:

Code: ags

// main global script

function unhandled_event(int what, int type) {

  if (what == 5) { // if clicked on an inventory item
    if (type == 3) { // if inv item cursor mode used
      DisplaySpeech(GetPlayerCharacter(), "That doesn't work.");
    }
  }

}


Check the manual for all number combinations you can use.
#1550
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?
#1551
Quote from: strazer on Sun 26/09/2004 06:24:42
A flic is basically a movie, a series of images but without (its own) sound.
.FLI supports only one resolution: 320x200 with 256 colors
.FLC supports any resolution up to 1024x768 with 256 colors.

You can use the RAD Video Tools to convert a series of pictures into a flic ("List files...", save list, select .lst file, "Convert a file", "Output type...", ...).
#1553
Have you actually tested it?
I assumed Display commands are always drawn on top of everything else.
And sure enough, using AGS v2.7 RC2, I couldn't make the custom text window gui NOT display on top of everything. Where it is in the gui list doesn't seem to matter.
#1554
No prob. I'm happy to help. :)
#1555
Manual: Reference -> Text script global variables -> game.skip_display

If you don't want to do this globally for all Display commands, you could use a custom function:

Code: ags

// Main global script

function myDisplay(string text) {
  int oldsetting = game.skip_display;
  game.skip_display = 0;
  Display(text);
  game.skip_display = oldsetting;
}


Code: ags

// Main script header

import function myDisplay(string text);
#1556
Glad I could help. :)

And don't worry, you've posted in the right board.
#1557
Advanced Technical Forum / Re: code wont work
Thu 10/03/2005 17:31:27
Try this:

Code: ags

ccCreateCommand(1, "MOVE:200,115;MOVE:310,118;");
ccAppendCommand(1, "ROOM:4,13,110;MOVE:155,115;MOVE:150,180;MOVE:10,188;");
ccAppendCommand(1, "ROOM:3,300,180;MOVE:250,180;MOVE:70,140;GOTO:1;");

ccCreateCommand(2, "MOVE:150,140;MOVE:150,110;SET:Global(11)=0;");
ccAppendCommand(2, "ROOM:16,150,190;SET:Global(10)=0;MOVE:150,140;MOVE:150,110;MOVE:150,140;MOVE:150,190;SET:Global(10)=0;WAIT:120;");
ccAppendCommand(2, "ROOM:14,150,110;SET:Global(11)=1;MOVE:150,140;MOVE:150,190;SET:Global(11)=1;MOVE:150,140;MOVE:150,190;GOTO:2;");


All I did was remove all the spaces (not sure if they are allowed or not) and break the strings up in more commands.
#1559
Could be your sound card: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=18520.msg225495#msg225495

Try installing the latest drivers for the card and/or the latest version of DirectX.
#1560
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?
SMF spam blocked by CleanTalk