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

#261
Yes, exactly.

However you could also use custom dialog rendering to create your own simulated text box, but there's no easy way to do that, you have to do all the key processing and rendering yourself.
#262
So to get this straight:

- When the room in entered, you randomly set Greed to 1, 2 or 3.
- Next you start dialogs that reduce Greed by 1 multiple times
- But when Greed goes down to 0, you're not getting the line about the demon being defeated?

The first thing you need to check is that your room_RepExec is linked to the room event*, since unlike on_event, it actually needs to be linked or AGS will simply ignore it.

In the long run however you should use a function to reduce the variable which then also checks if it reached 0, because this check doesn't have to run 40 times per second. A related issue with your current code is that if you fix it, AGS will now keep displaying the message, leaving you unable to do anything else.

(* if this turns out to be the issue here, we need to think of a way to clarify and really emphasize this mechanism in the manual, given how often it still stumps beginners)
#263
I don't think you can directly access the string. This is really old functionality that has been around for a long time (and is rarely used, as far as I can tell).
It was primarily intended to be able to do the Quest For Glory thing where you can just type a random topic to ask people about.

Using existing capabilities, you need to use a dialog option that shows a separate text box to be able to have full access to what the player typed.
#264
I didn't see this before but there's a big problem with your code. C-style programming languages essentially ignore line breaks.
Which means
Code: ags
  if (ran==0) cAngel2.ChangeRoom(5); Greed++;
  if (ran==1) cEgo.ChangeRoom(5);  Greed += 2;
  if (ran==2) cDemon.ChangeRoom(5); Greed += 3;
is equivalent to
Code: ags
  if (ran==0) cAngel2.ChangeRoom(5);
  Greed++;
  if (ran==1) cEgo.ChangeRoom(5);
  Greed += 2;
  if (ran==2) cDemon.ChangeRoom(5);
  Greed += 3;

To run multiple commands conditionally, you need to wrap them in { and }:

Code: ags
  if (ran==0) { cAngel2.ChangeRoom(5); Greed++; }
  // or
  if (ran==1) {
    cEgo.ChangeRoom(5);
    Greed += 2;
  }
#265
If you declare a variable in the room script, it only exists in that room.
Since the dialog line that reduces Fear doesn't throw an error, my guess is you declared Fear twice. Which means you're working with two separate variables which just happen to have the same name.

To create an actual global variable, either use the global variables pane, or export/import it.
#266
If you put that code in the global  dialog_request  it should work (minus the GetLastWordTyped() part)
#267
If you set the label text in a loop by just
Code: ags
  lblWords.Text = Words[i];
it'll obviously just override the entire text each time.

Do this instead:
Code: ags
  String allWords = Words[0];
  for (int i = 1; i < numWords; i++) {
    allWords = allWords.Append(String.Format(" %s", Words[i]));
  }
#268
@Vincent Most languages have an Array.Join() method, the reverse of String.Split().
With AGS you have to for-loop over the array and add it to a string.

As an aside, regarding
Code: ags
  Display(String.Format("%s", message));
There's no need for this. First of all, Display already supports string formatting. But more importantly, you never need to write the above; you can simply call Display(message); since it's already a String.
#269
A quick solve is to do
Code: ags
  if (txt.StartsWith("he ") || txt.IndexOf(" he ") > 0)

But I'd go a different route: parsing the string char by char and putting the words into an array, skipping punctuation, words like "the" and potential double spaces and the like in the process.
This way you can do:
Code: ags
  if (word[0].CompareTo("how") == 0 && word[1].CompareTo("is") == 0) {
    if (word[2].CompareTo("weather")) ...
  }
#270
https has become ubiquitous nowadays (and that's a good thing) so it unfortunately isn't a viable solution to use an API until we get an https capable way to make requests from within AGS (leaving aside whether it's a good idea to have a game that will stop functioning if the server goes down/away).

I'd love a fetch plugin. *wink* *wink*
#271
The dll I had was a different one, yours works without issues, thanks!

I tested this and unfortunately it's an https issue. The reply you get is the "permanently moved" HTML since you did an http request, not an https one.
#272
I checked the dependencies and they are kernel32.dll, msvcrt.dll, user32.dll and ws2_32.dll. All of which are in my System32 folder.
I'd love to have this problem solved, maybe somebody has an idea? I already added the dll as file exception to Windows Defender, too.
#273
I wanted to test this myself but AGS tells me it's unable to load agssock.dll when I open the editor. Not sure what the reason is, IIRC it used to work on and off for me back then.

The error also says "it may depend on another dll that is missing" and I'm several Windows reinstalls down the line, so maybe that's the reason.
#274
You're thinking of the ags_shell plugin; the sockets plugin allows raw communication with a server and was initially used to let an AGS game talk to an IRC server.

Here's the sockets plugin (not sure which version, it's the one I used back then):
https://drive.google.com/file/d/1-MdDxpEEo0J1UAUm96fbIsyunmgZzja8/view?usp=sharing

And here's a link to an HTTP request module I wrote:
https://drive.google.com/file/d/1-GWWv4W2_dE40ydIFnGHp7Tm-btr7xoz/view?usp=sharing

You can use it like this:
Code: ags
  HTTPRequest.Prepare(GET_url);
  int HTTPCode = HTTPRequest.Get();
  Display(HTTPRequest.Reply());

It doesn't support https afaik, so it's kind of useless for external APIs though.
#275
If I had to do this I'd probably come up with a bunch of base phrases like
"can I x y"
"how do you x y"
"are you x y"
etc., then create a RegExp-like parser that a) detects which phrase was used and b) what x and y are.

Also, one of the hardest things to do is to upkeep a conversation; is your bot supposed to be able to do that? Like understand references to things previously mentioned?

Anyway, if somebody put a gun to my head and told me to implement this (I wouldn't otherwise) I'd probably use an existing online API and http requests via the sockets plugin.
#276
Language processing is a massive task. AGS can help you to some degree if you use the built-in parser but other than that you're on your own.

It would help if you listed some examples.
What are typical lines the user is expected to enter, and what do you want to recognize exactly?
#277
1. It depends on the inventory GUI's visibility. For instance "Pause Game When Shown" pauses the game while it's visible, "Normal" doesn't.
The regular room_RepExec only runs while the game isn't paused, correct.


2. As described in my recent post about footsteps you can workaround blocking code not triggering region events.


AGA said the server is on its last legs, so it's a good idea to do Ctrl-A Ctrl-C before hitting the post button in case submitting the post fails.
#278
You can wrap the code in
Code: ags
  if (cNPC.Room == player.Room)
to avoid these crashes.

Only a channel's volume can be adjusted afaik; the only other solution I can see is to import the sound at different volumes (which is probably not a terribly good idea).
#279
Yes, this is the correct way to solve this. The important part is that you can assign footstep sounds to your view's frames.

One caveat is that region events are not triggered during blocking walks; this is a general issue with regions that can be solved like this:

Code: ags
function region1_WalksOnto(Region *theRegion)
{
  player.ChangeView(VHOLOGRAM);
}

function region1_WalksOff(Region *theRegion)
{
  player.ChangeView(VROGER_WALK);
}

Region* prevRegion;

void repeatedly_execute_always() {
  Region* currRegion = Region.GetAtRoomXY(player.x, player.y);
  if (currRegion != prevRegion) {
    if (currRegion == region[1]) region1_WalksOnto(currRegion);
    if (prevRegion == region[1]) region1_WalksOff(currRegion);
  }
  prevRegion = currRegion;
}

This keeps cropping up from time to time, so maybe AGS4 could provide the option to always trigger region events?
#280
True, if you want the spell counters to tick down exactly from when they're cast, you need to go back to a higher frame resolution. You can in theory pick any amount of frames, like 5. It should be a divider of 40 though, so the conversion to seconds doesn't have rounding issues.

Memory is reserved whenever a new variable is declared. A single AGS int is probably a 32 bit signed integer, which means a gigabyte of RAM can hold 268.435.456 ints.
Changing an int takes up a (tiny, tiny, tiny) bit of processing time but doesn't use additional memory; it just changes the bits that were already reserved at declaration time.
It's like a massive blackboard where you wipe away a number and replace it with a different one, no additional space is needed.
SMF spam blocked by CleanTalk