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

#381
Here's how I would try to code it:

So, the NPC character has two different “modes” or “states” she can operate in:

  • She's moving
  • She's standing still and animating.

Let's save in a variable what “mode” or “state” she is in.

Code: ags

enum tyNPCState {
        eNPCMoves = 1,
        eNPCAnimates = 2
};

tyNPCState NPCState;


(If you aren't comfortable with enum, then use the following code instead. It does the same thing in a simpler way:
Code: ags

int eNPCMoves = 1;
int eNPCAnimates = 2;

int NPCState; // will contain either eNPCMoves or eNPCAnimates

)

We need the values in  NPCState to be still available when the function ends - so be sure to declare NPCState outside the function body, before the function begins.

Whenever we start the character moving, we will also set NPCState to eNPCMoves.

So when she no longer moves, but still NPCState == eNPCMoves, we know that her moving action has just run out. That's the time to start her animating - and at the same time, we set NPCState to eNPCAnimates.

So later, the time will come when she no longer animates, but still NPCState == eNPCAnimates. This must mean that her animation has just run out. That's the time to start her moving again - and we've reached the end of a cycle that we can repeat indefinitely.

Let's put this into code:
The following should go into the "Repeatedly execute" function of the room.
Code: ags

if (!cNpc.Moving) {
    if (NPCState == eNPCMoves) {
        // The move action must have stopped just now. So startup the animate action:
        cNpc.LockView(222);
        cNpc.Animate(cNpc.Loop, 0, eOnce, eNoBlock);
        // Don't unlock the view just now, because the character is still happily animating away at the moment.

        // Remember in our state variable that our character has just begun the animate mode
        NPCState = eNPCAnimates; 
    }
}
if ((!cNpc.Moving) && (!cNpc.Animating)) {
    if (NPCState == eNPCAnimates) {
        // The Animate action must have run out just now. 
        // So now's a good time to unlock the view - since the character is no longer animating.
        cNpc.UnlockView();

        // Let's make the character walk
        int x = Random(Room.Width-1);
        int y = Random(Room.Height-1);
 
        cNpc.Walk(x, y, eNoBlock, eWalkableAreas);
        // and remember in our state variable that the character has entered her walk mode now.
        NPCState = eNPCMoves;
    }
}



In order to jump-start the cycle, we need to make her move once, at room fade-in, and then she will alternate moving and animating indefinitely on her own.
Code: ags

function room_AfterFadeIn()
{
    [...]
    int x = Random(Room.Width-1);
    int y = Random(Room.Height-1);
 
    cNpc.Walk(x, y, eNoBlock, eWalkableAreas);
    NPCState = eNPCMoves;
    [...]
}


Just my 2 pence,
P.
#382
Here's what I would suggest as the very next step to improve the sideways walkcycle animation:

If you observe people walking, you'll see that there are two points in time where they have both of their legs on the floor at the same time:

  • The right leg is in front, and the right heel touches the floor; the left leg is back, and the left toe touches the floor.
  • The left leg is in front, and the left heel touches the floor; the right leg is back, and the right toe touches the floor.

In both cases, the head is over the middle.

Compare that to DBoyWheelers sheet posted here: The third and fifth figures in the second row have a similar position, but the feet do NOT touch the floor at the same time, and the head is completely over the back leg. Let's turn the lower body a bit in figure 3 so that the feet line up and the head is over the middle (I don't have the source graphics, so I can only fake it here):

BEFORE
AFTER   

Do this in the same way in figure 5 of the second row, too. This should improve the walkcycle a lot.

Yes, and listen too Mandle's tip, too: All the frames ought to have equal width, in each frame the feet should be right at the bottom, and in each frame the middle of the heads should be horizontally in the middle of the frame (it can bob up and down, but it shouldn't move to the left or right.)

Just my 2 pence,
fernewelten
#383
Critics' Lounge / "Next-level" animations
Fri 15/06/2018 01:23:04
Hey folks,

Say hello to Linkattus, a brash adventurer that is about to rescue an imprisoned beautiful lady.


He lives in an entry for MAGS May, which I am currently upgrading with superior animations as a first step to creating a non-MAGS version.

So, Linkattus will have to:

  • reach for the soft soap bottle on the cabinet behind him,
  • take it,
  • turn facing downstage,
  • shake the bottle
  • remark that the bottle is empty
  • turn facing the cabinet
  • and then put it back.
I know the guy's a little short, but he intends to stand on his toes and stretch a little.

So, this has a technical (practical) and an artistic side.

For the technical side, both Linkattus and the surroundings are originally vector (.svg) drawings. They have been converted to .png for the AGS sprites import. The bottle is an object.

  • What would be a good program to do the animation in? I've done the walking cycles in Synfig, which can import .svg files in a broken kind of way that usually ruins the scaling of some body parts. Also, Synfig is fairly unstable and needs constant saving in order to guard against crashes. On the other hand, Synfig can work with vectors "natively", and it knows bones animation (you can attach a group of vector shapes to a "bone", and when you move or distort the bone, the vectors will follow suit). I'm not really happy with Synfig, but I don't know alternatives.
  • What do I need to do on the AGS side to pull this off? Note that the bottle is already standing there when Linkattus arrives. So Linkattus will probably need to be at a very exact position when the animation starts so his hands are exactly aligned when grabbing the bottle. Then, the bottle needs to "disappear" at the same time that a copy of the bottle that is part of the animation sequence shows up.
  • I think I will need to have the background available in the animation program in order to get the positioning just right. But the background must not be part of the animation images, or it might interfere with the graphics that AGS presents in realtime.

Watch Kathy Rain going to the sofa and taking a seat there. Kathy lives in a commercial AGS adventure (that is very worthwhile, BTW.). I assume that AGS turns her, then she uses a standard walkcycle animation which she fluidly changes to a "sitting down" animation on arriving at the sofa. (The jerkiness in the GIF is due to its low frame rate; there is no jerkiness whatsoever in the live game).  Note that Kathy is in seamless action throughout the sequence.



So there must be a way of doing these kinds of animations.
#384
Hello folks,

AFAICS, the sticky post "All the Paint Programs You'll Ever Need" has been updated in 2011 the last time, so it has reached compulsory school age by now.

Despite the brash claim at the start, "This is a list of all the working (highlight of the author) links to paint programs", several are not, amongst others:


Synfig is mis-labelled. This is mainly an animation program, not a vector program.

Time for some modernization, perhaps? :-\
#385
Hello,

www.nikolas-sideris.com/tutorials has dropped from the face of the Internet earth; by now its root page www.nikolas-sideris.com/ contains tips for selecting online football brokers in Indonesian language. (Really. (roll) (wtf) Or at least, that's what I make of the output of Google Translate.)

Thus, all of the links at the start of the posting "Quick links to Forum tutorials!" get a 404 Page Not Found. Even the Wayback Machine can't resurrect a good part of these links.

What a pity!

Any ideas or tips for resurrecting the lost information?
#386
Hints & Tips / Re: Commando Raid hints
Sat 09/06/2018 10:13:56
Quote from: Slasher on Sat 09/06/2018 06:05:17
Spoiler

Getting the rota off the cleaning cupboard. How?
[close]
I've amended the hints list. Thanks for pointing out this missing bit to me! So here goes...

Snagging the daily rota is potentially a firing offence, Linkattus says that. So …
Spoiler

… can you give Linkattus a reason to _want_ that rota even though?
[close]

(b) How do I do that?
Spoiler

The ransom letter must have arrived (which happens directly after the room is cleaned). Linkattus must know that the shaft leads out of the sewers by way of a maze (by asking the boss about it). Then he'll need the backside of the rota to write his map on.

When the preconditions are fulfilled, INTERACT with the rota and Linkattus will simply take it from the wall.
[close]

#387
Quote from: Slasher on Fri 08/06/2018 08:49:40
Commando Raid by fernewelten
However, I downloaded later version and 
Spoiler
the door you came in from would not close
[close]

I'm so sorry. It seems that I've inadvertently created a mind blocker for everyone that happened to play the old version first. I agree that this is stumping then. But the thing is,...

Spoiler
Linkattus has better manners now. He won't bang the door shut, but he'll close it nicely when using the door HANDLE. (And he must be anywhere to the right of the water, or else the first click will make him cross the bridge and the second click on the handle will close the door.)  To explain what I mean, see this YouTube video.
[close]


The rationale for the change was this:
Spoiler
In my playtests, I found myself on several occasions to want to move Linkattus over to the other side of the bridge and to click "anywhere" on the right hand side for this. Bam: My click happened to land on the door purely by chance, and the riddle was spoilt inadvertently.

So I had to do something to guard the riddle a little more. So now Linkattus muses on the insides and outsides of door blades unless the user clicks on the door HANDLE.

The better solution is planned for for the non-MAGS version: Making the room a tad wider so that the right wall is just out of view when Linkattus is on the left side and comes in view when Linkattus goes over the bridge. So there's much less chance of clicking on the door inadvertently. I can then release the constraints again.
[close]

Quote from: Slasher on Fri 08/06/2018 08:49:40
Spoiler
clickable boss
[close]

The revised version (i.e., the version as of the end of the weekend extension) already sees to it that
Spoiler
the boss is really hidden when invisible. If you mouse over him, the status bar won't point him out any more.
[close]
#388
Quote from: Mandle on Mon 04/06/2018 02:12:39
As soon as I changed the graphics option to the software thingy I got into the maze room in bare seconds.

The maze room is comparatively huge. It might be that the graphics driver or card could not handle the dimensions.
#389
Quote from: Mandle on Mon 04/06/2018 02:12:39
I did encounter some glitches in the maze room: […]

Hi Mandle,

Thanks for the detailed report and for uncovering the bugs.

Concerning the maze room: The music can freeze up right at the beginning because the computer has to become VERY BUSY at that point. Whilst Linkattus pole-jumps up the shaft, the computer jumps into action: It generates a beast called “randomized spanning tree” through something named “Dijkstra's algorithm”, then it connects the subrooms according to the aforementioned tree, makes sure that all the subrooms are indeed interconnected, and lastly searches for the two rooms that have the most distance one from the other. The one room is connected to the exit, the other to the sewer room and a random third one to the guard's key room. Lastly, the computer decides just what specific door should lead to just what specific room.

Unfortunately, AGS is scantly equipped for this sort of algorithmic heavy-lifting, which makes it harder. No recursive functions, no multidimensional arrays ...

Anyway, when the "Oh oh" jingle comes and Linkattus notices his plight, the computer is ready and Linkattus can start exploring.

It's all very technical, but I've done my hardest to disguise that aspect and stress instead how _individual_ the different areas of the maze are.

I'll probably counteract this specific bug by already fading out the music in the sewer room. Thus, nothing will play during the calculations, thus, nothing can hang or loop.

Of course, I'll also look into the other bugs. Thanks for pointing them out!
#390
Quote from: Stupot on Tue 05/06/2018 00:00:20
Did you know, you can nest the spoiler tags within each other.

Great tip! I've grouped the hints in my posting now.
#391
Hints & Tips / Commando Raid hints
Mon 04/06/2018 22:52:08
Dear Community,


The Point and Click adventure “The Devious and Daring Commando Raid of Linkattus, the Lowly Janitor Rat, In Order to Free Ratzelda, the Princess of His Dreams, And to Get Her, Too” (short: Commando raid) is out.

If you offer an adventure, you always run the risk of your players overlooking something or of thinking in another direction than the author's strange and warped imagination. So I've dropped some hints below.

All the hidden sections except for the last one contain hidden subsections. So un-hide a question that most fits your problem and then un-hide the answer to the best fitting subquestion.

If you need more tips, just ask here in this thread, and I'll do my best to help!


How do I get the key to the cleaning cabinet?
Spoiler

1.
Spoiler
Have you examined everything, particularly near the cabinet?
[close]

Yes, but no luck?
2.
Spoiler
Try disturbing the boss again, _after_ your examination of the items on the _floor_ near the cabinet.
[close]

And?
3.
Spoiler
You'll get an audio clue when the boss comes out of the door. A clinkling sound ... Something might happen right then...
[close]

So that means in plain words?
4.
Spoiler
There's a largish floor pocket near the cabinet. LOOK into it. Then INTERACT with the management door. Boss will come out and drop his key into the floor pocket. Finish the dialogue in any way you like, then INTERACT with the floor pocket, and Linkattus will pick up the cabinet key.
[close]
[close]

There must be more in the very first room than meets the eye. How do I see it?
Spoiler

1.
Spoiler
So something must be in front.
[close]

Yes?
2.
Spoiler
You saw Linkattus come into the room right at the start of the game? How did he do it?
[close]

what about it?
3.
Spoiler
Try closing the sewer room door (right wall). You'll need to click on the door _handle_, and Linkattus must be fairly near (if he's on the right side of the water, he'll be fine).
[close]
[close]

How do I get the mop?
Spoiler

1.
Spoiler
LOOK at things (right-click), don't only INTERACT with them (left-click).
[close]

Good general advice; what does this mean here in particular?
2.
Spoiler
A bag hangs on the sewer entry door (right wall). You'll only see it when the door is closed. (See the question "meets the eye" above when you have trouble closing the door.) LOOK at it and Linkattus will discover the mop head inside.
[close]

But that only gets me half-way. And the other half?
3.
Spoiler
What's visible in the room that might fit into the hole of a mop head?
[close]

Well, Linkattus can't pick it up. He says so.
4.
Spoiler
The _fourth_ iron bar in the back wall is _not_ cemented in the wall, so Linkattus can pick that up.
[close]
[close]
When I have the tools, how do I start cleaning?
Spoiler

1.
Spoiler
COMBINE the suitably assembled mop with the suitably prepared bucket.
[close]

How do I prepare the bucket?
2.
Spoiler
It needs water and soap.
[close]

How do I assemble the mop?
3.
Spoiler
You need to combine the mop head with three iron bars. Any sequence will do.
[close]

But I can get at only one of them?
4.
Spoiler
You can get the other iron bars by wielding the first bar. This will only work when you wield an iron bar. (Linkattus will tell you that.) However, if your iron bar is already combined with the mop head, disassemble that construction by combining the mop with itself. Then pick up the single bar and click on the bars at the back wall.
[close]
[close]

How do I get out of the first room?
Spoiler


1. Leaving prematurely is a firing offense. What would give Linkattus good reason to leave even though?
Spoiler
The ransom letter - it will be delivered immediately after the room is cleaned.
[close]

2. So where's the proper exit?
Spoiler
You won't pass through the doors or swim the sewage canals. So there's only one other option.
[close]

3. How do I get there?
Spoiler
You can't affix anything to the shaft, so you'll have to get something to the wall that will start from the floor in front of the shaft.
[close]

4. But I haven't got anything at hand that is long enough?
Spoiler
Well, you've just solved a problem where something had to be just the right length. A similar approach should work here.
[close]

5. So I've adjusted the length; what do I do with it now?
Spoiler

(a)
Spoiler
You don't want to _clean_ the back wall. Sometimes less is more.
[close]
(b) And what does this mean specifically?
Spoiler
For this specific task, you mustn't have the mop head affixed to the iron bars. So start by disassembling the mop (combine it with itself in the inventory). Then just combine iron bars with iron bars.
[close]
[close]

6. How do I make use of my item?
Spoiler

(a)
Spoiler
Note that the LOOK function is available in the inventory, too. When the mop head is removed and the stick has maximal length, does Linkattus' description remind you of a specific sport?
[close]

(b) And where do I put my sports equipment?
Spoiler
Remember how you retrieved the bucket and soft soap? How did you do it?
(Technical note: Do you have trouble "clicking" on the right spot of the room whilst "holding" the item? The cursor icon for this equipment is very large, so it might be a bit hard to navigate it over the exact spot you want to click on. Simply move it around a bit until the bottom line announces the right spot.)
[close]

(c) I don't get it.
Spoiler
Don't affix the mop head to the bars (or if you have, disassemble the construction by combining it with itself). COMBINE 5 iron bars into a pole and put that pole into the floor pocket where you took the cabinet key out.  (It's a big pocket surrounded by a fine grey line to the left of the cabinet.)  INTERACT with the pole to pole-jump to the exit.
[close]
[close]

7. I can't get hold of the map. What do I do?
Spoiler

(a) Does Linkattus _know_ (in this game run) that he'll need a map? How can he learn that?
Spoiler
The way out of the sewers is through the shaft at the back wall. When asked about the shaft, Boss will tell Linkattus that he needs a map.
[close]

(b) But I can't find any map after diligently searching the room?
Spoiler
Linkattus is content with a piece of paper. Where would he find paper in this room?
[close]

(c) I can't think of anything that would fit the bill.
Spoiler
Retrieve the rota from the side of the cabinet. _After_ the ransom letter has arrived and _after_ Linkattus has learned that the way out involves a maze, Linkattus will do it and risk being fired.
[close]
[close]

7. How do I get the daily rota?
Spoiler

(a) Snagging the daily rota is potentially a firing offence, Linkattus says that. So …
Spoiler

… can you give Linkattus a reason to _want_ that rota even though?
[close]

(b) So how do I do that?
Spoiler

The ransom letter must have arrived (which happens directly after the room is cleaned). Linkattus must know that the shaft leads out of the sewers by way of a maze (by asking the boss about it). Then he'll need the backside of the rota to write his map on.

When the preconditions above are fulfilled, INTERACT with the rota and Linkattus will take it from the wall.
[close]
[close]
[close]

How do I navigate the maze?
Spoiler

(a) What doors do i need to click on, what rooms do I need to pass?
Spoiler
The maze is randomly generated in each game, so I don't know, either. Sorry about that!
[close]

(b) Somehow I run into trouble drawing my map. What gives?
Spoiler
If you LOOK at a room label, Linkattus will point out that all the labels are different. He's quite right about that. However, note that some room names have a dash, some haven't. Room L97 is different from room L-97. I suggest saying the dash explicitly when reading the room names, so say "El dash ninety-seven" instead of "El ninety-seven" to ensure that the dash doesn't get dropped.

Note to native-German speakers: We have a confusing way of saying double-digit numbers: "seven-and-ninety" instead of "ninety-seven". This might lead to transposed characters in your map. Counteract that by reading the room names character by character: "El dash nine seven" instead of "El dash seven-and-ninety".
[close]

(c) Any map making tips?
Spoiler
Don't just make circles for the rooms and arks for the connections. Write at the respective ends of the arks what specific doors they belong to (the door letters, if there are any; or "1st", "2nd" etc., or for specifically the lift, the storey and the door number).
[close]

(d) Is there any way to speed Linkattus up?
Spoiler
I've tried very hard to make the AGS functionality work that makes a character speed to their end position when a key is hit, but I failed: It doesn't seem to work with blocking walks. The work-around I put in jumps a character in a straight bee line towards their goal when you hit the escape key. They'll walk normally towards their goal from there on. So your mileage will vary dependent on the geography of the area. Wiggly routes and small strips of walkable area work worse than straight routes and wide walkable areas.

By all means, try hitting "ESC" to speed Linkattus up, perhaps repeatedly.
[close]
[close]

How do I get past Kitty?
Spoiler

1.
Spoiler
You can't sneak past her; she'll jump in front of you as soon as you near the line. So you'll have to interact in the usual two ways: talk to her (left-click without holding something) or give her something (take up an inventory item and left-click the cat while holding it).
[close]

2. When I talk to her, she wants me to give her the fish, and I don't have them. I can't offer anything instead that will placate her.
Spoiler
But there's only one item you can offer her that will provoke Linkattus to give a specific comment after the dialog.
[close]

3. Okay, I've determined the item I want to use, how do I use it?
Spoiler
Where would you relocate that “ball” (soft soap) to entice Kitty to go away?
[close]

4. So tell me what to do with it.
Spoiler
Throw the soft soap to the cat flap over the door.
[close]
[close]

How do I continue the screens after Linkattus has retrieved Ratzelda?
Spoiler
The monologues are endless. Look at them as long as you like and then hit the red "..." button at any time when you're done watching.
[close]
#392
Quote from: CaptainD on Mon 04/06/2018 14:28:25
Commando Raid
I'm afraid I haven't got very far with this one - might be missing something obvious.

Well, have a look in the comprehensive Tips and Hints in this forum article!

Happy Adventuring! :-D

[I've moved all the hints and tips to the article given above and sorted them. Let's keep the environment tidy! ;-) ]
#393
Quote from: Slasher on Thu 31/05/2018 15:47:35
When cupboard is unlocked 'looking' still says it's locked...

Well, rats. ;-D Thanks for the tip, I've fixed it. I'll wait a bit with the improved upload since uploading transfers around 100 MB and takes about a quarter of an hour. Something else might come up at the last minute.
#394
Hello, Community!

I've just surfaced from the abysmal depths of a month-long coding spree, fuelled only by coffee (and large bottles of mineral water and cola), and now that I've come to surface, I'm finding out that ten pages of discussion have come to be in the meantime.

Boy! Sorry I didn't have the resources to join.

Anyway, I proudly present to you as a MAGS entry:




The Devious and Daring
Commando Raid
of Linkattus, The Lowly Janitor Rat,
In Order to Free
Ratzelda, the Princess of His Dreams,
And to Get Her, Too


(What? That is the title of this adventure! 8-) )

It features:

  • a BASS like interface,
  • hand-drawn art in Inkscape,
  • original music, recorded from a Yamaha keyboard and edited in Audacity
  • the AGS system by Chris Jones and later contributers
  • lots of Adventuring and Frolicking :-)
  • Rats
  • and a Cat.
Oh, and bugs (probably :-[ ).

Get the game here
(I reserve the right to make urgent, last-minute bug fixes until the deadline. :) )

Screenshot: http://www.loquimur-online.de/ags/MAGS/the-devious-and-daring-commando-raid-of%20linkattus.png
[imgzoom]http://www.loquimur-online.de/ags/MAGS/the-devious-and-daring-commando-raid-of%20linkattus.png[/imgzoom]

Have fun playing and give me feedback!
#395
Quote from: ManicMatt on Mon 21/05/2018 13:41:53
Okay, I think this graphic thing is beyond me for the time being. I seem to be doing okay with my scripted events recently.


There are many ways leading to Rome - if you've found one that works, then use it. :) I might do something similar myself if there were only some few doors that I need to handle, or if all the different doors need special logic anyway so I can't reuse generalized code.
#396
Quote from: eri0o on Mon 21/05/2018 04:00:37
I think that should work, pretty sure I do that, but you could also create a view, assign to the object and animate forward or backwards.

Good idea; this is what I'll probably do when I animate the doors "properly", that is, have them close slowly with a nice whup sound in the end, or open slowly squeakily. For the moment, though, I just have one "door open" and one "door closed" frame for each door. I find it time consuming enough to animate the characters in front, side, back view, talking and not talking - so this will have priority right now. For the moment, I can't do more for the doors than showing them either open or closed in a binary fashion.

#397
Quote from: Crimson Wizard on Mon 21/05/2018 10:08:22
Are you saying it does not work in your case? This might be some weird bug, or maybe there are some unusual circumstances.

You're right in suspecting that the situation is more complicated as described, I simplified somewhat. In my own view, what I came up with is messy, but I don't see a better way:

So, the user combines two objects, and the “cutscene” begins. I start off in <object>_UseInv().

A letter arrives (I use <object>.Visible = true), and cEgo walks to the letter (player.Walk(...eBlock)) and picks it up. Then, the letter is shown in big in a GUI gLetter ("Pause game when shown") for the user to read. Here's a snag: This means that my control of the thread is gone at this point, I must let the user do his thing and click the X when they are done reading and decide to click it.


So how do I pick up the thread again? What I came up with is the following: I've defined a global integer variable gvHook, and I set this to an integer (it happens to be 1) before calling gLetter.Visible = true;. In the event for closing the window, I do:

Code: ags

function btnLetter_Close_OnClick(GUIControl *control, MouseButton button)
{
    gLetter.Visible = false;
    if (gvHook > 0) {
        CallRoomScript(gvHook);
    }
}


So here I am back in business, but now in the on_call() function of my room script.
Code: ags

function on_call(int the_hook)
{
    gv_Hook = 0; // clear to prevent unwanted multiple calls
    switch(the_hook) {
    case 1: 
        Hook1();
        break;
    
    case 2: 
        Hook2();
        break;
        
    case 3:
        Hook3();
        break;
    ...
    }
}


The next chunk of my "cutscene" is coded in Hook1(), and it will run until that same GUI must be called up again and show something similar, but different. But now, I've prepared my way: At that point, I set "gvHook = 2; gLetter.Visible = true" and can be assured that I will regain control of the thread in Hook2() after the user has clicked the x later on.

Basically, I'm repurposing the RoomCall() mechanism as a way of storing a "callback function" that will be called whenever a GUI ends. The on_call function is a poor man's replacement for function pointers. I can use this same mechanism for all guis, when I need it, as long as I allocate different numbers for different pieces of code (namely 4 for Hook4(); 5 for Hook5() and so on) and include the code snippet given above in the close event of each gui.

The glitch happened in such a Hook() function, i.e., indirectly in the on_call() function of a room.

I've just tried it out after a short and fretful night's sleep, and today, without having changed anything but a reboot and AGS startup, the code started to work. So I'm not sure whether this is just a one-time compilation glitch or whether this is linked to certain actions or tests that I performed yesterday.

I'll report when I know more.

Thanks for the suggestion, also to eri0o: The drawing surface idea a handy trick for forcing a refresh to keep in mind.
#398
Quote from: ManicMatt on Mon 21/05/2018 08:13:00
That's weird, I didn't even know about this graphic command and I've made 2 AGS games!

So how do you handle doors? The game I made was shock full of them (a kitchen with lots of drawers, cupboards and so on), so I automated them: I gave objects a "State" property that coded whether they were open, then wrote:
Code: ags

String STATE_PROP = "State";
void ToggleDoorObject(Object *o, int graphic0, int x0, int y0, 
                                 int graphic1, int x1, int y1)
{
    // flip "State" property of object
    bool cur_state = o.GetProperty(STATE_PROP); 
    bool new_state = (!cur_state);
    o.SetProperty(STATE_PROP, new_state);
    
    // set position and graphics according to the new state
    if(new_state) {
        o.Graphic = graphic1;
        o.SetPosition(x1, y1);
        return;
    }
    o.Graphic = graphic0;
    o.SetPosition(x0, y0);
}    


I determined the correct positions of the open and closed sprites in the room editor by choosing the corresponding sprite and moving it in place, then noting the StartX and StartY coordinates. Then, I had
Code: ags

void ToggleDrawer1() {
    ToggleDoorObject(oDrawer1, 156, 77 23, // coo. copied from room editor
                               157, 60,11);
}
void ToggleDrawer2() { ... }
void ToggleDrawer3() { ... }
...
void ToggleBottomCabinetDoor1() { ... }
...
#399
Hello all,

I'm in the middle of a cutscene and I need to open a cupboard door. I usually handle this by having two sprites for the object - one for the open door, one for the closed door - and assigning the right sprite to <object>.Graphic. When the respective event ends, the screen is redrawn, and the new state of the cupboard (open/closed) shows.

This doesn't work in the cutscene, though, because just assigning to <object>.Graphic does NOT by itself make the screen redraw; and the cutscene needs to carry on, so relinquishing control by letting the event code end isn't a good option either.

To explain more clearly, here's some code:
Code: ags

// Clicking the bucket with the mouse shall start the cutscene
function oBucket_Interact()
{
    ...
    player.Say("Let's put away the blue cup now!");
    player.Walk(5,5, eBlock); // to the cupboard
    oCupboard.Graphic = OPENDOORGRAPHIC;
    // Screen needs to update here!
    Wait(40);
    oBlueCupInCupboard.Visible = true;
    // Screen needs to update here!
    Wait(40);
    oCupboard.Graphic = CLOSEDDOORGRAPHIC;
    player.Walk(77,77, eBlock);
    ...



So how do I force a screen update? Using FadeOut(); FadeIn() works, but this is drastic if I have to do it all the time.
#400
This is a very old thread, but I've been pointed to it by Google after vainly searching the editor internal documentation for quite some time. It is in there, all right, but hard to find if you don't know what you are looking for.

I'm assuming that others will be pointed to this thread by Google, too. So, for all late comers that face the same problem as me and the original poster, be told that the current best solution is changing Game.MinimumTextDisplayTimeMs, as in
Code: ags
Game.MinimumTextDisplayTimeMs = 2000;


The value is milliseconds and is a minimal time that each Say string will be displayed on-screen (unless the gamer waves it away). So the code above makes each Say command take at least 2 seconds.

For details, see the in-editor documentation for "Game / global functions", or "Game.MinimumTextDisplayTimeMs", respectively.
SMF spam blocked by CleanTalk