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

#41
Quote from: Snake on Fri 19/10/2007 19:31:18
I wouldn't have the foggiest idea where to start writing a high scores script from scratch. Yeah, I could display the score in a seperate room (a monkey with ADHD could do that) but writing multiple scores in chronological order (while being able to allow the player to write a nickname) is confusing for me.

Usually high scores are just in order of the scoring, not chronological.

Break the problem into smaller parts:

1. You need to be able to read and write to a file. You need to be able to store numerical data (the score) and textual data (the nickname).

2. You need to be able to sort scores in order of value. I don't have my AGS help manual open in front of me, but there is no doubt some way to sort things. (If there isn't, well -- you'd need to write your own sorting function. But for only 10 numbers or so that is pretty simple.)

3. You need to check if the current score (at the end of the game) is more than the smaller high score, and then ask for the nickname, and then see where it fits into the list of high scores, and then write it to the file.

Think about the format you want to use (try it unencrypted first), look at the help file functions for reading/writing files, and it should become more clear how to write the sort of thing you want to write. The best way to learn about programming is to try it yourself, and the best way to tackle any programming problem is to break it into small and discrete chunks! :-)
#42
Quote from: Ashen on Tue 16/10/2007 12:30:41
So, frission, is this solved (in which case, please edit the title), or are you still taking suggestions? Not that I have one, I think the best ways have been suggested already. I'd probably go with the semi-transparent GUI, as I couldn't be bothered changing the graphics of, or tinting, everything on screen. However, if it's only one or two rooms, actually drawing 'dark' versions of everything would probably look better - you could do hightlight/shadow effects, instead of just making them 'the same but darker'.

Oh, this is solved. Thanks for reminding me.

Basically the two best options are the GUI overlay, which works fine in some cases, and maybe switching animated backgrounds, if the scene requires something more than that. Either way both of those options work great, and for a quicky-"make them turn on the lights before seeing the grisley scene" the GUI method works fine (one could imagine combining it with a few other tricks too if you want certainly things to be genuinely not visible until they turn on the lights).
#43
Quote from: Lyaer on Mon 15/10/2007 02:08:59
Thank you both so much.  The codes work great.  It never occurred to me that  that I could just plug a predefined string in without using the "%s" first.  I always saw it used that way in the manual, albeit with other text involved.

If the function just takes a straight String object, and you are just passing it a straight String object, then you don't need to use the %s formatting. String.Format and the %s formatting in general is useful when you need to either quickly throw together a lot of variables into a String, or to combine different variable types (like putting numbers into Strings -- which is why the manual has a bunch of examples with it, since displaying scores and other common things like that requires putting ints into Strings). Sometimes it is useful for mashing together a lot of Strings as well, since they can't be just added to each other line numbers.
#44
Also, just as a note, GetTextWidth is not always 100% accurate when it comes to the GUI control's automatic text wrapping. If you get slightly anomalous results it sometimes helps to pad your calcuations by a few pixels.

Also -- is there a reason you are using string formatting at all? Couldn't you just do:

Code: ags

function TextIt (String sa, int width) {
  int beginning=0;
  int end=sa.Length;
  while (width < GetTextWidth(sa.Substring(beginning, end), eFontFont1)){
    end--;
}
  Display(sa.Substring(beginning,  end));
}


That is, I don't really see what you are doing with the string formatting ("%s") at all there, since you are just using strings all the way through.
#45
Quote from: Monkey Entertainment on Sat 13/10/2007 19:39:32
wow... I feel like a fool right now.  :-[
I don't know from where, but I have got the idea that you can do else statement like that. Well, you learn as long you live.
But you can do like this:

if (blah blah){
  //code
}
else blah

Right?

Btw, it works fine now :)

Right. But if you don't use braces after an else (or an if), it will only process the next command as being part of that conditional statement. So yes to blah;, no to blah; blah; blah;.
#46
The other issue, of course, is that step 1 already requires a great deal of artistic intuition and talent, as crude as it looks compared to the final product. The hardest parts about drawing realistic scenes are not the refining and the choice of colors and etc., but knowing how to use scale, perspective, and composition. This is the sort of thing that feels most "natural" to someone who has drawn for many years, but it is definitely a learned skill, and the part that will baffle most newcomers.

I had a great book awhile back called "Drawing on the right side of the brain," which I thought broke down the basics of hand sketching very well. Obviously true artistic genius is something one is either born with or not, but the basic ability to sketch out semi-realistic looking scenes is something that can be taught to anyone and can be learned by anyone, but it takes a lot of practice. Basically the book argues that practicing and critiqueing and practicing some more is probably the most important thing a beginning artist can done, in the same way that anybody who has ever learned a musical instrument knows that almost 80% of playing the thing is about developing precision hand-ear coordination. Once you have that, adding new techniques and methods becomes something possible; until you have that, everything you try to produce will sound like crap. :-)

Out of the tutorials I've seen (I just read dkh's), the ones that have been most useful for me (and I would imagine to be most useful to others) were those that went over the nuts and bolts of doing very simple backgrounds (e.g. simple chunky pixel rooms -- like dkh's), that explained how you could use photographs to get an idea of how to color and shape your work (like the background art tutorial at barnettcollege.com), and things like that. Teaching broader art concepts is sort of beyond the scale of a gaming art tutorial of this sort (and probably beyond any of our qualifications!), but teaching someone the basics of how to go about making a low-res background for use in AGS is probably the most productive. Just my two cents.

I think the art is beautiful, by the way. That's just the issue -- it's a great example of how someone with pre-existing artistic skills can create a beautiful background, but for the rest of us who don't have those it is a little opaque, mysterious, and ultimately depressing! ;-) I hope that doesn't come off as harsh, because it is not meant to be.
#47
Just as an aside, my path here was Yahtzee's videos --> Yahtzee's games --> AGS in general --> making my own game.

So even those who dislike Yahtzee (I've read up a bit on why), you can probably be comforted in the fact that some of the new attention he's been getting with these reviews may eventually lead people to AGS in general.
#48
I just want to jump in and note that there are two things I find a little confusing about Append():

1. I don't think most people are used to dealing with strings in particular in this OO style. Most high-level scripting languages (PHP, Javascript, Java) let you treat them as any old variable and concatenation is handled simply through operators (usually +, sometimes . -- whether this is really how they handle them, or is just a gloss put on to make them easier to handle, I don't know). Now I'm not complaining about the way AGS does things, as I am sure it is not arbitrary, but I understand why people (including myself) get confused at first. Once I figured out the .Append() thing, all of the rest of how to deal with strings made sense. I'm not sure if a big honking, "HEY, if you are used to concatenation by operators, READ THIS FIRST" warning would be appropriate, but it might be something for the FAQ? (Also, can I say how much I hate the word concatenation? Could computer programmers have come up with a less-familiar, more-scary name? It's almost as bad as HREF as a property for linking URLs. ;))

2. While the manual does try to be clear on this, it took me a few reads (after having it not work correctly) to really figure out what it was trying to say. I'm not 100% sure why this is, but apparently I wasn't alone in this. I suppose if I were going to re-write it, I would add a negative example too, like:

Quote
NOTE: The following will NOT work.
String mytext = "Hello";
mytext.Append("World");
Display(mytext);

The result displayed will ONLY be "Hello", because Append does NOT modify the String on which it is called -- it simply RETURNS a value. In order for that value to be added to the original string, it must be re-assigned as so:

mytext = mytext.Append("World");

Or something like that. Anyway, I know, I know, RTFM, but in this case I had the same confusion, mostly because I don't think I appreciated exactly that Strings are "special" here, that they are structs and not variables, which once you know is easy to make sense of, but it's not what I had in mind when going into it, due to experience in other scripting languages.
#49
Quote from: WackyWildCard on Mon 01/10/2007 02:56:26
:-\Hmmm...

How long did everyone take to learn Scripting? Curious I am.

Don't get me wrong, I have dabbled with scripting with my game construction. I even attempted to use Ahmet's RPG Scripting, but I became very frustrated with the results.

This is all I really want with my Adventure Game: I want the hero to walk around the rooms like a normal AGS Adventure Game, picking up items, using items, having conversations with people, solving puzzles.

Earning Wisdom and Honour Points like in A Tale Of Two Kingdoms. But also, being able do battle with monsters and to lose points. If all your life points are gone, the game switches to a room that says the hero is dead. Game Over. Start again or Load or Quit.

Or, if you win the battle you must have reduced the monster's life points to 0, or you can even stun it with sleeping dart.

That's all I can think of to say at the moment...


The nice thing about AGS's scripting is that it is fairly generic as far as syntax goes. That is, if you bother to learn AGS's approach to things, you actually will not have a hard time learning Javascript, PHP, and other high-level scripting languages (and conversely, if you already know said languages, learning AGS's scripting is super simple, as I can attest, having just started with it a week ago and already going along at great guns).

My recommendation, if you are totally new to scripting in general, is NOT to necessarily start with AGS. Do a few Javascript tutorials that you find on the web; get used to writing basic program flow (I started Javascript by writing a tic-tac-toe program), and once you have a little comfort in at least reading scripts under your belt, come back to AGS and take a look at how it does things. (Other than the fact that AGS is often more object oriented than Javascript, it has pretty much the same syntax.)

Scripting is not all as hard as it looks -- you are basically just charting out logical actions for the interpreter to follow or things for it to check. It's also a very marketable skill -- being an AGS scripter is not something that will be very impressing on the resume, but knowing how to use Javascript and PHP can easily make you a more exciting job candidate down the line.

Just my two cents! I don't script for a living but my ability to script (Javascript, PHP, VBScript, etc.) has helped me to get many a job, as it makes me much more capable than your average candidate in my non-computer science field of work (I am a historian by trade).
#50
You know, after I posted this I started playing around and I realized you COULD do it basically how I wanted, using a status-bar-like GUI at the top and a GUI with a list control on it that would steal focus (popup modal) and then use the arrow keys (and hitting left and right would cause it to move and repopulate with list options).

It's a bit more coding than I'm willing to do at this point in the project but it's definitely do-able. In the meantime I created just a little GUI with a listbox on it that pops up in the center of the screen with a few simple options on it when you hit Escape. Easy enough, it turns out. What a doofus I was for thinking that AGS couldn't be made to do this sort of thing!
#51
How would I go about creating a GUI for a menu that would be like the old-school AGI games (Police Quest, Gold Rush, King's Quest, etc.) whereby pressing Escape would trigger a menu at the top with menu options (in the case of Gold Rush, they were Sierra | File | Action | Special | Speed) and then the arrow keys left-to-right would trigger sub-menus (About Gold Rush! | Help, Save | Restore | Restart | Quit | Inventory | Elapsed Time, etc.), which could be cycled through by pressing the arrow keys up and down?

I feel like this is probably just something that AGS isn't really equipped to do (since the GUI is basically mouse-based), but I thought I would ask. My game doesn't use a mouse at all and suddenly having it come in for those sorts of operations is a bit weird. At the moment I'm just using the text parser for those sorts of commands ("Save game", "Restart game", etc.) and having a list of them displayed when you press ESC or F1, but I find this to be a bit silly.

Any thoughts or suggestions for a mouse-less menu-like GUI, or a mouse-less GUI for these sorts of "game" functions in general?
#52
.Append doesn't automatically change the String on which it is called; it just returns a String that you then have to feed back into the original if you want it to be changed.

Try:

NETEXT.Text = NETEXT.Text.Append("e");

(It took me a little while to figure this out too.)
#53
Quote from: KhrisMUC on Thu 11/10/2007 16:00:40
You can use a semi-transparent GUI as big as the screen with a black background.

Oooh... that's super clever and might just be exactly what I was looking for. Thanks.

UPDATE: I gave it a shot and this looks pretty good. Thanks for the suggestion.
#54
Quote from: theatrx on Thu 11/10/2007 06:02:57
There's a bunch of ways to do this.

1/  If the player character hits a hotspot or stands on a region... change rooms to a darkened version of the same room or

2/ You can tint the screen so there is very little light in the room

#2 seemed like something easier but I couldn't figure out how to tint things and make them darker. All of the color tinting functions seemed to make them lighter, from what I could tell. Any thoughts?
#55
Quote from: frission on Thu 11/10/2007 04:51:24
Quote from: Cluey on Wed 10/10/2007 23:50:29
-There's only one light in the hallway, it's meant to look very rundown so I assumed with the war and all they'd cut back on electricity. Anyone who knows more about World War 2 care to correct me?

They did ration electricity in Britain starting in 1942, but I'm not sure what apperance that would have. That is, it could have had a brown-out appearance as you imply, or it might have just been times of the day when the electricity was off. Now you've got me curious, frankly. I will check around...

I checked around and it seems most likely that the rationing was in the form of periodic black outs (no electricity for certain periods of the day), not brown outs (dimming). But I'm not sure you should feel limited by this, I doubt many people know for sure! You could always just claim the wiring in the building was damaged, if someone tried to nail you down for it! ;-)
#56
Quote from: MilkAndCheese on Wed 10/10/2007 07:35:50
4) The man is dead (you wake up to find him there). Yes now that I look at some doors I do realise how low down the handles actually are.

I think what he meant by that is that the scale is off. The man is super tiny -- if he stood up to full height he'd only be as tall as the file cabinet.

Scale can be an easy thing to miss. I drew some crates in my first room and realized that there was no way they could possibly fit through the door I had drawn! It's a good idea to figure out first what the size of your average person is going to be and then let that dictate the height of objects. Sometimes when thinking about scale I actually have to go stand next to comparable objects -- things like doors and windows are often bigger than you think they are.

The perspective is a bit odd. I would make the angles of the floor less steep than those on the ceiling. It will make the floor look flatter and the ceiling heigher, and avoid the foreground/background problem that the current one has (sometimes it looks to me like it is recessed, sometimes it feels like it is popping outwards).

My only other suggestion is that you might think about outlining things in colors other than straight black. Black lines give a very unnatural look to things, since almost nothing is really outlined in black. Usually outlining things in a somewhat darker hue than the original object is a good approach (the filing cabinet would be outlined in gray; the door in dark brown), as it implies an edge without making it seem absolute.
#57
Quote from: Cluey on Wed 10/10/2007 23:50:29
-There's only one light in the hallway, it's meant to look very rundown so I assumed with the war and all they'd cut back on electricity. Anyone who knows more about World War 2 care to correct me?

They did ration electricity in Britain starting in 1942, but I'm not sure what apperance that would have. That is, it could have had a brown-out appearance as you imply, or it might have just been times of the day when the electricity was off. Now you've got me curious, frankly. I will check around...
#58
Quote from: KhrisMUC on Thu 11/10/2007 04:02:16
readonly InventoryItem* InvWindow.ItemAtIndex[]
readonly int InvWindow.ItemCount

(readonly static int Game.InventoryItemCount)

Great! Thanks!

I don't have an inventory window anymore, so those particular ones don't help, but Game.InventoryItemCount simplifies the process of figuring out whether they have an item, and keeps me from having to hard-code the value.

Here's my quicky text-only inventory display script:

Code: ags

function show_inventory_window () {
	String inventoryListing = "You are carrying:";
	int i = 0;
	int inventoryCount = 0;
	while(i<Game.InventoryItemCount) {
		i++;
		if(player.InventoryQuantity[i]>0) {
			inventoryListing = inventoryListing.Append(String.Format("[ - %s",inventory[i].Name));
			inventoryCount++;
		}
	}
	if(inventoryCount>0) {
	  Display(inventoryListing);
	} else {
		Display("You're not carrying anything.");
	}
}


Of course, there's more to a text-only inventory than displaying it (I've just about finished writing a long function which processes any "look at X" where X is an inventory item and handles it separately than other things that are looked at, in this case it loads it up into a custom GUI that displays the image and a description), but it's coming along nicely.
#59
My game is not mouse driven and I would rather have an AGI-style text inventory (you hit tab and a little display box comes up enumerating all of the stuff you have). I plan to just cycle through the inventory, grab the names, and put them in a big string. (If they type in "look at [inv item]" then I'll display the sprite and a little description or something like that.)

Now it seemed natural to me that there would be some way to see what inventory a player had, but for all of my searching through the manual and on the forums I don't see an easy way to do it. The non-easy way would be to cycle through all possible inventory objects (and I imagine I'd have to hard-code a maximum array size to cycle through) and then use InventoryQuantity to see if the player had it. Surely there's a better way!?
#60
What's the best way to have the lights in the room "turn off"? I can imagine doing it a few ways but all of them seem rather hacky to me. How would you do it? I'm not experienced with animated backgrounds but that struck me as one possibility (have a frame that was the same room but with the lights off and switch to it when the switch was hit). Any and all suggestions would be appreciated! :-)
SMF spam blocked by CleanTalk