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

#21
Oh yes, sorry. I have trouble with big words.
#22
Well, if you want your character to be centred in every room, game_start() is a better one.
#23
So:

Code: ags
ViewFrame *frame = Game.GetViewFrame(cEgo.NormalView, 0, 0);

//And then:

cEgo.z=(0 - (Game.SpriteHeight[frame.Graphic] / 2));

//Or alternately:

cEgo.Walk(100, 100+(Game.SpriteHeight[frame.Graphic] / 2));


That, uh, that would work, right?
#24
For the record AGS moves the bottom centre of the sprite to the Walk co-ordinates.

This is difficult for me to solve without knowing exactly what effect you're trying to achieve. You could try giving the character a z property that is negative half of its sprite's height, in order to move the "feet" halfway up the sprite. Or, when you give the Walk command, add half the height of the sprite to the y co-ordinate. Then when it moves the centre of the sprite will end up where you clicked.
#25
Quote from: Ashen on Sun 28/01/2007 15:35:03
If the problem is just that the Button doesn't change graphic, then as I understand it DynamicSprites declared in a function (e.g. a Button's Control function, or the on_key_press condition that opens the Load Game GUI) are only good in that function - once it finishes running the DymanicSprite is deleted, and all uses are cleared.

How was I supposed to know this?!!
#26
I have a new problem. After my GUI pops up I want a black-and-white static effect to appear on the portrait for a few seconds or so. I could use an animation, but that's repetitive to the eye, so I wrote a DrawStaticOnButton function that draws a randomly generated mixture of black and white pixels on a DynamicSprite. To test it I called DrawStaticOnButton at the end of my function that starts up the conversation GUI, but nothing appears to happen. After some debugging, I've discovered that the DrawStaticOnButton function actually runs as expected, but as the function finishes and the script hits the next line of code, the button that it has been drawing onto (TSLeftPortrait) has its sprite number reset to 0. Any ideas why this is happening?

Code: ags

function DrawStaticOnButton(int StaticDSX, int StaticDSY, Button *theButton)
{
  DynamicSprite *StaticDS = DynamicSprite.Create(StaticDSX, StaticDSY);
  DrawingSurface *StaticDSsurface = StaticDS.GetDrawingSurface();
  int StaticDSpointX = 0;
  int StaticDSpointY = 0;
  while (StaticDSpointY<StaticDSY+1) {
    while (StaticDSpointX<StaticDSX+1) {  
      if (Random(1)==1) {StaticDSsurface.DrawingColor = 15;} else {StaticDSsurface.DrawingColor = 0;}
      StaticDSsurface.DrawPixel(StaticDSpointX, StaticDSpointY);
      StaticDSpointX++;
    }
    StaticDSpointY++; StaticDSpointX=0;
  }
  StaticDSsurface.Release();
  theButton.NormalGraphic=StaticDS.Graphic;
}

function StartTalkSystem(Character *chartalkto, Dialog *chardialog)
{
  TSMouseX=mouse.x-(gTalkSystem.Width/2);
  TSMouseY=mouse.y-(gTalkSystem.Height/2);
  while ((TSMouseX+gTalkSystem.Width)>=System.ScreenWidth) {
    TSMouseX--;
   }
  while ((TSMouseY+gTalkSystem.Height)>=System.ScreenHeight) 
  {
    TSMouseY--;
   }
  gTalkSystem.X=TSMouseX;
  gTalkSystem.Y=TSMouseY;
  gTalkSystem.BackgroundGraphic=572;
  gTalkSystem.Visible=true;
  TSAnimateButton.Visible=true;
  TSAnimateButton.Height=66;
  TSAnimateButton.Width=169;
  TSAnimateButton.Animate(70, 0, 3, eOnce);
  while (TSAnimateButton.Graphic!=581) {Wait(1);}
  TSAnimateButton.NormalGraphic=572;
  gTalkSystem.BackgroundGraphic=581;
  TSAnimateButton.Visible=false;
  mouse.Mode=eModeWalkto;
  DrawStaticOnButton(49, 60, TSLeftPortrait);
}
#27
Well, I've just gone with

Code: ags
while (TSAnimateButton.Graphic!=581) {Wait(1);}


where 581 is the sprite number of the last frame of the animation. I still don't understand why there isn't a BlockingStyle enumerated type for this function.
#28
I do? Well I'm not very good at converting such things; how do I convert animation frames to game loops?

And even if I did use Wait(), that's a bit sloppy isn't it? It's a hard-coded solution instead of allowing the game to do the necessary calculations itself.
#29
The 'blanks' being what you should do if you don't want to send this completely harmless usage information for the long-term benefit of all AGS users. Otherwise you could set your firewall to allow external connections from AGS.
#30
Why, adventuregamestudio.co.uk is the website you're currently visiting. The editor should have asked you about this when you installed it. It's collecting usage information; nothing personal, and it can be turned off if you don't want it. You can read all about it in the help files under the title 'Anonymous usage information'.
#31
I decided to redesign my interface more than the old walk-look-interact mouse cursors, and I've started by converting my default LucasArts-style conversation system into a Sierra-style portrait system with interaction buttons alongside it. Kind of like in Jagged Alliance 2 (if anyone except me has played that game).

The easiest way to do this is of course a GUI. I wanted the GUI to have a start-up animation, so it does something snazzy when it first pops up, but this doesn't seem so easy. The only thing you can animate on a GUI is a button, and even then it doesn't block! My function-in-progress looks like this, designed to resize the button so it is the size of the GUI and then animate:

Code: ags
function StartTalkSystem(Character *chartalkto, Dialog *chardialog)
{
  gTalkSystem.BackgroundGraphic=572;
  gTalkSystem.Visible=true;
  TSAnimateButton.Visible=true;
  TSAnimateButton.Height=66;
  TSAnimateButton.Width=169;
  TSAnimateButton.Animate(70, 0, 3, eOnce);
  TSAnimateButton.Visible=false;
  TSAnimateButton.NormalGraphic=572;
}


Of course when I tested it out, nothing appeared to happen. This is of course because button.Animate(); was not blocking and the lines of code after were being run immediately, causing the button to disappear. Commenting them out makes the animation visible, but even then I have no idea of knowing when the animation is finished, and therefore I can't write any more code for it.

Why is this the case, and what should I do?
#32
Sorry about the 'string' 'String' confusion; I'm very bad at checking my scripts :D

I'm glad my SayCustomFont function worked for you though.
#33
How does the idea of a custom Say function strike you? (Bear with me here as I've never used extender functions before)

Code: ags

function SayCustomFont(this Character*, string message) {

 if (this == cEgo) {Game.SpeechFont = eFontEgoSpeech;}
 else if (this == cRoger) {Game.SpeechFont = eFontRogerSpeech;}
 else ...
 
//etc. for every character in the game that you want to use a custom font

 this.Say(message);
}


Then you can just ditch the standard dialog formatting altogether, and use:

Code: ags
@1
 cEgo.SayCustomFont("Hi, I'm using a custom font.")
 cRoger.SayCustomFont("So am I! My font is different to yours!")
return
#34
I'm always available for proof-reading, correction, rephrasing and so on; my grasp of English is exceptional, and I should hope so, being an Englishman.
#35
I'm confused. Are you saying with 'if (blah<100)' you can check a char against its ASCII decimal? Or merely its numeric value?
#36
Oh, I can't believe I forgot the semicolons. I'm such an amateur!
#37
Off the top of my head, do you see any problems with this?

Code: ags
function repeatedly_execute() {

 if (cPlay.ActiveInventory == iPencil) {
  iPencil.Graphic = 48
 }

 else {
 iPencil.Graphic = 46
 }

}
#38
So what about detecting if a character is a symbol or number rather than a letter? I was trying to script this and had the idea of checking the ASCII value as 65-90 or 97-122, before I realised there is no way to check the ASCII value of a character. You could of course check every character against every possible symbol but that's way too impractical and would require too many strings.
#39
General Discussion / Re: HOTU is more dead
Thu 05/03/2009 00:32:43
His, her, what's the difference?
#40
General Discussion / Re: HOTU is more dead
Wed 04/03/2009 02:41:36
I win the contest, look at this.

HOTU is dead, long live... its replacement!
SMF spam blocked by CleanTalk