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

#1
I'll try the tick counter thing if none of the other options work for me.

I'm animating it because the mouseover image is exactly that - just an image, where I want it to cycle through multiple frames. Didn't let me pick a view, only a sprite ... I'll check out the Button Animate thing and see if that does what I'm looking for. If not, I'll do the ticks instead. Thanks, guys!
#2
Hello ladies and gents! I have a question, but first I'll explain what results I'm after:

I want a button to loop through a series of graphics as long as the mouse is hovered over it.

My current bit of code looks like this:
Code: ags

function animatemenu()
{
  btnMenu.NormalGraphic = 15;
  Wait(7);
  btnMenu.NormalGraphic = 13;
  Wait(7);
  btnMenu.NormalGraphic = 11;
  Wait(7);
  }
}

function repeatedly_execute() 
{
  //Animate Menu Button
GUIControl*button=GUIControl.GetAtScreenXY(mouse.x,mouse.y);
if (button==btnMenu) {
animatemenu();}
}


So - this is functioning, it's looping the graphics exactly as I want. Couple problems with it, though:

It's causing the mouse cursor to vanish when hovering. It appears again very very briefly when the cycle completes. This is causing the mouse cursor to flicker in time with the cycles, with isn't very aesthetic, but isn't a huge problem...

... the main issue is that the mouse also can't click the button. Clicking doesn't do anything (worth noting that I've checked that, without this function, clicking works just fine).

I've tried adding a mouse.IsButtonDown(eMouseLeft) as a condition but that didn't work. I'm probably going about this in an inefficient manner - is there a better way of getting this result without making the mouse disappear/unable to click?

Thanks folks!
#3
I was happily playtesting my game when it crashed, and since then, starting a playtest causes my game to open and then immediately close with the popup "The game engine does not appear to have shut down properly. If the problem persists, please post about it on the forum." Before posting, I did a quick Google on the issue, and found a thread where someone asked if it worked in a standalone exe. So I figured why not try that before I post...

..and got the following output:

Unable to register for Windows Game Explorer: Unable to replace resource: EndUpdateResource for __GDF_XML failed: 0000006E

Restarting AGS doesn't fix it.

EDIT: Trying to build an EXE again yielded a couple additional errors this time:

Unable to set EXE name/description: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Unexpected error: The process cannot access the file 'C:\Users\Kyle\Documents\0effinzombies\Latest Game Version\AGSTestingGame\Compiled\Windows\AGSTestingGame.exe' because it is being used by another process.

EDIT AGAIN: Worth mentioning, I'm using 3.4.1
#4
THAT was it - the number in the WaitMouseKey call was too large! Changing that fixed it all.

Thank you, Snarky - it's working as I hoped. Got some prettifying to do with the UI (need to add a background image for the labels, basically just a text box graphic) but I can just tuck another button behind the labels and that should do the trick.

You guys rock!
#5
I actually did change the WaitMouseKey call, to a fairly large number precisely to avoid that happening.

The labels are on the same GUI as the portraits, yup. They're appearing, with the text "new label" on them. The actual speech string isn't being written. Sorry, could have been a bit clearer with that explanation.

EDIT: Hmm. Crimson, would it be possible for you to share the scripts you used where it worked immediately, so I can compare to mine and see if I might have messed something up somewhere in there?

I just got it a bit closer to working - I put the Display command below the speech lines instead of above it and they printed on the labels as expected. So I just need to figure out why the UI isn't appearing when there's no Display command in there... and, after having fixed the actual UI box to be transparent, I gotta figure out why my portraits have a fuzzy grey box over them, but I figure I've just messed up something in importing them or in setting up the button.
#6
Yeah, I only have the one dialogue, which is called dDialog1, and here's the code I'm using to start it:

Code: ags
function cSylvie_AnyClick()
{
  Display("Sylvie click is working!");
dDialog1.StartVN(player, cSylvie);
}


The GUI has "Normal, initially off".

Here's a weird thing, though. I just went in and added a display line to the dialogue:

Code: ags
// Dialog script file
@S  // Dialog startup entry point
 Display("Dialogue is working");
 cSylvie.SayVN("Hello, player.");
 player.SayVN("Hello, Sylvie.");
 EndVN();
stop


And that sort of worked. Clicking the character created a the "clicking this character is working" display, and clicking again then actually created the GUI as expected, with the right portraits! It also had the display string "Dialogue is working".

So I removed both Display lines, and then it didn't work again. So I put the one back in the dialog, and it worked again, this time (because the "clicking this character is working" display was still gone) it worked to show the GUI properly on one click.

Soooo it's initializing the dialog properly, but not actually displaying the GUI unless the Display message is in the dialog script.

Also, the actual strings for the name and text "hello player" etc. is not displaying on the labels. The portraits are working, though, so progress!!

EDIT: How do I get the actual GUI window to be invisible/transparent? Like I just want the buttons and labels to show up, but not the big grey box they're on top of. Setting it to 100% transparency makes the buttons/labels also transparent.
#7
Huh, yep, that was set to "True" for some reason. Hah.

Right, so, I've fixed it up now, changed around some views and whatnot so that the normal view is an empty frame (I don't want the main character to actually appear outside of dialogue scenes) but the speech view is the portrait image, aaaaand I changed the code back to speech view.

Now, when I click, it prints the Display text but doesn't do anything else. No errors now, though! It just doesn't actually seem to be running StartVN().
#8
Okay, that fixed the "not reacting to clicks" problem - which shed light on the next round of problems hahaha... :embarrassed:

One weird thing and one broken thing.

The broken thing: clicking the character gives me an error "AGS had a problem running your game" etc., with the error "GetGameParameter: invalid frame specified" at the following line:

Code: ags
void StartVN(this Dialog*, Character *left, Character *right)
{
    // set the buttons to have first frame of the character's speech view
    // ofcourse you may use different logic, for instance, get character's images from Custom Properties, or other variables
    ViewFrame *vf = Game.GetViewFrame(left.NormalView, 0, 0); //<----------- this line
    btnVNLeftPortrait.NormalGraphic = vf.Graphic;
    vf = Game.GetViewFrame(right.NormalView, 0, 0);
    btnVNRightPortrait.NormalGraphic = vf.Graphic;
    gVisualNovelScreen.Visible = true;
    // add anything else you need to setup
    this.Start();
}


And the weird thing... in both the character and the object, the following line works...but prints the text backwards:

Code: ags
Display("Sylvie click is working!");


I don't think that's meant to be backwards, is it? It's printing as "!gnikrow si kcilc eivlyS"
#9
The display message didn't work either, which makes me think I messed something up in connecting them. They are connected, though - on the character's events panel, any click has that function associated with it.

I assigned the same view to all the different view types, just in case, because at least so far in this stage, we aren't going to be using animated speech frames (that'll come later).

Edit: I just created an object and stuck it in the room with the same function assigned to it and it didn't work either. So I'm really thinking I just missed something in the configuration somewhere...
#10
Okay - we no longer have errors happening! Yay! Thanks guys.

That said, it's not actually working. I just stuck a character onto the screen, with the idea that when clicked, the dialogue opens between the player and her. Here's the code:

Code: ags
function cSylvie_AnyClick()
{
dDialog1.StartVN(player, cSylvie);
}


The code for the actual new functions:

Code: ags
void StartVN(this Dialog*, Character *left, Character *right)
{
    // set the buttons to have first frame of the character's speech view
    // ofcourse you may use different logic, for instance, get character's images from Custom Properties, or other variables
    ViewFrame *vf = Game.GetViewFrame(left.NormalView, 0, 0);
    btnVNLeftPortrait.NormalGraphic = vf.Graphic;
    vf = Game.GetViewFrame(right.NormalView, 0, 0);
    btnVNRightPortrait.NormalGraphic = vf.Graphic;
    gVisualNovelScreen.Visible = true;
    // add anything else you need to setup
    this.Start();
}

void SayVN(this Character *, String text)
{
    lblVNName.Text = this.Name;
    lblVNSpeech.Text = text;
    WaitMouseKey(0);
}

void EndVN()
{
   gVisualNovelScreen.Visible = false;
   // add anything else you need to cleanup
}


And the header code:

Code: ags
import void StartVN(this Dialog*, Character *left, Character *right);
import void SayVN(this Character *, String text);
import void EndVN();


And, in case it's relevant, the actual dialogue script:

Code: ags
// Dialog script file
@S  // Dialog startup entry point

 cSylvie.SayVN("Hello, player.");
 player.SayVN("Hello, Sylvie.");
 EndVN();
stop


The game runs just fine, Sylvie is hanging out in the middle of the screen where I put her, but clicking her doesn't do anything. Have I missed out on something?

Incidentally this is all being done in a blank project, so perhaps I missed adding in a necessary component or something. Both player and Sylvie have sprites and views defined for them.
#11
Hmm. WaitMouseKey(); gives me an error "Not enough parameters in call to function", which I'm assuming means it's missing a parameter. The only thing I see under the WaitMouseKey function in the manual is a time measure, though... so if I put 0 as a parameter, I would assume it will just continue immediately. I'd test it out, but I cannot for the life of me get the "convert string to string" error to stop appearing. It appears even if I create an entirely new dialog. Any suggestions for how to fix it?
#12
Thank you! I feel like I'm almost there with this, but now in the dialogue script I'm getting this error when compiling:

Code: ags
Dialog 0(4): Error (line 4): Type mismatch: cannot convert 'string' to 'string'


Here's the dialogue script:

Code: ags
// Dialog script file
@S  // Dialog startup entry point

 cSylvie.SayVN("Hello, player.");
 WaitMouseKey;
 player.SayVN("Hello, Sylvie.");
 WaitMouseKey;
 
 EndVN();
stop


This is confusing me 'cause it looks like it's trying to convert a string to a string...which makes no sense?
#13
Okay, so I'm playing around with this, and have run into a problem. It's throwing an error when I try to compile the script, saying "cannot convert 'ViewFrame' to 'int'" at these lines:

Code: ags
    btnVNLeftPortrait.NormalGraphic = Game.GetViewFrame(left.SpeechView, 0, 0);
    btnVNRightPortrait.NormalGraphic = Game.GetViewFrame(right.SpeechView, 0, 0);


so it's trying to resolve the GetViewFrame to an integer, but I don't see why that wouldn't work. I've tried it with left.NormalView instead as well and it did the same thing. Not sure what's up with it...
#14
Actually, I do have a question. I'm trying to put together the GUI for the VN busts. Here's what I've done so far:

- Created a GUI called gVisualNovelScreen at full game resolution (720p if that matters)
- Created a button on the left called btnVNLeftPortrait, and on the right called btnVNRightPortrait

- added the following to my GlobalScript.asc:
Code: ags
void SayVN(this Character *c, string text)
{
    lblVNName.Text = c.Name;
    lblVNSpeech.Text = text;
}

void StartVN(this Dialog*, Character *left, Character *right)
{
    // set the buttons to have first frame of the character's speech view
    // ofcourse you may use different logic, for instance, get character's images from Custom Properties, or other variables
    btnVNLeftPortrait.NormalGraphic = Game.GetViewFrame(left.SpeechView, 0, 0);
    btnVNRightPortrait.NormalGraphic = Game.GetViewFrame(right.SpeechView, 0, 0);
    gVisualNovelScreen.Visible = true;
    // add anything else you need to setup
    this.Start();
}

void EndVN()
{
   gVisualNovelScreen.Visible = false;
   // add anything else you need to cleanup
}


- Added the following to my GlobalScript.ash:

Code: ags
import void StartVN(this Dialog*, Character *left, Character *right);
import void SayVN(this Character *c, string text);


What I'm unsure about is how to set up the characters as the button images.

Once I get that done, though, then within the dialogue, it should look something like this, right?

Code: ags
dPlayerSpeaksWithNPC1.StartVN();
 player.SayVN("Hello world.");


Assuming I've sort of understood how this works, how would I swap a button's image in mid-dialogue (like a character changing expression/pose/whatever mid-conversation)

Aaaalso, and I realize I may be getting a tad ahead here, but - will the dialogue created by this function persist until the player clicks? If not, how do I get it to do that?
#15
Yeah, it seems pretty flexible if you think a bit outside the box. Once I get my head around how the thing works, like how global and room scripts interact and where best to place stuff, I'll be able to manage everything I want to do, I think.

Basically a semi-open VN/adventure in which the player can navigate around the city via a map and clicking locations, and interact with characters at these locations. Their locations will depend on the day of the week and time of day (which I assume I'll be able to set via variables and increment at the end of an event). It occurs to me that I'll have to actually move the characters around... dynamically determining their location based on the variables "weekday" and "time of day"... I suppose I'll need a function that moves each character to their respective spot based on the variables, and when I have an interaction that would change the time of day, I'll need to  run that function (likewise when the player "sleeps").

Pretty sure I'll be able to figure it out... though if you have any ideas/tips/things to avoid when doing something like that, feel free to share lol
#16
Thank you very much! Yeah, I'm working my way through the manual steadily. Made this thread to see if I could determine whether the functionality we're looking for was actually possible, 'cause AGS has about 80% of what we need that is very obvious. VN busts and dialogue stuff were the main things I didn't readily see, and a way to display full-screen animations (i.e. basically full-screen cutscenes) but I'm figuring I'll manage a way to do that somehow, even if it's making a fullscreen "object" that is invisible until called, with the frames done as a view, or something I dunno, just spitballing. There'll be a way for sure though.

Really appreciate the help!!
#17
Thanks, man, I really appreciate the help. Final question (for now, inevitably there will be more ahaha):

Where do the first bits of code go? These ones:

Code: ags
void SayVN(this Character *c, string text)
{
    lblVNName.Text = c.Name;
    lblVNSpeech.Text = text;
}
 


And

Code: ags
void StartVN(this Dialog*, Character *left, Character *right)
{
    // set the buttons to have first frame of the character's speech view
    // ofcourse you may use different logic, for instance, get character's images from Custom Properties, or other variables
    btnVNLeftPortrait.NormalGraphic = Game.GetViewFrame(left.SpeechView, 0, 0);
    btnVNRightPortrait.NormalGraphic = Game.GetViewFrame(right.SpeechView, 0, 0);
    gVisualNovelScreen.Visible = true;
    // add anything else you need to setup
    this.Start();
}


I'm assuming they need to be plugged in somewhere in one of the scripts, but I'm not sure where. How exactly would I go about actually adding these to my game?

Sorry for being a total noob lol
#18
This sounds pretty much exactly like what I'm going for. Thanks! I have no idea how to implement those snippets, though - I haven't yet delved much into GUI functionality.

Incidentally, any tips on getting a VN-style dialogue box? So far I've got the lucasarts and sierra styles (let's not mention Whole Screen...) and neither of those do the trick. Just a text box down the bottom, ideally with a nameplate box or something to the top left of it for a character name (though that could just be done within the text itself, it'd be a lot more convenient to have it baked in).
#19
I'm looking to implement Visual Novel style character busts during dialogue scenes. Basically, when the player interacts with a character in a room, it should display two images - one for the player's character bust and one for the other character's - overlaid with a dialogue box. Searching around hasn't yielded much in the way of this sort of thing, and I haven't spotted it in various resource/plugin/module pages. Any tips? Could this be accomplished using basic scripting? I haven't uncovered a function for something like this yet...
#20
Huh. So I was. I distinctly remember putting one there... ah well, thanks, I'm clearly fizzled for the night lol
SMF spam blocked by CleanTalk