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

#401
Back a few months ago they suddenly showed a popup that said something like "you have three videos left to watch while adblock is turned on".
I'm always logged in, so that might have contributed to this.

Anyway, the goddamn ads are gone for now. They are incredibly annoying, and it was some of the worst ones out there. Part of it was the same boring and stupid ads for detergents or shampoo I already loathe from network tv, the rest was Hero Wars and a bunch of crypto and health scams. (I even reported one ad as being a ponzi scheme and they took it down (laugh)).
#402
I had to turn uBlock Origin off on youtube a few months ago because it essentially told me I'd no longer be able to use the site otherwise. Good to know there are other ways to get rid of the ads in case this method breaks at some point.
#403
Right, I forgot to square the y value. Here's the fixed line:

Code: ags
  float f = 1500.0 / Maths.Sqrt(kite_dx * kite_dx + kite_dy * kite_dy);
#404
I recently found this method on reddit and wanted to share.

First, you need the uBlock Origin extension installed in your browser. Open its window (click on the icon) and click on the gearwheels in the bottom right. This opens the settings page. Select the "My filters" tab, then paste the four lines found here:
https://pastebin.com/LMD0v06k

Works great so far. As I understand it, these filters prevent youtube from detecting uO.

Edit: the key benefit of these additional filters seems to be that you can remain logged in and youtube still cannot tell you're circumventing the ad breaks.
#405
They replace lines 17-28 from your snippet. The error occurs because the existing code declares the variables as ints.
Btw, if the kite stops short of leaving the screen, just increase 1500.0 to something like 1800.0 or 2000.0
#406
You don't write the command into the events table field.
Empty the field, the click the ellipses button at the end. This will create and link the function and take you to it. Now put the command(s) inside the function.

This process is explained in the tutorial:
https://adventuregamestudio.github.io/ags-manual/acintro3.html
#407
I'd change the target calculation first:

Code: ags
  float kite_dx = IntToFloat(player.x - cKite.x); // x distance from enemy to player
  float kite_dy = IntToFloat(player.y - cKite.y); // y distance from enemy to player
  float f = 1500.0 / Maths.Sqrt(kite_dx * kite_dx + kite_dy * kite_dy); // factor to extend vector to a length of 1500
  cKite.Walk(cKite.x + FloatToInt(kite_dx * f), cKite.y + FloatToInt(kite_dy * f), eNoBlock, eAnywhere);

This essentially eliminates the possibility of a division by zero error.

The next step is basic debugging: add Display() commands to your code to double check what actually runs and doesn't run, and when.
#408
I looked at this and it was the ItemWidth and ItemHeight setting. The sprites are 100x50, the dimensions were still set to 30x20.

Open gInventoryGUI, select the InvWindow and adjust the settings accordingly.
#409
Most room script functions aren't called as soon as they exist but need to be linked to the event.
Did you just type that function yourself? If so, you need to open the room, click the thunderbolt icon, then the "first time player enters room" event, then the ellipses button. This will create and link the function.
#410
You can also take a look at this:
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/musicplayer/msg636660568/#msg636660568
(set up multiple tracks and have them play in specific rooms without restarting)
#411
1. You can put the code in game_start, or in the first playable room's room_Load function (i.e. the enters before fadein event).
As you've said correctly, setup code never goes into rep_exe, which is only supposed to be used when necessary.

2. Sounds like all you need is also call cEgo.FollowCharacter(null); when you set them as active player character, same for cRoger.
#412
You don't describe what the problem is. Anyway, do not use ChatGPT to write AGS code.
One issue with your code is that the Animate command expects the loop and delay as the first two parameters. You're also supposed to lock in a view first.

AGS comes with a KeyboardMovement module that is part of the Sierra template for instance. Setting the movement mode to pressing will do exactly what you're looking for.

In general, doing a hold down to walk movement code means you need to watch for a) the user starting to hold down a key b) the key being released again.
Event a) means you send off the character in the appropriate direction using a non-blocking walk command. Event b) means you stop the character. That way you can use the built-in walk behavior, which is by far the easiest way to implement this.

The way I'd implement this is to keep track of two values:
int x = IsKeyPressed(eKeyRightArrow) - IsKeyPressed(eKeyLeftArrow);
and
int y = IsKeyPressed(eKeyDownArrow) - IsKeyPressed(eKeyUpArrow);
(if you force bools into additions / subtractions, they get cast to 0 / 1)

These formulas will produce -1, 0 or 1 for both x and y. By keeping the previous values for both x and y, you can now check in rep_exe if they have changed since the previous frame.
If either x or y has changed you can stop the player (since we need to do this regardless). Then you calculate new target coordinates and send them off again using player.Walk(player.x + 10000*x, player.y + 10000*y);

Here's code:

Code: ags
int prevX, prevY;
function HandleCharacterMovement() {
  int x = IsKeyPressed(eKeyRightArrow) - IsKeyPressed(eKeyLeftArrow);
  int y = IsKeyPressed(eKeyDownArrow) - IsKeyPressed(eKeyUpArrow);
  if (x != prevX || y != prevY) {
    player.StopMoving();
    player.Walk(player.x + 10000*x, player.y + 10000*y);
  }
  prevX = x;
  prevY = y;
}
#413
Wordle 992 2/6

🟩⬜⬜🟩🟩
🟩🟩🟩🟩🟩

 :-D
#414
Is the player character supposed to be visible in the map room? Because if not, simply remove the coordinates and just call player.ChangeRoom(map_room_number); when the user opens the map.
This way the player will retain their position.

Also, why use a separate room and also a GUI for the map? If you use just the GUI, the problem also disappears.
#415
If my code is in the global script, you can paste "btnTeleport_OnClick" directly into each button's onClick event field (you don't need a separate function for each button).
If you've moved the teleport code to a new script, you will need this:

Code: ags
// your button function
function YourButton_OnClick(GUIControl* control, MouseButton button) {
  // forward call to module / my function
  btnTeleport_OnClick(control, button); // pass along the parameters
}
You can of course again reuse this function for all other buttons.

And you will need to import the function in the module's header so it's visible from the global script:
Code: ags
// module header
import function btnTeleport_OnClick(GUIControl* control, MouseButton button);
#416
You can remove the line; it makes sure you actually clicked a button, but that is a given anyway unless you enter the function name into some other GUI element's event table.

And it should only react to a left mouse click, which is also a given I guess.

My original code compares the button's image to all location images using a loop; I don't think a single comparison is enough here.
#417
Yes, it's much easier to add additional actions. You already have a pick up mode and the two user modes directly supported by the event system.
#418
Unfortunately, while that template does have some options, adding a 5th verb isn't one of them.
I was rewriting it for somebody else who wanted six buttons, and it was a lot of work, since it is hard-coded for four buttons almost everywhere in its script.
#419
Good question; hard to tell from afar.
You could add Display commands to check where buttons are positioned and which sprite is being used. The buttons also need to have the correct .Y, .Width and .Height already.
#420
Try this instead:

Code: ags
  for (int li = 0; li < 50; li++) {
    int count = enemy_item[Eilookup(enemyId, li)].count;
    if (count > 0) {
      // add loot[li] to inventory
    }
  }
SMF spam blocked by CleanTalk