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

#601
I want to be able to manipulate a room object in the current room from the global script.

Currently I'm using on_call() and CallRoomScript(), as follows:

In my global script (note the diagnostic messages)

Display("About to call on_call()");
CallRoomScript(1);
Display("Returned from on_call()");

In the script for the room that is current when CallRoomScript() is called:

function on_call(int value)
{
  Display("In on_call(); value == %d", value);
  //blah
}


When I run my script, the messages displayed are:

About to call on_call()
Returned from on_call()

which shows that the function wasn't called.

What am I doing wrong? Incidentally, I wrote on_call at the end of my room script just by opening the whole room script in the editor (rather than just a section of it). Is it meant to be in a section (with grey start and end lines)? There doesn't seem to be a menu option for on_call anywhere.

Alternatively, is there a way of directly accessing and manipulating room objects from the global script? Something like the following:

room[n].objects[m].SetPosition(x, y);

Thanks.
#602
Thanks, Ashen. I'm working on something else now, but I'll give your suggestions a try when I come back to this issue.

EDIT: Setting both the saturation and luminance did what I wanted. Thanks.
#603
I am using Tint() to dim a character. However, I can't find suitable values for the parameters. The character always seems to become desaturated (black and white).

I want the character to get dimmer (because he is standing in a darkened area) but to retain some colour.

Currently, I am using this:

cMyCharacter.Tint(0, 0, 0, 100, 50);

According to the manual, this means "apply (0, 0, 0) (ie, black) at maximum strength to the character and dim him to 50%". This is not what I want, because obviously it makes cMyCharacter become black and white.

I could (and should) change the zeros to something else, but I don't want to change his colour. I just want to make him dimmer but keep him the colour he is (dimmed colours, of course). Is there a simple way to do this? Lowering the saturation would do this, of course, but what RGB values should I use?

Thanks.


Mod Edit: You have to edit the title of the FIRST post, to have the change show in the forum listing.
#604
Quote from: Ashen on Tue 11/09/2007 11:52:13
It's easy enough to click through the warning screen without noticing it - I usually do - but it's not really recommended.

Yes, that's what I did. As it is, all the cursors and GUIs the game are going to have a particular look and feel, so this wasn't such a bad thing in the end.
#605
Quote from: Monkey Entertainment on Fri 14/09/2007 16:56:13
If you use a region to start the walking-of-edge-thing, you could use region[X].Enabled to get it to disappear when the character walks back, and then use the same code to make the region reappear when it's done.

Thanks for all the suggestions. In the end I used a region, as Monkey Entertainment suggested. I didn't need to turn it off as the character walks back as the event is triggered only when the character walks onto the region. There is a separate event for the character being in the region.

I've used SayBackground deliberately because I want the character to come back immediately rather than waiting for the player to click or press a key (which is how I have the game set up). This works fine with what I have done.
#606
Apologies if this has already been asked and solved somewhere else, but I haven't found it in this forum if it has.

One edge of one of my rooms is intended to be a dead end, except it doesn't look like it in the background image. So, when the player walks off that edge, I want to make him say that it's a dead end and then walk back again.

What I have coded up isn't quite right, as it seems as though only the first two frames of the walk cycle are played as the character comes back, giving him a juddering, skipping movement.

My script for "Walk off right screen edge":

   cMyCharacter.SayBackground(Game.GlobalMessages[504]);
   cMyCharacter.Walk(141, 146);

Game.GlobalMessages[504] says "It's a dead end" (it's a global message because I'm using it in more than one place) and (141, 146) is definitely within the walkable area and is back inside all edges of the screen.

I want to use SayBackground so that the character comes straight back without the user having to click or press a key to make him do it.

Thanks.

EDIT: Is the problem that, while the character is walking back to the edge, he is still over the edge and so this script keeps getting called again and again, meaning that only the beginning of the walkcycle is played? If so, what is the correct way of doing what I want to do?
#607
I wondered if I might need another ReleaseViewport(). Thank you - it's all working now!
#608
Ashen, that worked beautifully. Thank you. My ReleaseViewport() was in the wrong place.

And using a negative number to scroll back to the left was of course correct.

EDIT: There is an unwanted side-effect: after the viewport scrolls back to the left, hiding the right-hand part of the room, if my player character (cVince) walks over to the right, the viewport doesn't update automatically as he approaches the right-hand side.

So something is still not quite right.
#609
I'm using the code Scorpiorus wrote way back for scrolling the viewport (updating it for my version of AGS).

What I want to do is scroll the screen to the right to show something and then scroll it back to the original position.

Here are my function calls to his script:

int distance_to_scroll = 40;

//scroll right
MoveViewportBlocking(distance_to_scroll, GetViewportY(), 1, 0);

//do what I want to do here

//scroll back to left
MoveViewportBlocking(-distance_to_scroll, GetViewportY(), 1, 0);
ReleaseViewport();


Now, the scroll to the right works fine (the viewport being initially aligned with the left edge of the room), but not the scroll back to the left. The call to scroll to the left does nothing, and then the ReleaseViewport() makes the viewport snap back to where it was to start with.

I've tried various values for the first parameter in the second call to MoveViewportBlocking (including 0 and -system.viewport_width / 2) but the result is always the same.

For reference, here is my revised version of Scorpiorus's code. Note in particular that I've taken the !! out before the antiglide parameter in the call to SetGameOption(), as this would not compile, and not not X == X in any case. Or did that mean something else?

function MoveViewportBlocking(int x, int y, int speed, int antiglide)
{
   int dummy = NR;   //my narrator character

   character[dummy].ChangeRoom(cVince.Room);
   character[dummy].x = GetViewportX() + system.viewport_width / 2;
   character[dummy].y = GetViewportY() + system.viewport_height / 2;
   character[dummy].SetAsPlayer();
   character[dummy].SetWalkSpeed(speed, speed);

   antiglide = SetGameOption(OPT_ANTIGLIDE, antiglide);

   character[dummy].Walk(x + system.viewport_width / 2, y + system.viewport_height / 2, eBlock, eAnywhere);
   
   cVince.SetAsPlayer();
   SetViewport(GetViewportX(), GetViewportY());
   SetGameOption(OPT_ANTIGLIDE, antiglide);
}

Can anyone help, please?
#610
I've got another problem now...

I have two non-player characters characters in a room with my player character. I walked my player character up to one of them, and he's got stuck. Looking at the walkable area with Ctrl+A, I see that the NPCs have small black rectangles around their feet - presumably this is to prevent the player character from walking into them. Is it possible that somehow I have walked on to one of these rectangles? My NPCs do not move yet, by the way (which is correct for the time being).

Thanks.
#611
Thanks very much, that's perfect.

EDIT:
Quote from: GarageGothic on Mon 10/09/2007 18:10:46
System.ScreenHeight and System.ScreenWidth are the properties that you want.

I've just checked in the manual (after getting a compilation error) and it's:

system.screen_width
system.screen_height

(in case anyone else has the same problem).
#612
OK, I'm romping ahead with the game I am working on (my first :)) and making good progress.

I have a GUI on screen that triggers dialogs. I am making the conversation options cause characters to say things. However, because the GUI is modal, it remains on screen while the conversation is running, meaning that the characters' text is sometimes partially obscured by the GUI, which is in the centre of the screen (where I want it to be).

Now, I can't make the GUI go away because it is modal (setting the Visible property to false doesn't work), so I'm looking at using SayAt instead of Say so that I can position the characters' text and control the width, ensuring it doesn't go behind the GUI.

However, this width will depend on the window size - at 640 x 400, there is twice as much space available widthwise, and I'd like to be able to use it rather than using one width for both resolutions, which will look too skinny at the higher resolution.

So my question is - how can you query the window resolution at runtime? Subsidiary question: what does any such function return if the game is being run full-screen?

Alternatively, is there some other way to resolve this issue of text being obscured by the GUI?

Thanks for any help.
#613
Critics' Lounge / Re: Gui lettering
Fri 07/09/2007 15:29:06
Quote from: Stupot on Fri 07/09/2007 14:18:18
Not enough people take the opportunity to play about with the interface (although I love Grundy's Greek style in BJ6).

WHAT! Ben Jordan 6 is out!? Whoopee! <hyperventilates with excitement>

Sorry for going off-topic. The GUI looks great. I think the icons definitely work better than the text and have the benefit of being universally understandable and avoiding translation problems should the game have a translation pack.
#614
Thanks, Ashen, Ghost, that's exactly what I did - started from an empty game. Yep, I see that I need to import new sprites for my cursors. Oh well, that's a good excuse to draw some nicer ones!

Thanks again - I can get on with things now.

#615
<sigh> I always feel like such a n00b when I get stuck on something basic and have to post here. Anyway, let me swallow my pride... :)

I've set up one room and one character in my game. The player starts in room 3 (note that there is no room 1 yet as it isn't ready to go in yet).

When I run the game, there is no pointer cursor. I can guess where I am and click in various parts of the walkable area, and the character walks around OK, but I have no idea where the cursor is. It doesn't even come up when I press Ctrl+Q. Fortunately, I can exit the game by pressing Enter as the "Quit" button is highlighted (or I could just close the game window).

If I look at Cursors, I see that "Standard cursor mode" is checked for cursors 0 to 3, but is greyed out and unchecked for cursors 4, 6 and 7 (cursor 6 being the pointer cursor) and just unchecked for the other cursors. Furthermore, the cursor images consist of just a dot for the hotspot position. This is probably what is wrong, but why aren't the cursors there? Where have they gone? I don't think I've done anything to delete them.

Thanks for any help.
#616
Quote from: Ben304 on Mon 03/09/2007 15:52:11
I have a small question....

What if one were to become a pirate [...]?

The rules say: "The main character must not currently be, have ever been or trying to get a pirate, private eye or archaeologist."

I don't think this is clear - it looks like there might be a mistake in this sentence. Is "trying to get" supposed to be "trying to become" (or "trying to get to be")?
#617
OK, thanks for that. I'm getting along fine with it now.
#618
I'm about to start developing a GUI for basic controls (walk, save, open inventory, etc) and am looking at the help file (selecting "GUI" from the Index tab in help, giving me the page "Editing the GUIs").

This page says "In the GUI Editor, you will see several buttons..." but I don't see any of the buttons mentioned. What I do see (having clicked on GUIs in the game editor menu) is buttons for adding controls to a GUI, an "Edit script" button, a couple of check boxes (Clickable, Text Window) and a magenta rectangle. There is also a floating window (GUI 0) with a list of attributes in it.

Am I looking in the wrong place?

What I want to be able to do is import an image and use that as my GUI - how can I do this?

Thanks for any help.
#619
Hints & Tips / Re: Charlie Foxtrot
Fri 17/08/2007 18:12:31
Quote from: guest on Fri 17/08/2007 14:24:43
paolo

Spoiler
Use the hammer, if I remember correctly, on the clown and Yodo will come fight him
[close]

Thanks, guest. Now,
Spoiler
if I had a hammer...  :)
[close]
Where can I get one of those?
#620
Hints & Tips / Re: Charlie Foxtrot
Fri 17/08/2007 18:10:36
Eva... hints and solution

Spoiler
The comment about lubrication is a red herring.
[close]

Hint:
Spoiler
Look at the slope and read the comments - it looks like something could slide or roll down it.
[close]

Hint:
Spoiler
Do you have anything you could slide or roll down it?
[close]

Hint:
Spoiler
Have you been into the cave with the Miss Piggy character in it (you need to get rid of Alfvis first, and do this you need someone to help you, and to do this you need something to tempt them to follow you)?
[close]

Hint:
Spoiler
Attempt to rescue Miss Piggy (you'll need something from the war veteran to do this).
[close]

Hint:
Spoiler
Pick up what Ping Pong leaves behind.
[close]

SOLUTION:
Spoiler
Use the ping pong ball on the slope.
[close]
SMF spam blocked by CleanTalk