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 - Ryan Timothy B

#1621
I realize you have this working now but if you or someone wanted to make your own instead of using that default script, I believe this works without issues:

Variables at the top of the Global Script (outside of a function)
Code: ags

bool keyboardMovement;
int keyboardMovementDirection;


Inside repeatedly execute in the Global Script
Code: ags

  if (!IsGamePaused() && IsInterfaceEnabled() && player.on)
  {
    bool dUp, dRight, dDown, dLeft;
    int newDirection;
  
    if (IsKeyPressed(eKeyUpArrow)) dUp=true;
    if (IsKeyPressed(eKeyRightArrow)) dRight=true;
    if (IsKeyPressed(eKeyDownArrow)) dDown=true;
    if (IsKeyPressed(eKeyLeftArrow)) dLeft=true;
  
    if (dUp && dRight) newDirection=2;
    else if (dRight && dDown) newDirection=4;
    else if (dDown && dLeft) newDirection=6;
    else if (dLeft && dUp) newDirection=8;
    else if (dUp) newDirection=1;
    else if (dRight) newDirection=3;
    else if (dDown) newDirection=5;
    else if (dLeft) newDirection=7;
    else newDirection=0; //nothing
  
    if (newDirection!=keyboardMovementDirection)
    {
      keyboardMovement=true;
      int newX, newY;
      if (newDirection==1 || newDirection==2 || newDirection==8) newY=-1000;
      else if (newDirection==4 || newDirection==5 || newDirection==6) newY=1000;
      if (newDirection==2 || newDirection==3 || newDirection==4) newX=1000;
      else if (newDirection==6 || newDirection==7 || newDirection==8) newX=-1000;
      player.WalkStraight(player.x+newX, player.y+newY, eNoBlock);
      keyboardMovementDirection=newDirection;
    }
    else if (newDirection==0 && keyboardMovement)
    {
      keyboardMovement=false;
      player.StopMoving();
    }
  }
#1622
I imagine you could check the newly added character and remove it once it's added if it's not an acceptable character.
#1623
Are you black?








Yes, you heard me.. I said it.  ;D lmao
#1624
Yeah I figured it was 0-100.  Anything below 0 or above 100 shouldn't crash AGS though.


Anyway now that I've had some time to play with character.Tint, I've found out that it's very odd and I can't understand how it works at all.

For instance (using character.Tint(0, 0, 0, x, 0), x being the saturation below):
Room Lighting  vs  Character.Tint
room lighting -30  = 100 saturation (pure black)
room lighting 0     = 75 saturation   (3/4 black)
room lighting 100 = 0 saturation (normal)
room lighting 230 (pure white)

I can't seem to get the character any whiter/lighter than the normal color with Character.Tint.
I also can't seem to figure out what luminance does.  I'm on 32 bit color, same with the character.

Also any room lighting below -30 or above 230 turns the character's colors all wacky.  A quote from the manual says this "This is different from the editor, which takes values from 0 to 200.".  Are we not supposed to make the character pure black or white?


How do you get room lighting to match up exactly with Character.Tint?  Is there some kind of trick to this that I'm not aware of?  It seems much more confusing than it needs to be.


I've noticed that if you select true to region color tint that it doesn't prevent you from going outside 0-100 or crash.
#1625
I'm not sure if it's an issue strictly with my game, or with AGS altogether.  I'm using AGS Build 3.2.0.102.

I set the character tint, and honestly I don't understand character.tint whatsoever.  I don't know the limits, I don't understand how it works, etc.  So basically I was playing around with it.

Anyway I did this:  
Code: ags
cMikael.Tint(0, 0, 0, 1, 250);

I wasn't sure what the limits were and just assumed the editor would give me a friendly message or something.

And got this error:
Code: ags

Error: An error occurred while parsing EntityName. Line 2, position 97.
Version: AGS 3.2.0.102

System.Xml.XmlException: An error occurred while parsing EntityName. Line 2, position 97.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.Throw(String res)
   at System.Xml.XmlTextReaderImpl.ParseEntityName()
   at System.Xml.XmlTextReaderImpl.ParseEntityReference()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at AGS.Editor.NamedPipesEngineCommunication.MessageSenderThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


And then AGS crashes.  It also throws me the do not save your game, you've encountered a serious bug, or whatever it says exactly.
When I comment out the character.Tint, it works without issue.
#1626
AGS Archives / Re: AGS Archives Pre-launched!
Mon 07/06/2010 02:12:59
You've spelled 'already' incorrectly 3 times on the main page.  :=
You have 'allready'.
#1627
QuoteKinda reminds me of that movie I saw about this average man who went far into the future to learn that, when he got there, he became the smartest man on earth.

Oh man.. you speak of Idiocracy, correct?  That movie was absolutely terrible.  The only enjoyable part of the movie that I can remember was the Gatorade replacing the water in fountains.  Haha.  Silly Americans and their soft drinks / power drinks.  I can see this being the norm... one day... one day..
#1628
It's also today's generation, they don't know how to type anything without everything being an acronym or swiss cheese sentences.  ;D

It's that damn 140 character limit on texts.
#1629
If these people talking are all characters, instead of having dozens and dozens of duplicate functions all doing the same thing, you could simply do this:

Code: ags

function Message(this Character*, String say) {
  if (this==cScotty) Button1.NormalGraphic=12;
  else if (this==cKirk) Button1.NormalGraphic=13;
  //etc...
  
  Label2.Text = say;
  gGui1.Visible=true;
  int timer=60+(say.Length*2);
  bool pressedSpace, doNotSkipSpeech;
  if (IsKeyPressed(eKeySpace)) doNotSkipSpeech=true;
  while (!pressedSpace && timer>0)
  {
    if (IsKeyPressed(eKeySpace)) 
    {
      if (!doNotSkipSpeech) pressedSpace=true;
    } 
    else if (doNotSkipSpeech) doNotSkipSpeech=false;
    timer--;
    Wait(1);
  }
  gGui1.Visible=false;
}


And in the header it would now be:
Code: ags

import function Message(this Character*, String say);


Then to call this function you simply just do this:
Code: ags

cScotty.Message("Hello, I'm Scotty!");
cKirk.Message("Hello, I'm Kirk!");



Also, now that I know these are characters talking, I'm not sure why you didn't just use your own custom Display box with Avatar picture for each character.  It's already setup for doing so in AGS... although I've never used it myself.
#1630
That's the bestest barrel rotation I ever did saw!
#1631
That's exactly what I mean.  You create a GUI with a text label which will display the text.  
You can also get all fancy and have it change the text color and such depending on the character.  I'm assuming this isn't a regular adventure game setting, correct?  Because I've been under the impression it's for a mini game part of the adventure game, not the whole thing.

If it is you could always make it so that you could do this:  player.Message("Hello World.");
Let me know if it's supposed to be characters talking or if it's only like a narrator message.


Also, since you asked so nicely.  ::)  I'll show you how to make a timer which will clear the message after the certain time.

Code: ags

function message(String say) {
  Label2.Text = say;
  gGui1.Visible=true;
  int timer=60+(say.Length*2);
  bool pressedSpace, doNotSkipSpeech;
  if (IsKeyPressed(eKeySpace)) doNotSkipSpeech=true;
  while (!pressedSpace && timer>0)
  {
    if (IsKeyPressed(eKeySpace)) 
    {
      if (!doNotSkipSpeech) pressedSpace=true;
    } 
    else if (doNotSkipSpeech) doNotSkipSpeech=false;
    timer--;
    Wait(1);
  }
  gGui1.Visible=false;
}


Edit: Yeah, like I said before.  I really don't understand exactly what these messages are displaying for.  Are they supposed to be the character talking?
#1632
You said Text Box, but I'm assuming you meant Label, because a text box receives text the user inputs.
Quoteright now we have a gui that has a text box and avatar picture pop up
Isn't that what you have the GUI label for, why are you using Display At instead? Also you're being vague and it makes it much harder for us to help you.

Since you were using Display At, which is a blocking call, I'm assuming you still want this to be blocking.  Also assuming this Avatar picture and label IS for the speech, but you weren't using it for some reason.

Assuming the label is called: Label1  and the GUI is called: gTheGUI.  I'm also assuming the Avatar picture is being displayed by a button, so pretend the button is called: Button1.
You can do something along the lines of this:

In the Global Script:
Code: ags

function noloopcheck message(int avatarSprite, String say) {
  Button1.NormalGraphic=avatarSprite;
  Label1.Text = say;
  gTheGUI.Visible=true;
  bool pressedSpace, doNotSkipSpeech;
  if (IsKeyPressed(eKeySpace)) doNotSkipSpeech=true;
  while (!pressedSpace)
  {
    if (IsKeyPressed(eKeySpace)) 
    {
      if (!doNotSkipSpeech) pressedSpace=true;
    } 
    else if (doNotSkipSpeech) doNotSkipSpeech=false;
    wait(1);
  }
  gTheGUI.Visible=false;
}


In the Global Script header:
Code: ags

import function message(int avatarSprite, String say);


When you want to display text with the avatar, you simple just call it by doing this:
Code: ags

message(13, "Hello World!");


The text would actually show the text forever unless the user pressed space, and it's untested because I wrote it in the browser.
You could also use a timer by checking the string length using: String.Length  but that's for another day. :P

Edit: Forgot to fix it to prevent you from holding the space button down before the you display the message, or if you held it during, it'd skip all messages.
#1633
Why don't you use a GUI for the speech then?  You can script it to skip by the space bar, or a timer.
#1634
I gave it a shot with my game and it works perfectly fine.  The only key that skips the text is the space bar, also the mouse still works.

Are you sure you put it in the  game_start  function within the global script, like Khris had said?
#1635
I'm not sure why you have:  mouse.Mode = mouse.Mode;  That's like going 1=1;

What are your issues exactly?  Just deselecting items in general (any location of the screen) doesn't work?


Dual, worst thing about condensing that script like that is it gets AGS to check all the Controls at the mouse's X and Y, AND checks all the Inventory objects at the X and Y even if you haven't clicked on the inventory window.  It's not a huge deal in CPU time, I imagine though and it only runs this when you right click.

Truthfully I guess the code should check to see if you even have an inventory item active, otherwise it shouldn't even run.  Like:
Code: ags

if (event == eEventGUIMouseDown && player.ActiveInventory!=null) {
...etc
#1636
That's because you've reduced my code to work in a totally different way, which yields improper results.  I thought you meant that you couldn't figure out how to deselect an inventory item ONLY while you're hovering the mouse over the inventory window and right clicked.  Which is what my code was for.

Otherwise there is no 'bug' as you've stated, just improper coding.

If it's for regular deselecting of inventory items while right clicking, you don't use this code whatsoever.  
#1637
It's a very annoying feature with the inventory window -- I'm assuming you mean that it doesn't deselect the inventory item only while you're over the inventory window and right click.

You have to do something along the lines of this, put this in the global script:
Code: ags

function on_event(EventType event, int data) {
  if (event == eEventGUIMouseDown) {
    if (mouse.IsButtonDown(eMouseRight)) {
      GUIControl *theControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
      if (theControl==InventoryWindow1) {
        InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
        if (i==null) { //only if there isn't an inventory item where you're clicking
          player.ActiveInventory = null;   // lose active inventory item
          mouse.Mode=eModeInteract; //or whatever mode it should be
        }
      }
    }
  }
}


The only thing you really should have to change is: InventoryWindow1  to the name of your inventory box.
#1638
General Discussion / Re: Math Question!
Thu 03/06/2010 02:53:30
No worries Bulbapuck.  I still appreciate the help. :P


On a side note, I just used Gilbet's solution to find the stopping speed.  Yay!
0.1 = 3.0/(((46.5/3.0)*2.0)-1.0)

I first needed the solution to find out if the object will be stopping within that 'area'.  Then I needed to increase or decrease the stopping speed to have it stop exactly where I wanted it within the 'area'.

Thanks again guys.
#1639
It's because you're bloody dense.  We say things and you honestly have no idea what has been said.

For instance, Xenogia says: The interface is broken I gave up after a minute.
You respond with: B-b-broken!?! what did you press!?!

He didn't say "Hey, I broke the interface. I gave up.".  He literally said that the interface was broken itself.  Which means that you programmed a very poor user interface that is very hard for people to use and understand.

Honestly, if your goal is "All i want to do is make a good game", then you should spend more than 5 minutes ripping graphics and videos and wrapping it all together into a big pile of unsatisfying crap; which usually leaves the player with a bitter taste in their mouth and their pants around their ankles.

Think about how the game feels.  If someone else made this game, and you played it, how would you feel about it?  And be honest with yourself.
Also, more importantly: get yourself a beta tester.  But I doubt you'd pay attention to any advice they give you.
#1640
General Discussion / Re: Math Question!
Wed 02/06/2010 04:42:55
Right on, thanks Gilbet.  Works like a charm.
SMF spam blocked by CleanTalk