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

#21
I don't want to flood the forum today so I'm putting all of these together since they're related. I don't think I've been googling the right keywords or searching here properly.

1) Is there a simple way to keep "say" lines on screen until the player advances them in the same way "display/displayat" works?

2) Is there a way to customize the look of the dialog bar that pops up on the bottom? Just changing the background color or more importantly, how close the responses are to each other. It looks smooshed to me.

3) How do I change the border of the regular text box? I know I can change the background color in the gui but I could've sworn the tutorial said you can change the border as well somehow and don't remember.

4) This is random but the manual mentions a "thought uses bubble GUI" setting. Where is that?

Thanks!

Bookmark
https://adventuregamestudio.github.io/ags-manual/Character.html
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Message.html
https://adventuregamestudio.github.io/ags-manual/Game.html
#22
Well, I figured it out lol I had the character's clickable property set to false. I didn't realize that would impact something like hover. Nevermind!
#23
I'm not at the laptop where I'm making the game so I can't post code. I'm just looking for educated guesses on what could be happening. I'm using one cursor mode (interact) and all of that works fine.

I wanted to try changing the cursor image when I hover over certain objects just to give players a visual cue that it's something they can interact with. I used the basic getlocationtype method in repeatedly execute.

It works fine for hotspots, objects, and reverting back to default when there's nothing, but it doesn't change when hovering over a character. My hunch then is something about the character is the problem but I don't know.

This is a blank room I use to test code, so nothing is actually happening in it. The character is just standing where I set in their properties, away from the player character. Any thoughts on where to dig for what could be causing the problem?
#24
Okay, thanks! I didn't realize the last four things were treated differently than the others.
#25
I don't remember this happening before unless I just didn't notice, but when I'm viewing a room's elements in the room editor, I can't seem to have visibility toggled on for both hotspots and walkable areas at the same time. It only lets me view one or the other. Everything else, visibility stays on. Is this normal?
#26
I forgot that boolean values can be expressed as the numbers true/false represent. That's neat! Not that I would've thought to do it here, it's just a good reminder lol Here's what I took from what you wrote. I used strut so I remember that it's custom stuff for walking...

1) I create zero variables for each axis.

2) I define key press variables that represent right-left and up-down since the player can't go in opposing directions at the same time, and I subtract them because going more in one direction means going less in the other.

3) I compare the result of a key press to the zero variable. If the result doesn't equal it (isn't false), then I need to make the player move in whichever direction the key press dictates using walkstraight instead of walk.

I originally used walkstraight in my attempt, but it made the animation stop even though I was still holding down the keys. The fact that the animation continued with walk made it seem closer to what I was trying to replicate so I switched it.

I saw that the module used stopmoving but couldn't figure out why so I didn't try to factor it in. I guess you need it to stop the movement so it has a new starting XY to calculate with. You lost me at the 1000 so I removed it to see what happens. The character barely moved so is that just to multiply the distance? The code works, by the way!

Code: ags
int strutX = 0, strutY = 0;

function repeatedly_execute()
{
  int gostrutX = (IsKeyPressed(eKeyRightArrow) || IsKeyPressed(eKeyD)) - (IsKeyPressed(eKeyLeftArrow) || IsKeyPressed(eKeyA));
  int gostrutY = (IsKeyPressed(eKeyDownArrow) || IsKeyPressed(eKeyS)) - (IsKeyPressed(eKeyUpArrow) || IsKeyPressed(eKeyW));
  
  if (gostrutX != strutX || gostrutY != strutY) 
  {
    player.StopMoving();
    player.WalkStraight(player.x   gostrutX * 1000, player.y   gostrutY * 1000);
    strutX = gostrutX;
    strutY = gostrutY;
  }
}

#27
Okay, thanks all! I wanted to store coordinates in a variable but didn't know where to go from there. I'll look the code over! The game is just meant to be a side scrolling point and click, so nothing complicated with the mechanics besides things I've already figured out how to do (like have stats that I track). It's just the keyboard movement that had me stuck.

Thanks Crimson too for bringing up overlays. I bookmarked that. My game's main pull besides the story will be the direction and animations in cutscenes since artwork and visual storytelling is my strength, not scripting. There will be plenty of times when I'll want to show something on screen that doesn't need to be an actual object or character so learning about overlays will help.

#28
Thanks, Khris/Captain! I figured the OR couldn't be used in that kind of statement but took a wonky stab lol

I know I can write "if either the arrows or wasd are pressed, do something". The problem is scripting the "do something" part in this case because I don't know how to natively control character movement.

All of my searches led back to the module where the movement is already scripted and you just define which keys you want to use, so I was trying to work with that.

I deleted the module and the reference to it in the global script to learn from the ground up. Logic tells me that to move the player with the keyboard, I should change the XY when a key is pressed. Moving up would be decreasing Y, right increasing X, etc.

Character functions include move/walk which unless I'm wrong, do the same thing, only move does it without the walking animation, so I picked walk and started with this.

Code: ags
  if (IsKeyPressed(eKeyUpArrow) || IsKeyPressed(eKeyW))
  player.Walk(player.x, player.y-1);
  
  if (IsKeyPressed(eKeyDownArrow) || IsKeyPressed(eKeyS))
  player.Walk(player.x, player.y+1);
  
  if (IsKeyPressed(eKeyLeftArrow) || IsKeyPressed(eKeyA))
  player.Walk(player.x-1, player.y);
  
  if (IsKeyPressed(eKeyRightArrow) || IsKeyPressed(eKeyD))
  player.Walk(player.x+1, player.y);


I'm not trying to do shortcuts/best practices, just get the basics down. I'm using player instead of the character name because the player will always be the same character anyway. Good: The player moves using either arrows or wasd.

Bad: The player moves after the key is released, not when it's pressed, and he doesn't continue to move while holding the key down. He moves once and stops. Only the animation continues while the key is held.

I placed it inside the repeatedly_execute function thinking it would repeatedly check if the key is pressed and perform the action of changing XY again as long as the game isn't blocked but it doesn't. I assume I need some kind of loop to tell it to incrementally change the XY by however much but I'm not sure. Also it doesn't have to be by 1 pixel, it's just to have a number there. What would be the next step from here?

Bookmarked
https://adventuregamestudio.github.io/ags-manual/TemplateSierraStyle.html
https://adventuregamestudio.github.io/ags-manual/Character.html
#29
Okay, thanks to both of you! You've been really helpful! I'm at least grateful because I think the hardest part of coding is understanding what code does when you see it, and I already get that. It's just going to take me a while to learn all the different things I can do myself and what's best for those scenarios.
#30
The default controls player movement with the arrow keys and wasd does nothing. I want to also be able to use wasd. The keyboard movement module it comes with has the arrow keys defined as default here:

Code: ags
 keymap.KeyDown = eKeyDownArrow;
  keymap.KeyLeft = eKeyLeftArrow;
  keymap.KeyRight = eKeyRightArrow;
  keymap.KeyUp = eKeyUpArrow;


I thought I could just add the wasd keys using OR but it doesn't change anything if I try...

Code: ags
keymap.KeyDown = eKeyDownArrow || eKeyS;


Is that because operators don't work when defining, only for checks (like in if/else statements) or is my syntax just wrong? The global script has its own section that defines wasd for movement...

Code: ags
  //KeyboardMovement.KeyUp = eKeyW;
  //KeyboardMovement.KeyDown = eKeyS;
  //KeyboardMovement.KeyLeft = eKeyA;
  //KeyboardMovement.KeyRight = eKeyD;


If I remove the comments to actually enable those lines, it overrides the module and the player controls with wasd instead of arrows. How would I enable both? Thanks!
#31
I was reading through global functions and looking at getlocationtype, which returns what type of element is at that screen location (hotspot, character, object, nothing). The example the manual gave is...

Code: ags
if (GetLocationType(mouse.x,mouse.y) == eLocationCharacter)
    mouse.Mode = eModeTalk;


I read it as if it's a character, use the talk cursor mode. It's easy enough. But every time I see getlocationtype used in the forums, there's this...

Code: ags
int lt = GetLocationType(mouse.x, mouse.y);


I read that as defining a custom variable named lt that stores whatever value getlocationtype returns. Is that just to simplify the code by being able to type lt for checks instead of writing out that whole line or does lt actually do something on its own?

This is my main hurdle learning scripting. Telling the difference between what someone is writing because that's how it has to be written in AGS (built-in functions/variables/whatever with fixed names and uses), or if it's just their own custom stuff that can be done another way.

Like if I hadn't gone through the tutorial, I would've assumed a hotspot and character need a lowercase h and c to work. Not that it's just convention. Especially when there are other things like cursor modes where the lowercase letter in front does need to be there because that's how its script name is hard coded.

Basically, I don't want to just parrot how someone else does something. I want to understand the core way of doing it so I can then apply my own custom approach. That's why I focus so much on the manual.

The forums are great because I almost always find threads relevant to what I'm learning about. I just end up wasting a lot of time trying to figure out if something in the recommended code is built-in or custom lol

Bookmarked
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html
#32
Thanks Snarky and Matti for the input! I'll post here when I get things running how I want. It'll be easy to test and get feedback on where I went wrong since I'm doing all of this practice with just two rooms before jumping into anything more complex.
#33
Thanks! I already started with the Sierra template because I like the overall function of it and can see how some things would work. I just know I don't want to use the cursor cycling this time. I'll load up another test game with the BASS template to compare the two.

I already know how to do the things you mentioned. It's the global control to dictate the cursor's behavior depending on what you're hovering/clicking on that I was asking about. The manual said some cursor modes are hard coded and I can tweak the rest, but I didn't know how much I could tweak from the global script alone.

Since I'd want it to behave the same for all hotspots, for example, I thought I could set up a global cursor behavior that dictates what happens when interacting with any hotspot. But I realized I'd still have to define it in the rooms anyway unless I want the output to be the same in every case too.

Because the global script could say "when clicking any hotspot, display its blurb", but the game wouldn't know what that blurb says without me defining it for each individual hotspot anyway.

Basically, apart from using only one cursor, I was trying to think of a way to reduce the amount of scripting by not defining every single mouse action and instead just assigning output to variables and having a global script call the variable.

I'll just bookmark this thread and try what I was thinking and post the code when I'm done with it because how I describe what I'm trying to do never comes out right lol Thanks again!
#34
I found threads for this but those users were way past where I'm at. I need to understand this from the ground up. Inventory can stay how it is. I want the game to use one cursor with this behavior:

- When you hover over an object, hotspot or character, it shows their name. 
- When you click on an object, hotspot or character, it interacts.

How it interacts depends on the thing. If it's a character, you'll talk to them. If it's a hotspot, a description will appear. If it's an object, you'll either take it or use it. I get how to script these things individually but I don't know how to do this globally.

1) Is all of this handled in the global script?
2) Which part of this can be done just by changing the built-in cursor mode settings?

I saw a thread mention setting standard mode to false for cursors you don't want. I see it removes that cursor from the list player cycles through. Is that all it does? I want to tackle this with my own custom cursor but I don't want to waste time so I'm asking about it first.

Thanks!

Bookmarked
https://adventuregamestudio.github.io/ags-manual/EditorCursor.html
https://adventuregamestudio.github.io/ags-manual/Mouse.html
#35
I finally figured it out! Two things were wrong...

1) I had the start menu gui property set to visible. I thought setting it to invisible by pressing start in room 0's script would override that for room 0 and every room I moved to after, but it didn't.

The gui was still in room 1 even though I couldn't see it, blocking input. No code I tried in either room script or in global worked to remove it from room 1. I had to change the gui's property to invisible to gain full control of it through scripting.

2) The "after fade in" event wasn't linked in room 1 so none of the functions I placed in it were getting called. I could've sworn I clicked on room events to create that function like I did with all the others but I guess not (laugh) Linking it after the fact fixed the problem.
#36
I've been working on an intro. I set it up where room 0 has no background so it's black. There's a room size gui with a start button. When you press start, the gui disappears to reveal the room.

Then I used the "on key press" function to trigger text I wrote with "display at" so I can alternate between it being located on one side of the room and the other to imply different people talking.

I then used the "player change room" property to change to room 1. Since I'm still learning, I kept the tutorial room built into the template as room 1.

It does what I want. You press start to begin the game, press space/enter/whatever to advance the text, then it fades to reveal room 1 with the player standing in the same location as desired.

The problem is nothing happens after that. I started both room scripts with "after fade in" from events, but with room 1, no code I add in that function actually happens except placing characters. I can't even move.

For example, I tried using display at again and the text doesn't show up. I tossed in a bunch of functions to test. No response. I don't get any compiler errors, room 1 just fades in and sits there.

Is there something I'm specifically supposed to start and end rooms with to make sure each subsequent room works? I put "player change room" inside the "on key press" function of room 0 just because that was the last function in the room. Could that be messing things up somehow? Thanks!
#37
With the default Sierra template I'm using, only the arrow keys work for keyboard movement. Not WASD. So my focus was on how arrows control the player. I'm not using a mouse since I'm learning and testing on my laptop, not on my desktop.

I found the code crimson mentioned in the keyboard movement script and copy pasted the replacement as provided. Movement behavior didn't change. I deleted that block of code entirely and ran the game again. Movement behavior still didn't change.

That made me think movement is being controlled by something else, so I searched for more code in the movement script that included walkstraight and found this on its own line:

Code: ags
player.WalkStraight(player.x   move.x * distance, player.y   move.y * distance, eNoBlock);


When I deletedthat, the player wouldn't move anymore, so I guess I'll focus on that line to tweak movement. In the meantime, I tried creating a really thin walkable area like others suggested and that does limit movement.

But mentions of it maybe getting the character stuck makes me not really want to use that method. I also don't see how to set exact values for it since I'm drawing it. How would I "set" it to 1 pixel in height when there's nothing in properties except design and scaling? Or do I just zoom in as much as I can to draw it as thin as I can?

I'm abandoning this for now because it's already taken up two days of research and I want to get the interface and dialogue stuff figured out first, but I'll bookmark this so I can update it whenever I have my solution. Thanks again!
#38
Okay, thank you everyone! I'll take a stab at this and report back if things work or if I need more guidance!
#39
Sorry, I've been searching for answers and rarely find what I'm looking for despite browsing the manual, the forum, etc., probably because I'm using the wrong keywords or phrasing. Also, the forum search specifically gives me an error and says to try again later.

I just started with AGS and went through the tutorial using the Sierra template. It was a breeze, very useful. Now I'm moving onto tweaking the template to fit my needs and I've been figuring everything out bit by bit except movement.

The default behavior is that the player can walk left, right, up and down. My game will have no room depth. I only want the player to be able to walk left or right, with up and down controls causing the player to face up or down. Not actually move.

I can't find anything about how to turn moving up and down off. If it's a character setting, a room's walkable area setting, if it can even be done without writing my own script. Every time I search for character movement, walking, directions, controls, I get info about animations, not movement within the room itself.

Can you point me in the right direction? Thanks!
SMF spam blocked by CleanTalk