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 - Monsieur OUXX

#201
Hints & Tips / Don't push the button
Thu 20/02/2014 22:48:14
I'm stuck in the game, I can't seem to find the red button. How do I find it? Does it have something to do with the countdown?
#202
I'd like the user to be able to use a GUI during cutscenes (with buttons that he could click on)
How would you do?

Even if it's not possible using built-in AGS functions, there could be plenty of workarounds (e.g. creating a fake mouse cursor using a moving label, updating its position using mouse.x/y, intercepting clicks using mouse.IsButtonDown, etc.) ... but I'd rather use the simplest solution!

Do you have anything to recommend?

=========

Side question : In the game settings, you have some options to skip the cutscenes (mouse only, keyboard only, etc... AND those options can be combined with "timer"). But when I look at the help of StartCutscene(...), the enumerated "skip" options don't correspond. There is no mention of the timer. Do they match the general options at all?
#204
hi everyone,

The more my scripting progresses, the more modules I have that read and write custom files present in the game's directory. I'm using Windows XP.

But I also know that there are restrictions with Windows Vista/7, and that there are features like $MYDOCS$ or $SAVEGAMEDIR$ to circumvent that.

Did anyone have issues writing extra files to the game's directory?
Does anyone have best practices to recommend?
#205
This is one of those modules that you won't understand at first glance why they can be very useful.

Imagine this : You need to intercept a click on a GUI Control. That happens every day. You can just use the AGS Editor, go to the "Events" pane of your GUI, and bind a custom script to "OnClick". AGS will create automatically a little function in the global script, where you can put all the custom instructions you need.

BUT now imagine that your favorite hobby in life is to release modules for AGS. Modules that come with their own little custom Gui. (for the example's sake: imagine you want to release a "custom saved games" gui: you'll need to release both the Gui and the module that controls it).

Problem: all the binding you did in the global script doesn't get exported alongside the .guf and .scm files. It can quickly get annoying to explain in the readme how to recreate all that got lost. You could retort: "to circumvent this, I export a demo game with both the gui and the module". Well, there are still situations where that's not satisfactory.

Now imagine this: on top of it, you want to implement a small hovering function (that is, when the mouse is over a control, you get the feedback somewhere).
It's very easy to code manually in your custom module. But it can quickly become a mess if you have many controls. Same thing for intercepting the clicks the way this module does it. Anybody can do it. But it's better if it's done once and for all, and moved out of your critical module.

Hence, this module. Import it in your project, and then use it as follows :

Code: ags

// 1) Create your very own module
// 2) Create your very own Gui, with any kind of control. For example: 
//      - a label called "MyLabel". You want to track the clicks on that one
//      - another label called "StatusLine" where you want displayed the control being hovered
// 3) In your module's initialization, add this :
//      StandaloneClick.RegisterControl(MyLabel,  "this text will appear when the label is hovered");    
// 4) In your module's repeatedly_execute_always(), add this: 
//        if (StandaloneClick.ClickDetected(eMouseLeft)) {
//           GUIControl* c = StandaloneClick.GetClick(eMouseLeft);
//           if (c==MyLabel)
//             Display("you clicked on MyLabel with the left mouse button");
//        }
//
//        StatusLine.Text = StandaloneClick.GetHoveredText();
//
// 5) Run the game. Click on your label, and move your mouse over it.




Download module only (.scm)
Download demo game


EDIT : version 1.1
  - added "ClickDetected" to avoid confusing the absence of click with an actual click on nothing
#206
Every now and then I want to share a module that also relies on a GUI.

Problem is : the action scripts bound to that GUI (e.g. : "click on that button") are placed automatically in the global script by AGS.

Question: Are those bits of code supposed to be exported alongside the GUI, into the .guf file? I think not, but couldn't find a definitive answer.

If they don't get exported, I'll just write a little module to detect the clicks in a GUI that only relies on GetAtMouseXY and repeatedly_execute_always. This way, not one line of code gets out of the module.
#207
I hope there is no function in AGS that does that out-of-the-box or else I just totally ridiculed myself.

Code snippet: How to get the row height in a ListBox

Code: ags

[color=green]// AGS does not provide the height (in pixels) of a listbox row.
// The height depends purely on the font's height. 
// Yet, one cannot access that info either, using scripting only
// (even with GetTextHeight, because you'd need to know in advance the height
// of the tallest character in the entire font, I suppose).

// Hence, this function. It's a MASSIVE HACK
//
// IMPORTANT NOTE: this function can make the game crash because of a bug in AGS' ListBox
// coding. See http://www.adventuregamestudio.co.uk/forums/index.php?topic=48793.msg636466821#msg636466821
// To work around this, you must never call this function before the ListBox has been
// painted at least once.

// This function works with a struct similar to this :
// struct ExtendedListboxType {
//    ListBox* Box;
//    int rowHeight
// };
//
// ExtendedListboxType TextAreas[10];
//

[/color]

int TextAreaType::GetRowHeight()
{
  
  if (this.rowHeight!=0) //We do it only once, but it must be done after game_start
                         //or more generally after the box's first painting
    return this.rowHeight;
  else
  {   
    ListBox* b =  this.Box; //for convenience
    b.Clear();
    b.AddItem("0000000000000000000000000000000");
    b.AddItem("1111111111111111111111111111111");
    
    int i=0;
    
    int start_x=b.X+b.OwningGUI.X+1;
    int start_y=b.Y+b.OwningGUI.Y;

    int lastItem;
    lastItem=b.GetItemAtLocation(start_x, start_y+i);

    while (i<30) //we assume the characters are not higher than 30 pix high
    {
      int item = b.GetItemAtLocation(start_x, start_y+i);
      
      if (lastItem != item && item != -1)
      {
        b.Clear();
        this.rowHeight = i;
        return i;
      }  
      lastItem=item;
      i++;
    }

    Display("WARNING: could not find height of text area rows. The cursor might be off, or maybe your font is taller than 30 pixels?");
    b.Clear();
    this.rowHeight = 10; //arbitrary value
    return this.rowHeight; 
  }   
}
#208
Hi all, i'm having big trouble managing the '[' character in my rendering.

Correct me if i'm wrong: (i've tested that myself by i'm always worried that i actually made a mistake in the test itself)
- in Labels, a '[' alone skips line
- in labels, '\[' displays a '[' (backslash acts as an escape char)
- in Labels, '\' displays '\'
- in Labels, '\\' displays '\\' (backslash doesn't act as an escape code on its own, neither several times in a row)
- in ListBoxes, '\' displays '\'
- in Listboxes, '[' displays '['

I didn't test any of that in "Display" but I assume it works like "Label.Text"

EDIT (see my new post later on):
- In Labels, "\\[" displays only "[". Same goes for "\\\[", or "\\\\[", etc. No matter how many backslahes.
#209
I have this code in a module's on_key_press, literally like this :
Code: ags

        int key;
        ...
        Display(String.Format("key=%d",  key)); //DEBUG
        if (key == 91)  //'['
          text = text.AppendChar(92); 


I put a breakpoint on text = text.AppendChar(92); .
When I execute, the Display shows "key=91". That would mean key == 91.
Yet, the if (key==91) is never true, and the instruction with the breakpoint is never reached.
What is this wizardry???

EDIT: actually it's only the breakpoint not happening. I don't know why. But that explains everything, and the script works as expected.
#210
This is probably a silly issue -- with some inverted lines of code, or a forgotten "import" or something.
I have a script (it's not the global script).

In the header:

Code: ags

import void AddItem_Safe(ListBox* this,  String item);


In the body:
Code: ags

void AddItem_Safe(ListBox* this,  String item)
{
  this.AddItem(item); 
}

void WrapLine(ListBox* lstBox,  String desc)
{
  String buffer = "";
  lstBox.AddItem_Safe(buffer);
}



Then, when I compile :
Error: '.AddItem_Safe' is not a public member of 'ListBox'
(this error is rasied on the line with lstBox.AddItem_Safe(buffer);

I don't get it. What am I missing?
#211
Here is my scenario : (AGS 3.2.1)
- I have an animation (created with photoshop, for the record. but it doesn't matter)
- I thought I was clever to export it as a GIF, then the AGS import was very fast
- I've created views based on that series of sprites. That's the critical point: the views don't exactly match the GIF (some sprites are displayed several times, longer or more briefly, etc.). My GIF is just a series of unique sprites. The VIEW is the actual animation.
- Every now and then I need to update the sprites. That means I export a new GIF.

Problem: when I import them again into AGS, I can't just overwrite the old sprites if I use the "import as GIF" AGS option. That means I get new sprites, with new IDs. That means my view is ruined.

Question: What's the best practice to update a series of sprites (without having to do it manually for each sprite!) without ruining my existing views?

Alternative solution:
Spoiler
I've seen that option in AGS "use all sprites from a folder". That could be my solution, but it's not my preferred one -- does anyone know how to export all frames of a Photoshop animation into single files?
[close]
#212
I have that game with a lot of custom scripts.
So far it worked like a charm.

I've toyed around with some cutscene that was already there and worked well. I've mainly changed the sequence of rooms the main character goes through during the cutscene; during the cutscene the main character changes several times (I use "setAsPlayer" back and forth) and he goes through 3 rooms.

ISSUE: At the end of the cutscene, the last room fades-in correctly, BUT then it's like the mouse clicks are not caught. I added Display("click"); in the global script's on_mouse_click, and it's never called when I click in-game.

Note that:
-  I didn't use ClaimEvent anywhere.
- The game is not hanging (the cursor is animated and the label showing what hotspot is under the mouse gets properly updated when I move the mouse around. That calculation is done in repeatedly_execute_always).
- The game works OK in any other room.
- It's not a missing "EndCutscene": I've tried to add one, and the game crashes with "there is no cutcene going on so don't call EndCutscene, you jackass" (more or less). 
- The player character is on a walkarea (I even added a player.placeOnWalkarea(); to be sure).

What on earth could block a "Display" comment on the first line of on_mouse_click???
#213
I have two versions of the same character : 1) one close-up and 2) one from further away.
I want to use the close-up in room #1 and the regular version in room #2.

Each version of the character has all 3 views: normal, idle and speech. Therefore I'm using a two different AGS characters -- one for each version (this way I don't need to save all the views and restore them after, that's a real pain, especially with the idle view and its delay).

The con of that solution is that I have to play around with the "player" character.

  • While in room #1 in do character1.setAsPlayer();
  • Then I do character1.changeRoom(room2);
  • In room #2, BEFORE fade-in, I do : character2.setAsPlayer(); character1.changeRoom(dumpRoom); Wait(1);

ISSUE: I still see character1 for one frame after the fade-in.
How can I fix that?

#214
Hints & Tips / Alum
Sun 12/01/2014 13:00:56
Where do you hide when the eBots are after you?

Spoiler

- you can't go into the arcade
- you can't enter either of the two apartment doors
- you can't walk upstairs
- you can't exit the city through the gate on the left
- you can't "use" the statue
- you can't "use" the bench.
- you can't hide by simply standing on the opposite side of the statue
...and there are no more clickable areas
[close]


EDIT: one second later I found the solution...
@bangerang101: I would strongly recommend...
Spoiler

...drawing the foreground plant thicker, because it hurts logic to see that Alum can hide behind that skinny plant. That's why I didn't even consider it.
[close]
#215
I know many AGSers use Imageshack for image hosting. Or at least they used to.

They have this "new site" thing (now they have a fancy interface probably full of HTML 5), with albums and stuff.
Of course, they removed the "alternative uploader". You know, that old-school uploader that all sites (like facebook) offer when the script-based uploader fails.
Problem: The fancy uploader fails for me. I can't upload any file. I tried with both Chrome and Firefox.

Anybody having the same issue?

#216
Some time ago, through quick readings, I finally understood more or less what RoN was about, and decided to give it a go.
I ended up in some sort of open-world game (one gazillion locations) and the interface was... oh my god. Not just "watch", "see" and "talk", not even the 9-verb GUI... But instead tens and tens of possible actions on each object. It scared me I must say. I had no idea what I needed to do. I have no idea if it was only that RoN game I picked randomly, or if all games have that interface.

So what's the best RoN game to start with? The less intimidating, and most enjoyable?
#218
Do you like glitter? Don't lie, I know you do. And unicorns too.

I made this little module. Well, it's not a module, really. It's more of several code snippets, but clearly split into re-usable functions. It's based on Jerakeen's particles and Edmundito's tweening. ...And it's pretty.
- Use this to create a particles generator that projects particles in the opposite direction from the mouse movement.
- Use this to create a neat little credits system (see video).
- Use this to create a background that is continuously scrolling (and looping).


Video here:




Download (source and demo)



#219
hello,

Out of curiosity: what algorithm does AGS use to scale down sprites that walk away from camera?
I suppose it's just "nearest neighbour", or something fancy in the case of activated anti-aliasing.

I've just tried an implementation of "box" (using ImageMagick), and the results are SPECTACULAR.
EDIT: "box" is not so bad (see screenshots below), but I reckon "liquid scale" would be much better for scaling down sprites in motion. /EDIT

- Unlike bilinear and such, it does not introduce blur at all.
- It does not blindly scale down, but manages error displacement in a way that it cuts out unwanted pixels in plain areas, instead of doing it in arbitrary places. That way, details remain visible for as long as possible, before the picture becomes really too small.

I would highly recommand using that algorithm, or (Calin and Khris , nudge nudge) implementing a plugin for that.




#220
I just found that: Many walkcycles, from many games, complete with all animations.

!!!!!!!!!


http://www.spriters-resource.com/pc_computer/indy4/index.html
http://www.spriters-resource.com/pc_computer/dayofthetentacle/
http://www.spriters-resource.com/pc_computer/monkeyisland1/


EDIT: that wite is not as complete as I thought it was in the first place. Disappointment! :)
SMF spam blocked by CleanTalk