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 - J.E.S.

#21
Thanks for the reply, I have to admit that I'm not the best at coding, especially when I'm trying to learn a new game engine, so I'm hesitant on putting any code anywhere else besides the room script. Anyways, I gave up on GUI.transparency when it had strange effects on my gui such as making my invisible buttons and labels look pixelated as the process was running. That glitch also happened when I was running in 32bit true color. Also when I tested it, I didn't like the fact that I had to wait until the function ended before I could do anything else. The fonts that come with AGS are just terrible so I made my own with images created in another program. I get better control that way and can make other transition effects such as page curling or dissolve. In addition, the only GUI accessory that can be animated is the button so that's why I went that route. My goal is to make a quality adventure game and while I want to push the limits of this engine, I tend to design my game with the best visuals in mind since that is my strong point.

I will see what I can do with your code, it may take me awhile to get it right but I need to learn this stuff.

Thanks again!

#22
Thanks for the replies, I didn't see you guys had posted them before I replied to my own solution. I will try your suggestions out also. I pretty sure my solution was taking the long way...

Thanks again!
#23
After a few more hours, I've come to one solution, but I would like to know how someone else would have handled this problem. This code will allow a player to hold down right-click and only see one speech balloon at a time. Scrubbing the screen with the right-click button held down will only let the player see the last hotspot they clicked on. Also, I got rid of the timers so now the player can just hold down right-click on the hotspot to read the speech balloon for as long as they like, then let go when they are finished. I would have liked to been able to use an array such as:
Code: ags
 (gPlayerDialog.BackgroundGraphic!=1||2||3||4||5...etc.)

but I couldn't get that to work, maybe I'm missing something...

Anyway, here's the code:
Code: ags

function repeatedly_execute_always()
{
//---------------------------------------Player Dialog GUI----------------------------------
gPlayerDialog.SetPosition(player.x-20, player.y-70);
  
//-------------------------------Right Click Actions On Hotspots-----------------------------
if((mouse.IsButtonDown(eMouseRight))!=1)
{
gPlayerDialog.BackgroundGraphic=0;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=242;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[2])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=155;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[3])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=244;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[4])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=155)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=245;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[5])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=246;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[6])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=247;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[7])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=155)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=248;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[8])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=249;
}
if(((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[9])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252)))))))))))))
{
gPlayerDialog.BackgroundGraphic=243;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[10])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=155)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=250;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[11])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=155)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=252))))))))))))
{
gPlayerDialog.BackgroundGraphic=251;
}
if((((((((((((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[12])&&(mouse.IsButtonDown(eMouseRight))
&&(gPlayerDialog.BackgroundGraphic!=242)&&(gPlayerDialog.BackgroundGraphic!=244)&&(gPlayerDialog.BackgroundGraphic!=245)
&&(gPlayerDialog.BackgroundGraphic!=246)&&(gPlayerDialog.BackgroundGraphic!=247)&&(gPlayerDialog.BackgroundGraphic!=248)
&&(gPlayerDialog.BackgroundGraphic!=249)&&(gPlayerDialog.BackgroundGraphic!=243)&&(gPlayerDialog.BackgroundGraphic!=251)
&&(gPlayerDialog.BackgroundGraphic!=250)&&(gPlayerDialog.BackgroundGraphic!=155))))))))))))
{
gPlayerDialog.BackgroundGraphic=252;
}
}

#24
Instead of displaying messages the old fashioned way, I had the idea to display a comic book style speech balloon that appear next to my characters head when a hotspot is right-clicked. Here is my code:

Code: ags
function repeatedly_execute_always()
{
  //---------------------------------------Player Dialog GUI----------------------------------
  gPlayerDialog.SetPosition(player.x-20, player.y-70);
  
  //-------------------------------Right Click Actions On Hotspots-----------------------------
  
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=242;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[2])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=155;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[3])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=244;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[4])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=245;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[5])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=246;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[6])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=247;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[7])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=248;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[8])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=249;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[9])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=243;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[10])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=250;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[11])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=251;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[12])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=252;
    SetTimer(1, 120);
  }
  if (IsTimerExpired(1)==1)
  {
    gPlayerDialog.BackgroundGraphic=0;
}
}


This works like I would expect it to. However, if you just continue to hold the right mouse button down the whole time, you can move the cursor over every hotspot to reveal a speech balloon. I do not want this to happen. What I would rather do, is to somehow disable the rest of the hotspots when another hotspot is active. This way, one speech balloon would always be displayed and the player would have to right click again on a different hotspot to see its particular speech balloon. I mainly want to prevent players from holding down right-click and scrubbing the screen until they find a hotspot.

I'm familiar with:

Code: ags
hotspot[1].enabled=true/false


but I'm not quite sure how I would code the conditions to make a hotspot active again and still be able to only show one speech balloon at a time when right-click is held down. I hope this made sense, please let me know if I need to clarify. Thanks in advance.



#25
I've been tinkering around with some text effects I'd like to add to my game, but there was one in particular that had me stumped for a few days. What I had done was made a thin, black GUI with an invisible button in the center of it to display a description. When the cursor moves over a hotspot, a description will fade-in or fade-out when the cursor moves off of it. To create the effect of the text fading in or fading out, I created an image of the text and applied a text transition with another program. After I imported the text sprites, I created animation views. Here is what I have coded so far in my room script:

Code: ags


function repeatedly_execute_always()
{
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(Description.NormalGraphic==0))
  {
    Description.Animate(3, 1, 3, eOnce);
  }
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(Description.Graphic==146))
  {
    Description.Animate(3, 0, 3, eOnce);
  }
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[0])&&(Description.Graphic==154))
  {
    Description.Animate(3, 1, 3, eOnce);
  }
}


While this code will work for 1 hotspot, I notice that if you move the mouse over the hotspot too fast, the animation doesn't always play; it only works if you move slowly over it. I believe there is a more efficient way to script my arguments, but I also have 12 hotspots in 1 room that need the same effect. I would appreciate any help with the correct approach I should take.
SMF spam blocked by CleanTalk