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

#61
Here is my final blocking-but-not-pausing Display replacement. Basically all it requires other than the code below is to create a GUI named gDisplay with a Label control on it named dLabel, and set the view mode to Normal (but make sure a gDisplay.Visible = false; is added in your game_start).

Any suggestions for improvements are welcome, but I'm pretty happy with this at the moment, and I'm super happy that I can change the font and margins with this replacement (the default font for Display() is very ugly, and the margins are way too close to the text IMO). Basically this is pretty much the same as Display() except rep_ex_always is allowed to continue, which in my case allows for some other animation (namely the typewriter effect I mentioned in another thread) to continue without pausing awkwardly. I imagine it could also be useful for things like repeated animations (e.g. fire) that you wanted to persist.

Note that in my case I have a pure text parser GUI (no mouse at all) that I am hiding here when the display window is open; if you were using a mouse control system I imagine you would do something else to indicate that input was "paused".

Code: ags
function dDisplay(String message) {
	gDisplay.Width = 250; //reset to max width
	dLabel.Width = 244; //reset to max width
	if(GetTextWidth(message, dLabel.Font) < dLabel.Width) { //shrink width if just a little bit of text
		int rMargin = (gDisplay.Width - dLabel.Width)/2; //make sure it has the same right hand margin as before
		dLabel.Width = GetTextWidth(message, dLabel.Font)+4; //new label width -- pad it a little because sometimes GetTextWidth comes up a few pixels short
		gDisplay.Width = dLabel.Width + rMargin; //set right margin of GUI
	}
	dLabel.Height = GetTextHeight(message,dLabel.Font,dLabel.Width); //resize height
	gDisplay.Height = dLabel.Height + (dLabel.Y*3);
	dLabel.Text = message; //set message
	gDisplay.Centre(); //center 
	gDisplay.Visible = true; //make this GUI visible
	gTextparser.Visible = false; //make parser invisible
	WaitKey(2400); //display for a minute, or wait until they hit a key
	gTextparser.Visible = true; //make parser GUI visible
	gDisplay.Visible = false;	 //make this GUI invisible
}
#62
Quote from: KhrisMUC on Thu 11/10/2007 00:31:26
What I meant by "putting stuff in rep_ex_always that'll un-pause the game" was "put code in there that will un-pause the game after a key press or mouse click".

I'm a little confused about what you mean here?
#63
OK! I was wrong on one point -- Wait() is NOT Pausing, it is JUST Blocking, despite the wording in the manual.

So what this means is that if I make my custom display function call WaitKey(big number here), it basically works like a non-pausing, just-blocking Display() except that it will expire after a certain amount of time. Which is fine.
#64
Quote from: SSH on Wed 10/10/2007 07:28:52
I think I put such a thing in my Hypertext module
OK, I'll check that out and see if it works with what I'm trying to do.

(Note that the other reason I hate Display() as it is is that it greedily seems to push itself to the front of any procedure flow. So if I tell a guy to walk to a spot, turn around, and then Display() a message about the location, he will walk, and then Display(), and then after they hit Enter he turns around. Arrggg. Of course I can add Wait(1) before each Display() but what a pain.)
#65
Quote from: KhrisMUC on Wed 10/10/2007 08:09:33
It should be possible by

-displaying the message
-pausing the game
-putting stuff in rep_ex_always that'll un-pause the game.

This doesn't work. Running Display() pauses the game; if I put an
Code: ags
if (IsGamePaused() == 1) UnPauseGame();
into repeately_execute_always, the message is simply never displayed (or vanishes before the screen even updates). :-/
#66
Though the manual says Display() is blocking, it seems that it actually is Pausing (it stops even repeatly_execute_always, for example, and will jump ahead in the event cue so that some actions immediately in front of it won't execute without a Wait(1) in place).

Since a non-pausing, just-blocking Display() seems like a rather big feature request (and since the last request for it I found on the forums was from 3 years ago, it doesn't seem very popular), I was trying to create my own little Display() GUI that wouldn't interfere with my repeatedly_execute_always() commands.

So far what I realize I'd like is a command that would wait for the user to hit a key (space, return, whatever) and then release program flow. But it would be blocking, not pausing â€" so things in repeatedly_execute_always() would still work.

I've searched through the manual but I didn't find anything, unfortunately. The Wait() commands seem to require time-out settings (though I could loop it, I guess), but they are pausing anyway, yes?

Any idea as to get this sort of functionality? It feels like it should be do-able, even if it is done in a semi-hacky way. Am I totally crazy? Have I gone off the deep end? :-)

Thanks a bunch guys, you've been really helpful...
#67
Advanced Technical Forum / Re: Typewriter GUI
Tue 09/10/2007 18:48:51
Just for the curious, here's the working version. With the Wait()s, it is super annoying (you can't do a thing until it finishes), but I'll work those out with Timer functions eventually...

Code: ags

function typeText(String TextToType) {
	gTypewriter.Y = 160;
	gTypewriterText.Text = " ";
	gTypewriter.Visible = true;	
	int i = TextToType.Length-1;
	int x = -1;
	Wait(10);
	while(x<i) {
		x++;
		gTypewriterText.Text = String.Format("%s%c",gTypewriterText.Text,TextToType.Chars[x]);
		Wait(8);
	}	
	Wait(10);
	int trans = gTypewriter.Transparency;
	while (trans < 100) {
		trans++;
		trans++;
		gTypewriter.Transparency = trans;
		Wait(1);
	}
	gTypewriter.Visible = false;
}
#68
Advanced Technical Forum / Re: Typewriter GUI
Tue 09/10/2007 18:41:19
Quote from: SSH on Tue 09/10/2007 18:39:21
Quote from: frission on Tue 09/10/2007 18:34:34
String.Format("%s%s",gTypewriterText.Text,TextToType.Chars
  • );
You want "%s%c" instead...

Ah, I see. I keep getting confused with the char type; I thought %c gave you the ASCII code for it and Chars gave you the string, but I've got it all backwards. Thanks. (It doesn't quite work yet, despite that, but it's not crashing anyway!)
#69
Advanced Technical Forum / Typewriter GUI
Tue 09/10/2007 18:34:34
I'm trying to make it so that whenever my character enters a new scene, overlayed upon the screen will be some sort of line (e.g. "Somewhere in L.A.") that will by typed out character by character and then fade away. Ideally this would not be totally blocking (sometimes I will want people to be walking across the screen as it is typing, for example).

I searched for Typewriting on the forums but all the other examples were in an earlier version of the language, I believe, and most were blocking, and from what I could tell none of them could be faded out.

At the moment I have started putting it together in the following fashion. I know that Wait() is not an ideal function here and I will eventually replace it with timers (one step at a time here!).

Code: ags

function typeText(String TextToType) {
	gTypewriter.Y = 100;
	gTypewriterText.Text = " ";
	gTypewriter.Transparency = 0;
	gTypewriter.Visible = true;	
	int i = TextToType.Length-1;
	int x = 0;
	while(x<i) {
		x++;
		gTypewriterText.Text = String.Format("%s%s",gTypewriterText.Text,TextToType.Chars[x]);
		Wait(1);
	}	
	int trans = gTypewriter.Transparency;
	while (trans < 100) {
		trans++;
		gTypewriter.Transparency = trans;
		Wait(1);
	gTypewriter.Visible = false;
	}
}


Where gTypewriter is a GUI with no background color or border, and gTypewriterText is a label on that GUI.

Now the above looks to me like it ought to work in some fashion, and compiles fine, but unfortunately I just get an awful, awful error message when I try to run it.

Quote
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0047AA75 ; program pointer is +6, ACI version 2.72.920, gtags (5,0)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

in Room 1 script (line 81)
from Room 1 script (line 98)


Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OK   
---------------------------

Line 81 in the room script is the one with the String.Format on it. I'm only using that String.Format because I'm having trouble concactenating the text otherwise (it doesn't like me mixing string and char types, apparently).

Any thoughts/suggestions?
#70
Quote from: monkey_05_06 on Tue 09/10/2007 17:23:12
AGS 2.72 and earlier it uses the Interaction Editor. Open the room, click on the 'i' button, and you'll see "Player enters room (after fadein)". You can use the Interaction Editor to add simple interactions, or you can use a "Run script" action to automatically generate a function (that will probably be something like "room_a()") to allow you to edit the script.

OK, I think this is what I was looking for. Thanks!

Quote from: KhrisMUC on Tue 09/10/2007 17:22:18
My only conclusion from that sentence is that you've never used a single RunScript-action before. But from the rest of the script I understand that you're familiar with scripting.
I'm confused :=
Thanks! I'm much more comfortable with scripting in general than the interface, as I think is probably clear here! :-) I'm still feeling my way around how they fit together.
#71
From what I can tellâ€"unless I am wrong on thisâ€"the only way you can manually specify the import resolution (i.e. the "Import at 640X480" checkbox) for sprites is when you import them individually. When you try to import multiple sprites or import from an animated GIF, it assumes that you want to import them at 640X480.

I need to import things at 320X240, and as a consequence am having to export all frames as single files from Photoshop and then re-import them one by one -- what a pain! It'd be nice if I got a little checkbox like that on ALL sprite importing options.

(For those who care, my game is actually set to run at 640X480 but it's really a 320X240 game. I run Windows in an emulator that doesn't support 320X240 resolution, so I have to double it and have it automatically scale things up. If I mistakenly import at 640X480 then I get tiny sprites. Boo hoo, what a sob story, I know, but anyway, it'd be nice if that option was just made universally click-able.)
#72
I just wanted to add that after further testing, the problem appears to be only intermittent â€" a lot of the time it exits just fine. Even when it doesn't it is easy to terminate the process manually.

Again, I don't expect this to be high priorityâ€"who knows what the heck is going on here since it is running in an OS emulatorâ€"but just thought it should be on the record in case anyone else experiences and wants to know if they are totally alone in their struggles! :-)
#73
You could also, for debugging purposes, have it tell you which loop the dragon was facing. If it isn't triggering for ==1 or ==2, it might be set up so that facing right is on a different loop number. You could have an }else if{ in there which would tell you what loop the dragon was on if it wasn't 1 or 2.
#74
Throughout the manual I see references to being able to call an event for when the player enters room, after fade-in, but I don't see how to do it. I see the on_event function only has a setting for calling an event BEFORE the fade-in. I can see how to set up an interaction for it, but I'd rather do this in the script itself (I need it to reference a few variables and be something I can easily change along with the rest of hte script).

From using the search feature on here I see some people with code that looks auto-generated by AGS (with #sectionstart headers) for this purpose, but I don't see how to get mine to do that. Is this a bug in the current version of AGS? (I only wonder since apparently another aspect of it didn't generate the appropriate code block when I asked a previous question of this nature)

Thanks again! Things are going along quite nicely on the whole with this project.
#75
Thanks! Glad to know I wasn't totally crazy in not being able to find this anywhere. :-)
#76
That fixed it, thanks. I figured it was probably asking for a pointer to the GUI (so it would know what in particular had called it) but I wasn't at all sure how to give that.

Is there a way I would know to do that? Just for future reference.
#77
I'm trying to make a Sierra-style text parser GUI. I've set up a GUI with the appropriate controls on it, and I think I've basically got it to work, except that the function called based on the Activate property of the Text Box control seems to be expecting a variable to be passed. Basically the game crashes and says that it expected 0 variables but instead got 1.

I couldn't find any documentation on the Activate function in the documentation. The documentation tells me how to use the parser once I've gotten some text inputted, but the description of how I get to that point is a little sketchy. Could someone help me out?
#78
So.... any sign on being able to see this? I'm just interested in seeing a good demo game while trying to work on mine and from the thread it sounds like this is pretty neato, but unfortunately has vanished into the ether... Anyone who have it want to host it somewhere? Pleeease?
#79
I don' t think this is my fault, but I am new at this, so it might be.

Basically I am running the AGS editor on a MacBook by running it in the Parallels environment in Coherence mode with Windows XP installed. The editor itself works fine. Testing the game itself works fine, except that when I exit it, it doesn't actually terminate the process (mygame.exe or whatever I have called it). The editor still displays [Running] in its menu bar even though there is no active, selectable process available to Windows, though the .exe shows up in the Task manager when I Ctrl-Alt-Delete. If I force it to quit, it gives me a little message about how it didn't shut down properly and I should report it here, and then the AGS editor registers it as having closed.

Anyway, it is not impossible (I can quit it via Task manager) but I thought someone might like to know. The game itself at this point is nothing but a single room and a few sprites, and absolutely no custom scripting or anything like that, so I find it unlikely that I somehow made it do this, but again this is my first time really playing around with AGS so it's entirely possible that I'm causing it to do this one way or another. I'll play around with it a little bit and see if other settings do the same thing (i.e. if I run it in OS Mode or Full Screen Mode). I'm also aware that the total number of people trying to make games in AGS running Windows XP on a MacBook is probably pretty slim, so I doubt this is very high priority.
#80
Ghost, Rayberg â€" awesome replies. Those sites you mentioned Ghost were VERY interesting and VERY helpful. Rayberg, your tips were excellent. All together after thinking about it some more I think I realize much better what I want to do and the specific hurdles that lie in waiting for me. (I'm also dubious now that AGS qua AGS is going to by itself really do what I want it to, but that's another story.)

Any further sites and thoughts are of course welcome!
SMF spam blocked by CleanTalk