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

#21
Quote from: Scarab on Fri 24/06/2011 04:41:19
Quote from: Khris on Thu 23/06/2011 10:47:45
Hmm.
Why not put the blues (and magenta) on a sprite and draw the rest normally...?

This seems like a viable solution. If there are only 33 values that do not work, surely you can just single them out?

Yea, if running GetColorFromRGB will in fact work for every other color besides those thirty three, then it would be a lot easier to have a line of 32x1 for blue, then do:

If Red == 0 && Green == 0 && Blue <= 32, sprite.Crop(1, Blue, 1, 1);

If, however, GetColorFromRGB messes up other colors, any unreliability would mess up any drawing program.  It's just -a- solution, if someone else really needs colors to be specific.
#22
Quote from: Khris on Thu 23/06/2011 10:47:45
78MB? I can't get over this, sorry, it's just too hilarious. ;D

Which I don't understand because the picture itself is only 58 KB...
#23
Sometimes you are locked out of being able to type, which means you cannot type 'yes' for restart.

Thought I'd mention that before I dive in further.  Love the map, by the way!
#24
It's -a- solution.  Obviously it'd be more reasonable to change how the game works but I haven't found that part of the source files yet.

The transparency is there because otherwise the game displays magenta as (254,0,255).  While testing the sprite was actually the size of the room with one pixel of transparency.

What would be far more useful would be being able to accurately detect a color's rgb.  Then there'd be no limit to what you could draw, without the need to have a sprite saved for every light flicker or shadow, for example.

If you don't think my script would be useful while playing, it could come in handy for drawing while still designing a game.
#25
AGS cannot detect a color's RGB or draw in every color, so I wrote a script that allows you to draw with any color, including blue 0-32 and magenta 255,0,255.

You'll need to download a large picture that has every possible color on it.  This increases the size of an otherwise empty game to about 78mb, and might be slow (I haven't tried it on other computers), but no drawing game can be complete if any colors aren't allowed.

You will need the following picture.  I haven't used this as I've made my own, so reply if this one somehow doesn't work as I've described.
http://thomasinterestingblog.files.wordpress.com/2011/06/fullrgbcompressed.png


All that's required to make this script work is this picture, a trigger (hotspot or GUI), three sliders (min = 0, max = 255) or perhaps a prompt, and a sprite with a pixel of transparency.  This transparency goes on top of otherwise transparent magenta and cancels it out, allowing the game to display true magenta.

DynamicSprite* sprite is the large picture.  CopyTransparencyMask is for the picture with one pixel of transparency (when testing I used an alpha channel and NOT transparent magenta).

You'll probably also want to change the sprite.resize from 1024x768.  Reply if you have any questions:
Code: ags

function Sixteen()
{
  Red = Red - 16;
  Row = Row + 1;
}

function ColorPrompt()
{
  Red = SliderRed.Value;
  Green = SliderGreen.Value;
  Blue = SliderBlue.Value;
  while (Red > 15) {
    Sixteen();
  }
  Column = Red;
  RGBX = (Column * 256) + Green;
  RGBY = (Row * 256) + Blue;
  DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(9);
  sprite.Crop(RGBX, RGBY, 1, 1);
  sprite.Resize(1024, 768);
  sprite.CopyTransparencyMask(10);
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, sprite.Graphic);
surface.Release();
sprite.Delete();
Display("Color is in Row %d, Column %d.  RGBX is %d, RGBY is %d", Row, Column, RGBX, RGBY);
Row = 0;
Column = 0;
}
#26
I've tried it a few times and found that while running the script once increases the memory and cpu usage, running it a few times increases it temporarily but then lowers it back to the elevated level, so it does not keep taking more and more memory.

I've found the documentation about script blocking, something I didn't know about but now I see how it works.  This thread was only ever about having two scripts running at once, or one script running while still being able to move, but now I see that while loops force the game to wait.
#27
A drunken momerath, outgrabe?

My script takes ten seconds.  These were my choices:
A. Let the player see the room and not be able to do anything (after fade-in)
B. See nothing and have a drawn-out fade in (before fade-in).

C. If I combined after fade-in with a repeatedly_always clock and a wait within a while along with a 'loading' picture, this would show that the game was still running.

I wasn't refusing you, it's just my script wasn't the problem.  This thread was about being able to have stuff running simultaneously.

I was certain nothing was wrong with my script and I've found that if I take the following out, there's no memory leak:

DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
 DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(35);
 sprite.Crop(0, intA, sprite.Width, intB);
 surface.DrawImage(0, intC, sprite.Graphic);
 sprite.Delete();
 surface.Release();

This is rearranged from how it's typically shown in the help file - I've tried releasing the surface before deleting the sprite.  I'm not sure what's wrong.
#28
QuoteIn your first post you said you're running a while loop in the player enters room before fade-in function. You don't seem to understand what that means.

First of all, anything in the before fade-in function is going to be executed before the screen fades in. That means you will not see any objects, any characters, any GUIs, any overlays, or anything at all until the function is finished executing.

I do know, I just preferred seeing nothing to seeing a blank room where the player can't click anything and doesn't know why.

QuoteSecondly, a while loop does not allow other script functions to execute while it is running. The exception is that if you call Wait inside the loop, then repeatedly_execute_always will be allowed to run, but that's it.

Even running something from repeatedly_execute_always will not override the first point. Until the before fade-in function is completely finished (including any while loops you're running within that function), then you're not going to be able to see anything.

I liked this approach better than doing it before or after the fade-in because it lets the clock run AND I can say "Loading" or something while it's loading IF I include a Wait(1); inside of a While loop.  Display blocks scripts but a picture of the word Loading can stay on while the script is running.  Although a long fade out + fade in has its charms.

QuoteFrom there I'm really curious what you're doing that is causing your room to take 10 seconds to load...

Yea, that's me.

QuoteFurthermore, you shouldn't use repeatedly_execute_always (or repeatedly_execute) for animations unless you have an explicit need to do so. For most cases using a Character, Object, or GUI Button would be a better fit for your animation needs.

Simply doing things without understanding why you're doing them or what the problem was to begin with is not a good idea, especially when it comes to programming. Just because something might give the appearance of the results you want does not mean that you're doing it right.

Speaking of that.  If, say, you opened Task Manager while running your program and saw the amount of memory and cpu usage increased when you run a script, is there a way to lower that back once the script is done?
#29
Quote from: Creator on Mon 20/06/2011 05:02:10
You could also make a function called repeatedly_execute_always in the global or room script. This allows you to have things running even while the game is blocked (like your clock, for example).

Aha!  Thank you!
#30
I have a while script that, for now, I have running before the fade-in, just so the player knows something's happening.  It's something that loads in the room that takes ten seconds to load.  My question is:  Does everything need to stop while something else is loading?

Pretty much any while script makes everything stop, even the clock I put in the corner.  Other games will have stuff loading while you're playing.  Is there something I can do?
#31
Thanks!  8)
#32
float Value = int1 * (3/4);  returns cannot convert 'int' to 'float'.

float int1float = IntToFloat(int1);
float Value = int1float * (3/4); returns cannot convert 'float' to 'int'.

float float1 = 1
float Value = float1 * (3/4); returns cannot convert 'float' to 'int'.

Using (.75) returns Parse error in expr near "."

All I want is for a number with a decimal.  What am I doing wrong?
#33
Quote from: Eleri on Mon 30/05/2011 17:13:56
Quote from: KamikazeHighland on Mon 30/05/2011 03:06:22
The first thing is to create a room using the list at the right, and after that another list should appear under that.  Scroll down and past Properties is Settings, and set ShowPlayerCharacter to False.

Is there any way to set this globally? Cause Lazy Coder is Lazy  ;D

I'm not sure.  However, there's not much point because there's probably a lot of other things lazy coder is too lazy for.  8)

If you right-click the room number on the top right list, you can hit 'Create Template from Room..." and never have to copy over any of your code for that type of room!  :=
#34
You can have the cursor change when it's over a hotspot, or, if the doors were separate sprites from the background, you could sprite.Tint the doors a different color.
#35
The first thing is to create a room using the list at the right, and after that another list should appear under that.  Scroll down and past Properties is Settings, and set ShowPlayerCharacter to False.

You can use characters later, but for now upload your first background and draw Hotspots over ever point of interest, making sure to change which Hotspot you're working on using the dropdown list above your hotspot settings.  Use the lightningbolt button for a list of events and choose which type of event you'd like something to happen.

Try making something small and see how it goes. :=
#36
Quote from: Calin Leafshade on Sun 29/05/2011 15:32:17
Color Classplease, not an integer.

Color c = Color.FromARGB(R, G, B, A);


Is that an actual thing?  That'd be cool, although I can define alpha in DrawImage.


Anyway, so will using GetColorFromRGB only ever return one of the 65535 colors that can be read with GetPixel?  I ask because while I'm not sure how to make use of Iceboty's code, if the color returned is an integer can that int ever be outside the 32x64x32 color range (i.e. Color_Transparent = -1, white = 65535)?  I'd be wasting my time with GetColorFromRGB if the color could only ever be one of the color codes anyway.

I'm glad you spelled out how GetColorFromRGB works because I've been trying to figure out why it returns different values for green and red whenever I set them to be the same.

I can't get enough of the double bitwise shifts, lol.  8)
#37
Game.GetColorFromRGB(255, 0, 0); is Red, Game.GetColorFromRGB(0, 255, 0); is Green.  Game.GetColorFromRGB(0, 0, 255); is... light grey...?

Game.GetColorFromRGB(0, 0, 100); is some sort of red.
#38
You've both actually been more helpful than you may realize, and I've worked around the issue.

Sometimes you just can't come up with an answer until /after/ you ask.  Thanks!
#39
Quote from: Khris on Thu 26/05/2011 05:49:29
(Why would the editor's drawing tools have any bearing on what drawing commands are available as script commands anyway? I don't see the connection.)

Well, I don't know, if you can draw in the editor but you can't make a game using that editor where you can draw in a similar fashion..

Thanks for the quick reply!
#40
There's probably a way to make a button to switch to another GUI.  You could have a gui that's actually a list of menus, like an RPG does.  Or have a mouseover code that shows larger text whenever you have the mouse over that button, if you have lots of small buttons.
SMF spam blocked by CleanTalk