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 - Lt. Smash

#141
wow the new custom dialog system is great.
Just a little grafical issue:

When a text is displayed in a textwindow (Display("asdf");) you can erase the dialog gui.
#142
static bool Game.ChangeTranslation(string newTranslationName)
supported by one of the latest ags betas.

#143
of course you have to change 'labelname' to the name of your label  ::)
#144
its this one:
#145
You could make use of DrawingSurface.DrawStringWrapped.( supported by AGS 3.0.1 or higher)
First draw the black shadow text (for longer shadows you have to repeat this step)
and on top of it, with a proper offset, draw the normal font.
Then you would have to create your own Character.Say or whatever you are using but it should be doable.
#146
Quote from: Pumaman on Sun 14/09/2008 15:03:45
Quote1 BUG: Importing a single sprite with any corner as transparent, changes all black pixels in the sprite to the color of the corner pixels.
1 SUGGESTION: When importing multiple sprites, I would like to be able to choose the transparency settings once for all of them.

Can you post a sample image file that causes the bug?
here:
normal sprite      sprite imported with top left pixel as transparent.

Quote
As for multiple sprites, when you do a Quick Import Multiple Sprites it should use the transparency option that was last selected in the import window.
I know that but its not very comfortable with many animations. Because I have some with alpha-transparency, some with blue/pink transparent areas, some with transparent pixels only on the bottom left/right. So I always have to import a single sprite first before I can import the rest? Not very easy/fast.
#147
1 BUG: Importing a single sprite with any corner as transparent, changes all black pixels in the sprite to the color of the corner pixels.
1 SUGGESTION: When importing multiple sprites, I would like to be able to choose the transparency settings once for all of them.
#148
The highlights on the wall seem wrong 'cause sunlight can't go upwards. So it should be a little bit more like that:


though I'm not quite sure if the highlight box is bent correctly. We are supposing that the sun is behind us and a bit to the left.
#150
why don't you make a label on the gui and then use GUI.Transparency? your game has to be at least hi-color 16-bit.
lets assume the labels name is lblDescription and the gui is gDescription.
Code: ags

//in top of global script:
bool fadein;
bool fadeout;
int gTransparency;
int gID;


void Fade(this GUI*, FadeStyle style)
{
	if (!fadein && !fadeout)
	{
		gID = this.ID;
		if (style == eFadeIn)
		{
			fadein = true;
			this.Visible=true;	
			gTransparency = this.Transparency;	
			SetTimer(20, 1);
		}
		else if (style == eFadeOut)
		{
			fadeout = true;
			gTransparency = this.Transparency;
			SetTimer(19, 1);
		}
	}
	if (style == eStopFading)
	{
		SetTimer(20, 0);
		SetTimer(19, 0);
		fadein = false;
		fadeout = false;
	}
}

//////////////////////////////
//in global header
enum FadeStyle {
  eFadeIn, 
  eFadeOut, 
	eStopFading
};
///Fades the gui in or out
import void Fade(this GUI*, FadeStyle style);

////////////////////////////////
function repeatedly_execute()
{
  if (IsTimerExpired(20) && gTransparency >= 0 && fadein) //FADE IN
	{
		gui[gID].Transparency = gTransparency;	
		gTransparency-=3;
		if (gTransparency > 0) SetTimer(20, 2);
		else {
			gTransparency = 0;
			gui[gID].Transparency = 0;
			fadein = false;
		}
	}
	
	if (IsTimerExpired(19) && gTransparency <= 100 && fadeout) //FADE OUT
	{	
		gui[gID].Transparency = gTransparency;	
		gTransparency+=3;
		if (gTransparency >= 100) 
		{
			gui[gID].Visible = false;
			gTransparency = 100;
			gui[gID].Transparency = 100;
			fadeout = false;
		}
		else SetTimer(19, 2);
	}

	Hotspot *hot  = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
	if(hot == hotspot[0] && gDescription.Visible) //cursor on no hotspot
	{
		if (!fadeout) gDescription.Fade(eStopFading);
		gDescription.Fade(eFadeOut);
	}
	if (hot != hotspot[0] && !fadein)
	{
		gDescription.Fade(eStopFading);
			
		if(hot == hotspot[1])
		{
			lblDescription.Text = "Text for hotspot 1";
			gDescription.SetPosition(20, 12); //changes its coordinates to be at the right position
		}
		else if (hot == hotspot[2]) //continue like this for the rest of the hotspots
		{
			lblDescription.Text = "Text for hotspot 2"; //You can use ttf fonts instead of the ags built in fonts
                        gDescription.SetPosition(123, 45);
		}
			.....

		gDescription.Fade(eFadeIn);
	}
}
     

and before the gui is used the first time:
Code: ags
gDescription.Visible = false;
gDescription.Transparency = 100;
#151
For the menu you just create a new gui, make some buttons on it, double click them and write the code Buckethead posted in the new functions.
#152
you could create a struct array with x, y coordinates in which you save your puzzle coordinates:
Code: ags

//script header
struct coordinates
{
  int x;
  int y;
  bool used;
};
import coordinates Point[MAX_POINTS];

//main script
coordinates Point[MAX_POINTS];
export Point;


then you use in :
Code: ags

Point[0].x = 12;
Point[0].y = 123;
...


[edit]Let's make it a bit nicer!
The mix() function:
Code: ags

//header
struct mem //in that struct you can add your functions for pair checking etc.
{
  import void mix();
  ...
};
import mem Memory;
//script
mem Memory; //on top
export Memory;

mem::mix()
{
  int i;
  while (i < MAX_POINTS) { //reseting memory
    Point[i].used = false;
    i++;
  }
  i = 0;
  int pos;
  while (i < MAX_POINTS) { //mixing the cards
    pos = Random (MAX_POINTS-1);
    if (!Point[pos].used)
    {
      Point[pos].used = true;
      object[i].SetPosition(Point[pos].x, Point[pos].y);
      i++;
    }
  }
}

in the room script then just use
Code: ags

Memory.mix();



[edit]tested and works!
#153
Quote from: Pumaman on Tue 12/08/2008 21:02:52
QuoteWhen using an alpha transparent sprite as button image, it doesn't show correctly (even when the gui has an alpha channel). Only when the gui background image is fully transparent then the button image shows correctly as it should. (so my experience)

What do you mean, "doesn't show correctly"? Have you tried the new AdditiveOpacity option in the beta?

Yes I tried AdditiveOpacity. No difference.
You can see the problem here:

Both buttons have the same sprite.
  The left button is on a completely transparent gui above the blue gui.
  The right button is put directly onto the blue gui. - You see that it doesn't show the transparency just black pixels?

Also pixel-perfect click detection doesn't work on the fully transparent parts. Even if I use top-left pixel when importing.
I'm using 1024x768.
#154
Also one:
When using an alpha transparent sprite as button image, it doesn't show correctly (even when the gui has an alpha channel). Only when the gui background image is fully transparent then the button image shows correctly as it should. (so my experience)
#155
Quote from: scotch on Sun 10/08/2008 20:26:39
Could use...
I just had to modify the function name because ags says its already defined
but now it works perfect. :)

thank you.
#156
Hey all!

I wanted to make a custom Split() function for Strings* but I found out that I can not set a starting index to IndexOf/Contains.

The code for the split function is here:
Code: ags

void Split(this String*, String separator, String array[])
{
	int n = this.Length;
	int start, stop, i;
	while (start >= 0 && start < n) 
	{
		stop = this.IndexOf(separator, start); //the second parameter is the startingIndex (from that index the function searches)
		if (stop < 0 || stop > n) stop = n;
		array[i] = this.Substring(start, stop);
		start = this.IndexOf(separator, stop+1);
		i++;
	}
}

So I want to ask you if you could help me coding an overloaded version of indexOf.
It would be even better if CJ could add an overloaded version to the next ags version. (Maybe also an String.split(String separator, String array[]?)
#157
I would like a preview of the transparency settings in the sprite import window. So when using top-left corner the sprite will get all pixels with that color deleted (in the preview and of course in-game).
Leave-as-is should work with alpha-tranparent pictures. So if I use one as button, the button will be alpha blended in-game.
Alpha-blended buttons should be shown correct in sprite manager preview and gui/room preview.

OFF-TOPIC: I have a non-transparent gui and an alpha-blended button. But the button isn't alpha blended in game. What can I do to make it transparent?

It would be nice if CJ could tell us what he thinks of all this suggestions (from the whole thread).
#158
RawDrawImageResized is old-style scripting from ags 2.62 and older. If you don't want to correct the whole module try to uncheck 'enforce object-based scripting' and 'new-style strings' in the general settings pane.
AGS throws an undefined token error when there is a word, text (not a String) in the script that it doesn't understand. (like Wienerwurst)

[edit] oh, my fault. Two times "nearly" the same answer. Didn't see the post from Pumaman.
#159
hey everyone!

I have a simple question:
I want to make a userinput box where I can write in text with special characters (ascii  128-256).
The behavior of normal textboxes is that they don't allow me to write f.e. "Straße" (german for 'street').
So how can I code that?
Does AGS recognize key presses from ascii >128 at all? If not this would be a suggestion for a future version.

ty for helpful answers.
#160
or Chris could add the switch command. One 'switch' could replace all of these 100 if/else.
SMF spam blocked by CleanTalk