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

#1
Ah, of course! Thank you again, it works now. I guess I need to pay more attention to placement when I come across a problem.

I'm learning a lot as I go along  :)
#2
I need a little help getting part of this script to work. Here's some info that may or may not be more than needed... if so just skip to The Problem toward the bottom of my post.

The GUI:
I have a particular GUI that only shows up in one room, since it's a New/Load/Delete Game type of thing. So, the GUI automatically appears upon entering that room, and doesn't appear anywhere else.

The Buttons:
Not all the buttons are initially visible.
At first, all you see is 3 buttons that represent the 3 different save slots (whose graphics vary depending on if the slot is used or empty), a DELETE button (for deleting previously saved files), a QUIT button, and finally a button at the top (that doesn't actually do anything, but it's image graphic tells the player what to do).

The buttons not initially visible are 3 buttons that determine which save slot to delete, an OK button (which confirms the deletion), and a different QUIT button (which cancels the deletion & takes you back to the main selections).

What I'm trying to achieve:
When you click on the DELETE button, the 3 "New/Load" buttons + the "Delete" button + the "Quit" button all go invisible. At the same time, the "does nothing" button at the top gets its normal graphic changed and is repositioned. Also, the 3 "Delete this Slot" buttons become visible.

Now the player can click one of the 3 "Delete this Slot" buttons. Then they go invisible, the top "does nothing" button changes its normal graphic again, and the "OK" + "Quit/Cancel" buttons appear.

Then the player can click OK to delete that file, or QUIT to return to the original selections (New/Loadx3 + Erase + Quit).

All the buttons (except the "does nothing" button at the top) are supposed to animate on mouse-over.

------------------------------------------

This is the code I have in my Global Script concerning this GUI's "Erase" button:

Code: ags
// STARTUP GUI - Erase File (Erase Button)
function btnEraseSave_OnClick(GUIControl *control, MouseButton button)
{
  btnSaveSlot1.Visible = false;
  btnSaveSlot2.Visible = false;
  btnSaveSlot3.Visible = false;
  btnEraseSave.Visible = false;
  btnCancelSave.Visible = false;
  btnChooseFile.NormalGraphic = 81;
  btnChooseFile.SetPosition(50, 0);
}


This is the code I have in the Room Script:

At the top of the room's script:
Code: ags
bool File1Animating;
bool File2Animating;
bool File3Animating;


In the room's RepExec function:
Code: ags
  // Show FILE selection if ERASE is clicked on
  if (btnChooseFile.NormalGraphic == 81) {
    btnFile1.Visible = true;
    btnFile2.Visible = true;
    btnFile3.Visible = true;
  }
  else {
      btnFile1.Visible = false;
      btnFile2.Visible = false;
      btnFile3.Visible = false;
  }
  // File 1 ANIMATION
  if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == btnFile1) {
    if(File1Animating == false) {
      btnFile1.Animate(8, 0, 5, eRepeat);
      File1Animating = true;
    }
    else {
      btnFile1.NormalGraphic = 85;
      File1Animating = false;
    }
  }
  // File 2 ANIMATION
  if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == btnFile2) {
    if(File2Animating == false) {
      btnFile2.Animate(12, 0, 5, eRepeat);
      File2Animating = true;
    }
    else {
      btnFile2.NormalGraphic = 130;
      File2Animating = false;
    }
  }
  // File 3 ANIMATION
  if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == btnFile3) {
    if(File3Animating == false) {
      btnFile3.Animate(13, 0, 5, eRepeat);
      File3Animating = true;
    }
    else {
      btnFile3.NormalGraphic = 141;
      File3Animating = false;
    }
  }


That's supposed to check if the "does nothing" button has a certain graphic (a "Delete which file?" image) then the 3 "Delete this file" buttons are shown (File 1, File 2, File 3).

------------------------------------------

The Problem
The 3 buttons that appear to allow the player to select which slots to delete DO appear as they should, BUT they won't animate correctly on mouse-over. They flicker. I think I've read somewhere about people experiencing this animation flicker, but I'm not sure how to fix my script specifically. Do I need to move some code around? Is it because some of the GUI's script is only in the room script, and some is in the global script? Because I wasn't really sure what should go where, since this GUI will only be appearing in this one room. Or perhaps it has something to do with the RepExec?

Any suggestions would be appreciated. Thank you!
#3
Beginners' Technical Questions / Oopsie.
Mon 13/07/2009 07:57:56
Ah yes that worked! I always forget one little thing or another. Thank you very much!  :)
#4
I feel like I'm doing something very stupid, like making a spelling error, but I've gone over this and I can't figure out why it's not working. Perhaps a fresh pair of eyes will help?

The player is taken to room 2 from room 1. The player's character isn't shown because this is a start up menu type of thing. After fade in, an object should appear and animate continuously in the background while a GUI (with no background image or border, just buttons!) shows some buttons you can click on to do some stuff.

Here's my code:

Code: ags
// room script file


function room_AfterFadeIn() {
  oNewLoadBG.Visible = true;
  oNewLoadBG.SetView(5, 0, 0);
  oNewLoadBG.Animate(0, 5, eRepeat, eNoBlock);
  gStartUp.Visible = true;
  gStartUp.BackgroundGraphic = 0;
  }


FYI - oNewLoadBG is the name of my object I want to show and animate. It is actually the same size as my background. I want it to ACT AS my background since I can have more animating frames with an object than I can with the actual background.

I want this object to animate while the GUI is up. The only thing visible on the GUI should be the buttons, so the whole thing should appear as a pretty animating background scene with some buttons laying on top.

THE PROBLEM

Nothing inside the function works. It won't even make the object visible, let alone animate. Am I missing something in my code? Is there something elsewhere in my game that could be blocking everything in this function? Any suggestions on what to be aware of that might interfere with it would be very helpful.
#5
Beginners' Technical Questions / Solved
Wed 10/06/2009 21:41:55
YES! That worked! I put in the eNoBlock and that did it. That you all so much!  ;D
#6
Quote from: Trent RI'm thinking that your Wait(4) for 120 loops may be blocking the keypresses. Try adding this to your room:

Code: ags
function repeatedly_execute_always() {  //the always means that this runs even during blocking events
  if (IsKeyPressed(eKeyReturn)) {
    player.ChangeRoom (2, 130, 120);
  }
}



Not sure, but try it.

That gives me the error saying I can't use the change room command within non-blocking events such as the repeatedly_execute_always one.

Quote from: GuyAwesomeVera:
OK, I think I see now. If the pan is allowed to play out normally the player has to press Enter to continue, but if they skip it you also want to skip that extra step...

Sort of. I want the player to have two options:

(A)  To watch the cutscene, waiting until the two objects are shown. THEN press enter once they are shown, moving the player to room 2.

(B)  To skip the cutscene by pressing escape. THEN, since the two objects are now showing, press enter, moving the player to room 2.

Quote from: GuyAwesomeHow about

Code: ags
function room_AfterFadeIn()
{
  StartCutscene(eSkipESCOnly);
  ypos = 0;
  while (ypos < 120) {
    SetViewport(0, ypos);
    Wait(4);
    ypos = ypos +1;
  }
  if (Game.SkippingCutscene) 
    player.ChangeRoom (2, 130, 120);
  EndCutscene();
  oTitle.Visible = true;
  oPressEnter.Visible = true;
  object[1].SetView(3);
  object[1].Animate(0,  3, eRepeat);
}

I tested that, but pressing enter did nothing. It just scrolled down and the objects appeared, as usual, without allowing me to continue to room 2 by pressing enter.
#7
GuyAwesome: Ah ok, allow me to explain myself a little better.

This will be my Intro/Title room. I have a tall image so that it will scroll. Here is a shot of what it looks like at the very beginning after the room fades in:



Right away, it should begin to scroll downward slowly, as the big red arrow shows, until it reaches a certain point around the treetops below (the bottom of the image).

(During the scroll I would like to eventually add music, but I'll save that for another day.) Here is the image of the point when it stops scrolling:



After a moment, it should display two objects that have so far been hidden. These objects are (1) the image of the game title, and (2) the image of the words "Press Enter" showing the player that they need to hit enter in order to continue to whatever the next room is (eventually the next room will be a newgame/loadgame type thing but I haven't gotten that far yet). Here is that shot:



As you can see in my code posted earlier, I also have the PressEnter object set to animate continuously after it appears.

Now, the actual skippable cutscene should begin after the room fades in, and end at the shot above (screenshot #3). So, if the player skips at anytime after fade-in during the cutscene, it should jump to the shot showing the Title and the Press Enter images (screenshot #3). Then the player can hit enter to continue to this room here:



I wanted it set up this way so it can be like:

ohh pretty landscape view, tra-la-la, and now for the title bum-bum bum, TA-DA!

But if the player has seen all of this before, they can skip it and then hit enter to get on with loading/starting his game (room 2).

-----------------------

I hope this helps to explain my goals a little better; I'm still having trouble getting it to work. Thanks again :)
#8
Ok I tested everyone's suggestions, and here are my results:

Putting in Display("%d", keycode); didn't change anything or display anything new. You are all right, it was because of the cutscene interfering. So as a test, I cut out the cutscene, changing my code to this:

Code: ags
// room script file

  
function room_AfterFadeIn() {
  int ypos = 0;
  }

function on_key_press(eKeyCode keycode) {
  if (keycode == eKeyReturn) {
    player.ChangeRoom (2, 130, 120);
    ClaimEvent();
  }
}


That worked. Pressing ENTER took me to room 2. But I wanted all that other stuff that I had inside my cutscene to occur. So I tried putting it all back minus just the startcutscene/endcutscene/esconly bits:

Code: ags
// room script file

  
function room_AfterFadeIn() {
  int ypos = 0;
  while (ypos < 120) {
    SetViewport(0, ypos);
    Wait(4);
    ypos = ypos +1;
  }
  oTitle.Visible = true;
  oPressEnter.Visible = true;
  object[1].SetView(3);
  object[1].Animate(0,  3, eRepeat);
}

function on_key_press(eKeyCode keycode) {
  if (keycode == eKeyReturn) {
    player.ChangeRoom (2, 130, 120);
    ClaimEvent();
  }
}


This did not work. It made the first part work (it scrolls and everything) but pressing ENTER again did nothing.

So do I need to just research Global Variables like in the link GuyAwesome provided, or am I missing something else as well?

Thank you everyone for your responses! It's so close to working!  :)
#9
Beginners' Technical Questions / Almost there
Tue 09/06/2009 20:31:43
Ah, thank you both. That is much easier to read! The script will run now without errors, however, when I press ENTER to make it take me to the next room, nothing happens. I know I have the right room number (2) because, well... I only have the two rooms!

Is there something else I'm missing...?
#10
I'm having trouble getting one part of my script to run.

This first room is just my title screen room. It scrolls and such like I want it, that part works fine. However, after the initial cutscene ends, I want the player to have to press ENTER in order to continue to the next room where gameplay actually begins and they can control the character and such.

So I believe I need to use the on_key_press function within this room. Unfortunately, since I'm new to this, I seem to be messing up bracket placements and such.  When I try to test the room, I get an error around line 21, which is where the on_key_press function is.

Here's my full script for this room:

Code: ags
// room script file

  
function room_AfterFadeIn()
{
StartCutscene(eSkipESCOnly);
  int ypos = 0;
while (ypos < 120) {
  SetViewport(0, ypos);
  Wait(4);
  ypos = ypos +1;
}
{
EndCutscene();
oTitle.Visible = true;
oPressEnter.Visible = true;
object[1].SetView(3);
object[1].Animate(0,  3, eRepeat);
}

function on_key_press(eKeyCode keycode)
{
  if (keycode == eKeyReturn)
  {
    player.ChangeRoom (2, 130, 120);
    ClaimEvent();
  }
}
}


As I said, the first part of the script works fine; the issue I'm having is with the on_key_press function not running. If anyone can spot my error, it would be a great help.

Thank you.
#11
Beginners' Technical Questions / Lovely
Tue 13/01/2009 05:59:01
Ahh! I changed the character's starting position, and it works fine now!

I didn't realize there was even a character made, but I guess it's the default.

Thanks, everyone!
#12
So I registered today just to ask about this. I've searched all over the forums and the manual and everywhere I can think of for the past couple days, and I can't figure this out.

I have a 320x240 game. I imported a 320x343 background. As of right now I have no characters yet, and for this room (my Intro/Title Screen room) I have ShowPlayerCharacter set to False.

Here's what I'm trying to achieve:

I want the game to fade in, showing the top portion of the background.

After a sec, the background begins to slowly scroll down. (A plus would be if I could adjust this speed to my liking)

Then, after a moment, my Title Image appears.
(Oh, and I also threw in a cutscene script so I can just skip to the Title Image)

The script I have currently:

Code: ags
// room script file

function room_AfterFadeIn()
{
StartCutscene(eSkipESCOnly);
int ypos = 0;
while (ypos < 120) {
  SetViewport(0, ypos);
  Wait(4);
  ypos = ypos +1;
}
{
EndCutscene();
oTitle.Visible = true;
}
}


My problem with this script:

What it's doing is showing the 320x240 view somewhere in the middle of my background for just a moment, then it jumps up to the top of the background and starts scrolling down. This jump is driving me nuts. It looks bad. I need it to just start at the top, not the middle.

How I tried fixing it

A.)   If I change this part...

Code: ags
int ypos = 0;


...to this:

Code: ags
int ypos = 40;


Then the jump no longer occurs. However, it also stops scrolling from the very top. It just starts the scroll down further, not showing the top part of my BG at all. No good!

B.)   I thought it might have something to do with the room's edges. BottomEdgeY, TopEdgeY... I messed around with those and it did nothing. After researching, I guess this only has to do with the character. No good!

Conclusion:

So I guess what I need is a way to set the view of the room to the top when it loads, instead of the middle, so that when it begins the scroll downward, it doesn't show the middle, jump up top, then scroll down. I'm sure I'm missing something obvious and silly, but if anyone could help with this part of my script or at least point me in the right direction, it would help greatly.

Thanks!
SMF spam blocked by CleanTalk