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

#21
Use a function SetupButton(GUIControl *button, int gfx, string description, int topictostart, .......)
and setup every button individually.
#22
Yes, Controls is an array (perhaps a GUIControl* array)
Icons is a GUIControl* array, too.

This...
  GUIControl *Ico[4];
  Ico = gButtons.Controls;
...is impossible in AGS (it is possible in Java, maybe in C++). A pointer to pointer would do the job:
  GuiControl **Ico;
  Ico = gButtons.Controls;
  Ico[1].blablabla....

Anyway this isn't the point, it is not very necessary :)

#23
Quote from: strazer on Sat 11/06/2005 15:42:29
Arrays of pointers are possible:

Thanks :) I was trying to use java syntax and getting always error (shame :P)

Anyway AGS won't let me this:
Code: ags
GUIControl *Icons[4] = gButtons.Controls;

Is it an AGS limit?
#24
AGS doesn't support pointers to pointers, nor arrays of pointers.

Try this, instead:

Code: ags

function OrganizeIcons() {
  int NumberOfIcons = 3; // <-- IMPORTANT: Insert here the number of icons you use
  // Don't touch variables below!
  int IconPositionX = 0;
  int IconNumber = 0;
  GUIControl *Icon;

  while  (IconNumber < NumberOfIcons) // NumberOfIcons was defined at the top of the script
    { 
      Icon = gButtons.Controls[IconNumber];
      if (Icon.Visible == true)
        {
          Icon.X  = IconPositionX;                                
          IconPositionX = (IconPositionX + Icon.Width);
        }
      IconNumber++;
    }
  gButtons.X = (system.screen_width - IconPositionX - Icon.Width) / 2; // Center the GUI
}


This code assume that:
- Your icons are placed in a GUI called BUTTONS (gButtons in script)
- gButtons only contain your icons
- Icons have to be centered in screen

... also works with buttons having different length
#25
Quote from: GarageGothic on Sat 11/06/2005 11:41:34
short buttonx = 0; //where the leftmost button will be on the gui.
short numofbuttons = 8;
short buttonnum = 1;

Again, use int instead of short: there is no reason to use short unless for large arrays (like short myarray[TYPE_A_HUGE_NUMBER_HERE])
#26
Quote from: Billy Gnome Jefferson on Sat 11/06/2005 09:32:10
I have a problem with the script though. It's picking up problems. Is this because I have an older of AGS? Must I update it?
Dunno... Do you get an error message?

Edit:
Oh right... it only works with AGS 2.7 or later due to object-oriented scripting. If you need non-OO script there are just few modifications to do (but I suggest you to backup your game and then upgrade).
#27
About the graphic:
If you use straight horizontal lines for walkable areas, you can made then 2 pixel tall.
Near the slope you need at least a 8-10px area, or your character will stuck.

Here a quick example (the walkable area is highlighted in green):


Then, here you can see walkbehind areas (in green, again):

See that the ground is also a highlighted to prevent the character appears over it (don't set a walkbehind area over the ground if you want to achieve a true platform appareance)

Next... let's script :)
Open the global script and edit:
Code: ags

function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    if (mouse.Mode == eModeWalkto)
      {
        if (GetWalkableAreaAt(mouse.x,  mouse.y) > 0)
          ProcessClick(mouse.x, mouse.y, eModeWalkto);
        else
          {
            /* Look for walkable area */
            int i, wa, x;
            i  = 0;
            x = mouse.x;
            wa = GetWalkableAreaAt(character[Player.ID].x,  character[Player.ID].y);
            while ((i <= game.room_height) && (GetWalkableAreaAt(x, i) != wa)) i++;
            /* End look for w.a. */
            if (i <= game.room_height) ProcessClick(mouse.x, i, eModeWalkto);
            /* Note: doesn't do nothing if no walkable area is found on the screen column where the player clicked */
          }
      }
    else
        ProcessClick(mouse.x,  mouse.y, mouse.Mode);    
  }
  else {   // right-click, so cycle cursor
    mouse.SelectNextMode();
  }
}

This should prevent player character being stuck.
#28
The idea of a national AGS site is very nice if thought as a community of artists, programmers, writers, translators (give a look at http://www.pollodigomma.net), and so on.

Translating the Official AGS Forum/Site, if you meant this, is impossible... translating games (at least the newest/better one), tutorials is a good idea. Anyway... italians should really begin to learn english (possibly a better one than mine :D)
#29
Advanced Technical Forum / Re: Sub Scripts?
Mon 06/06/2005 09:20:17
In modern languages GoTo/Label statements are deprecated (and anyway they are not well-see by programmers due to maintenance difficulties) and replaced by loops, functions etc.

That's why AGS don't support them (or, at least, I think)
#30
Ketmaier, you have a PM :)
#31
Quote from: stranger on Wed 25/05/2005 20:36:35
Now if I want to save and upload him as a .gif file into AGS I know I can do this, however the problem is when I try to right click and save him I can only save him as a.bmp file and not as a .gif file...Any ideas as to how I can transport him into AGS?
Oh, a pretty little (famous) bug in IE...
Try empting IE cache, then reloading the page.
Or, install Firefox.
Or, copy the gif's address and then download it using some download manager (or even IE).
#32
About the second question:
Go to the page you indicated above, right click on the image/animation you want to take and save it on your HD. They are all GIFs, right? Go to AGS' Sprite Manager, right click and select "Quick Import GIF/FLC frames"... why should you use MS Paint?

About the first question, please explain yourself better (english is not my motherlanguage O_o)...

#33
You can flip frames inside AGS. Just import the left walking animation in the AGS' sprite manager. here, select the sprites, right click, "assign to view" and check "set all new frames as flipped".
#34
Hi to everybody  :)
I was scripting this morning, and (after a forum search) I was wondering why GetProperty/GetPropertyText functions have to be called according to the type of location related.

I mean: every type of object-game share the same property schema, so... since we have GetLocationName and GetLocationType, why can't we have GetLocationProperty instead of:

Code: ags
type = GetLocationType(mouse.x, mouse.y)
if (type == eLocationHotspot) {
  Hotspot* h Hotspot.GetAtScreenXY(x,  y);
  h.GetPropertyText("Desc",  buf);
} else if (type == eLocationObject) {
  Object* o = ...


And (curiosity) why properties are read-only at runtime?
#35
Advanced Technical Forum / Re: Voice speech
Thu 20/05/2004 22:41:23
Quote from: Scorpiorus on Thu 20/05/2004 22:25:50Could it be a good idea to have an entry in the .cfg file that specifies what .vox file is currently selected so AGS would use it to play speech?

A good idea could be having (for example) italian.tra + italian.vox, french.tra + french.vox, japanese.tra + japanese.vox and so on, so that AGS could automatically use the right vox file depending on the translation selected by the user. I think this is a useful suggestion for next AGS' versions. Isn't it? ;)
#36
Advanced Technical Forum / Re: Voice speech
Thu 20/05/2004 22:13:56
Quote from: Scorpiorus on Thu 20/05/2004 21:07:25I don't know if there is a way to tell AGS which one to use but a workaround would be to have speech.eng and speech.ger and copy one or another to speech.vox before launching AGS game. I appreciate it requires some additional work (like writing a setup or maybe a simple batch file) but it can be accomplished.

Two simple solutions:
1) Downloadable speech packs. Of course players need to install the wanted language pack. In this way spoken dialogs aren't influenced(*) by translation selected in setup.
2) One huge SPEECH.VOX file containing every spoken dialog. For example, for each character number from 0 to 999 are english sentences; 1000 to 1999 french; 2000 to 2999 italian, etc... Then, when translating the txt source, for every talked string, translator must point to the number relative to destination language. [maybe this solution is not suitable for download, uh?? :D]

Was I clear enough?

influenced: does this word really exists in english vocabulary? Pheeww... excuse me for my poor english
#37
QuoteNow it says I'm recreating too many overlays.Ã,  ???

What? ??? Did you use RemoveOverlay(overlay) before any CreatetextOverlay?
AGS supports max 10 overlays but using CreateTextOverlay and RemoveOverlay in sequence you use only 1 overlay at time.

--EDIT--

Ahah... wait... wait!
Messages should be created using this sintax:

Code: ags

  if (xpos==320) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
  if (xpos==290) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }
  if (xpos==250) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }
  if (xpos==200) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }


Maybe you used:

Code: ags

  if (xpos==320) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
  if (xpos==290) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }
  if (xpos==250) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
  if (xpos==220) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }
  if (xpos==200) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
  if (xpos==180) {
    RemoveOverlay(overlay); // Delete previous message
    overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
  }


And yes, this is wrong (and really slows down the AGS engine)
#38
Yes.

Code: ags
SetViewPort(xpos, 0); //REMOVED!

The right spelling is "SetViewport(xpos, 0);" However this instruction is not very important.

Text didn't show up because you need to change the block of if statements. Look at Reply #7:

Code: ags
if (xpos==320) ...etc etc...
  if (xpos==290) ...etc etc...


I didn't marked these lines but i told you: "Note that the sequence of "if (xpos==???)" uses now numbers in inverted order. " ;) Got it?
#39
I'm back! Let's see... SetViewport accept coordinates in 320x200-scale. Since your background is 640x200 I suppose you are designing a 320x200 game.
So you need to scroll 320 pixel from right to left. This means your viewport is initially set at coord (320, 0).

here the modified script (only lines marked with '*' have been changed), I didn't test this but it should work fine:

Code: ags

function my_cutscene() {

StartCutscene(5);

* int overlay, xpos = 320;
* SetViewPort(xpos, 0);
* while (xpos > 0) {
Ã,  // Display text. I used overlays since they aren't blocking and they don't move while scrolling the sceen
Ã,  if (xpos==320) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
Ã,  if (xpos==290) {
Ã,  Ã,  RemoveOverlay(overlay); // Delete previous message
Ã,  Ã,  overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
Ã,  }
Ã,  // ..
Ã,  SetViewport(xpos, 0);
Ã,  Wait(5);
*Ã,  xpos--;
}
ReleaseViewport(); // Returns the viewport as it was before the cutscene - maybe non necessary in your game
RemoveOverlay(overlay); // Remove the last message

EndCutscene();

}


Note that the sequence of "if (xpos==???)" uses now numbers in inverted order.
#40
Here a working example:

Code: ags

function my_cutscene() {

StartCutscene(5);

int overlay, xpos = 0;
while (xpos < 60) {
Ã,  // Display text. I used overlays since they aren't blocking and they don't move while scrolling the sceen
Ã,  if (xpos==0) overlay = CreateTextOverlay (0,80,650,1,15,"This is a text overlay");
Ã,  if (xpos==30) {
Ã,  Ã,  RemoveOverlay(overlay); // Delete previous message
Ã,  Ã,  overlay = CreateTextOverlay (0,80,650,1,15,"This is another text overlay");
Ã,  }
Ã,  // ..
Ã,  SetViewport(xpos, 0);
Ã,  Wait(5);
Ã,  xpos++;
}
ReleaseViewport(); // Returns the viewport as it was before the cutscene - maybe non necessary in your game
RemoveOverlay(overlay); // Remove the last message

EndCutscene();

}


PS: CreateTextOverlay does NOT center the text in the specified area! [EDIT]You can use function GetTextWidth to center strings[/EDIT]

Ok, this is working but just an idea.
SMF spam blocked by CleanTalk