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

#2481
Quote from: KingMick on Fri 21/04/2006 11:14:41It would be easier for a newbie like me than the on_key_press parsing idea.

the on_key_press parsing idea is excellent, and it's very easy to achieve. Probably you will find it among the simplest things in your whole script. Here's the on_key_press code for the search textboxes in my own html-like system. This is old and messy code based on strings rather than Strings, but I don't have time to update it right now:

Code: ags

if ((keycode >= 1) && (keycode <= 127) && (keycode != 8) && (keycode != 13) && (keycode != 9) && (keycode != 27) && (IsKeyPressed(405) == false) && (IsKeyPressed(406) == false)) {
		string searchchar;
		StrSetCharAt(searchchar, 0, keycode);
		if ((IsKeyPressed(403) == false) && (IsKeyPressed(404) == false)) StrToLowerCase(searchchar);
		string lengthtest;
		StrCopy(lengthtest, searchline);
		StrCat(lengthtest, searchchar);	
		if (GetTextWidth(lengthtest, 7) < (Game.SpriteWidth[442] - 3)) StrCat(searchline, searchchar);
		}
	else if ((keycode == 8) && (StrLen(searchline) > 0)) { //BACKSPACE
		StrSetCharAt(searchline, (StrLen(searchline)-1), 0);
		}


All the conditionals in the beginning are there to make sure that the char is a proper character and that CTRL isn't held down. The reason the character is parsed as a string is to make is upper or lower case depending whether shift is held. The SpriteWidth check is only used because the textbox background is a sprite.

If you used this method, but with Strings instead of strings, you could allow the label to do it's own linebreaking, so no worries about that. As for faster typing - it seems strange that this should be slow, since I assume the game is paused while the player types. You could try to SetGameSpeed(int speed) to more than the default 40 fps. But of course this will have no effect if the slowdown is caused by your CPU.
#2482
I thought this looked interesting already when I saw the screenshots in the Critics forum (the mysterious letter, and the way it's showed reminded me of Cruise for a Corpse). Is there a chance we could get just a tiny bit more of the story?

But - maybe it's just me - doesn't the name Jonathan Crest sound a bit too similar to Jonny Quest? At least that was my first reaction when I saw the title screen.

BTW, the silhouette effect is very inventive. I wish I had thought about that one myself.
#2483
Depending on how your game works (that is, whether it is pure 2D or has "depth movement" like traditional adventure games), you may actually need a z-coodinate. And AGS supports it. Check out "z property (character)" in the manual. If you use region interactions it's at least one of the easiest solutions.
#2484
The listbox code was just an example of how to use the mouse coordinates to figure out where in the text the user had clicked. The rest of the manipulation would be done through other commands - the tempstring is just there to figure out WHERE to insert new text.
#2485
Does Another World have ledge grabbing?

Edit: Sorry yeah, just remembered a couple of areas that must have it to get onward. But most of the time you just use those teleporter thingies to zoom up to the next platform.
#2486
First of all, I must repeat that this kind of String manipulation and use of external files is pretty advanced stuff. If you thought this belonged in the Beginner's tech, either you are very skilled, or not aware of how much work it will take. If the latter is the answer, perhaps you should ask yourself whether a feature like this is essential to your game or could be simplified somehow.

For security reasons, AGS doesn't allow you to go "up" a folder, since that would allow the script to do evil things, like deleting stuff from the Program Files or Windows folders.

As for how to use the listbox, this is what I meant:

Say the player clicks on a line of text. Then you would use ListBox.GetItemAtLocation(mouse.x, mouse.y) to retrieve which line number (index) the player clicked on. Then you can retrieve the content of this line using ListBox.GetItemText. Alright, since you know the x-coordinate of the ListBox, as well as the mouse.x, you can now find out how far into the line the player clicked ((mouse.x - ListBox.X) - ListBoxGUI.X).

So, to find out which character the cursor is at, you could take this width value, and do something like this:

Code: ags
String tempstring = lstMyBox.GetItemText[lstMyBox.GetItemAtLocation(mouse.x, mouse.y)];
int width = (mouse.x - lstMyBox.X) - lstMyBoxGUI.X);
while (GetTextWidth(tempstring, fontnum) > width) {
    tempstring.ReplaceCharAt(tempstring.Length - 1, 0); //shortens the string by one character
    }


Doing this, the tempstring will be shortened down to the amount of characters to the left of the cursor, which means you know from which point in the text to manipulate it. You may have to deduct a pixel or two from width, since the text doesn't start at the exact coordinate of the ListBox.

I hope this makes sense. And that you do know this is just the very beginning.

Edit: Another solution, which would only allow a limited amount of space, and would take up memory while playing as well as drive space in every savegame, is to create a large array of Strings. I chose not to use this option for my own game, as a conversation log could end up being many MBs of data, but few players would end up writing as much text as the game itself contains. And it would make random access manipulation of data much easier.
You could still have the listbox as a managing device, but the data would be stored within your savegames rather than in external files. Then, when moving onward to the expansion, data could be exported to one big txt file, read back into the expansion. This could be generated when quitting the game.
#2487
I could, but it would take ages for me to make sure it complied to the module formatting conventions. Also, there's more to it than just putting the code into a module. Ideally I would like to write a single IsCollidingPixelPerfect that could be used for characters/characters, objects/objects and characters/objects. But I don't think there's any way to make a common function that accepts pointers of either type and then acts accordingly depending on their type, is there?

In other words, if anyone else feels like making a module, please do so. I'm sure your code will be much more user friendly than mine.
#2488
The string length isn't a problem anymore since we now have Strings of unlimited length. However, that may not be the best solution of managing the text. The easiest way I can see is to have every page consist of a listbox, this is the way the conversation log in my game works. That should also make the positioning of the cursor trivial (height coordinate handled by the listbox itself, width calculated with GetTextWidth)

However, creating a random-access system with multiple pages will be difficult. The easiest way would be to output every page to it's own text file, then read that page back in, edit it, and output it, overwriting the old file for that page. This means that could can't add to a page and let it wrap existing text onto the next page though. Every  page will be a self contained unit with a limited amount of space.

The only way these files could be accessed by another AGS game is if they're in the same folder. So you must either ask the player to move the files to the expansion's folder or place the .exe files in a common folder.

Edit: You could use HeirOfNorton's encryption module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23109.0) to avoid players reading/messing with the external files.

Edit 2: I think this topic is advanced enough to be moved into the real Tech forum instead of Beginner's Tech
#2489
There's no reason to simulate anything, just add a conditional that is reset whenever the button ISN'T PRESSED. So add a variable to the globalscript:

Code: ags
bool takingscreenshot;


Let's continue with a few modifications to Gilbot's code:

Code: ags
 if ((keycode==434) && (takingscreenshot == false)){  // F12
      string tmpstr;
      while (sscounter<1000){       
        sscounter++;
        StrFormat(tmpstr,"game%03d.pcx",sscounter);
        sshandle = File.Open(tmpstr, eFileRead);
        if (sshandle == null) {
          SaveScreenShot(tmpstr);
          takingscreenshot = true;
          return;
          }
         sshandle.Close();
        }     
      }


Now, add this to repeatedly_execute:

Code: ags

	if (takingscreenshot == true) {
	  if (IsKeyPressed(434) == false) takingscreenshot = false;	  
	  }


This should make sure that you can't take another screenshot until you let go of F12 and then press it again.
#2490
I'm very impressed with the framerates I'm getting, and the interface is so easy to use. I could see myself using this - if not for a full game, at least for some special sequence like a chase, a spectacular camera move or similar. Great, great achievement.
#2491
Adventure Related Talk & Chat / Re: Tintin
Tue 18/04/2006 14:53:34
Well, the (so-called non-profit) Foundation Hergé is protecting the works of the author. But that doesn't mean that they can't license the stories, artwork and characters for games, figurines, t-shirts etc. to others. I think their main interest is keeping a certain standard to the franchise.

You might find this interesting: http://www.spiderbomb.com/burgundy/Tintin/hergefound.html

BTW, I never heard before that Spielberg wanted to cast Henry Thomas (from E.T.) as Tintin and Jack Nicholson(!) as Captain Haddock.
#2492
Hints & Tips / Re: Ben Jordan 5
Tue 18/04/2006 13:37:03
Quote from: paolo on Tue 18/04/2006 12:18:00About the Easter egg...

Spoiler
Grundislav told me it's something to do with how you get rid of the flowers. I haven't had time to try it out
[close]
#2493
Quote from: Edmundo on Mon 17/04/2006 19:43:20
They did. it was called Heart of Darkness and came out on the Sega CD!

Don't you mean "Heart of the Alien"?
#2494
Quote from: Anghellic on Mon 17/04/2006 18:36:46what is this crap? I did draw that thing myself... You just putted my sprite on some other game!!

wow, it's really some conspiracy if airgo managed to manipulate screenshots on ign.com:
http://media.gameboy.ign.com/media/482/482099/imgs_1.html
#2495
Quote from: Chicky on Mon 17/04/2006 17:03:34Now i can't get past the big evil monster that chases you, any help? :P

Run all the way to the left and jump off the cliff
#2496
It looks great, but the demo is very short though (intro plus first six screens) - hardly worth a 22MB download. Is it just me or did this seem much easier than the original? I remember the leeches as being very hard to kill without getting stung. This time I went through the level on my first try.
#2497
Spoiler
Did you remember to plug in the radio again?
[close]
#2498
Quote from: InCreator on Sat 15/04/2006 18:41:22Seeing the orichalcum statue was very.... strange.

I interpreted this as an in-joke. After all, it must get to Barnett College somehow, since Indy finds it there in FoA.
#2499
As Radiant suggested a few days ago, you could look at KQ4's Pan character. Since no one else bothered to post those walkcycles, here they are:
#2500
Quote from: cjhrules on Fri 14/04/2006 13:11:011. fight with the numeric keys. if you face right 9,6,3 and if you face left 7,4,1

For the full game, please keep in mind that not everyone has a numeric keyboard (such as laptop users)
SMF spam blocked by CleanTalk