Copilot and quest?

Here's an answer I got yesterday from Microsoft Copilot.

I tried to post the conversation in full, but kept running into an error that I couldn't post here. So today I decided to look for a truncated portion of the conversation that might post better (no links). Let's see if it works!

You
how do i make an invisible object interactable in ASLX code?
Copilot
To make an invisible object interactable in ASLX code, you need to set its visible attribute to true, but also set its opacity attribute to 0. This will make the object transparent, but still able to receive mouse or touch events. For example, if you have an object named button, you can write:

<object alias="Button" name="button">
  <description>
    A button that does something when clicked.
  </description>
  <attribute name="visible" value="true" />
  <attribute name="opacity" value="0" />
  <verb alias="Click" name="click">
    <script>
      msg ("You clicked the button.")
    </script>
  </verb>
</object>

This will make the button object invisible, but still clickable. You can also change the opacity of an object dynamically using scripts. For example, if you want to make the button fade in and out, you can write:

<object alias="Button" name="button">
  <description>
    A button that does something when clicked.
  </description>
  <attribute name="visible" value="true" />
  <attribute name="opacity" value="0" />
  <verb alias="Click" name="click">
    <script>
      msg ("You clicked the button.")
      fade (this, 100, 1) // fade in
      wait (1) // wait for 1 second
      fade (this, 0, 1) // fade out
    </script>
  </verb>
</object>

This will make the button object invisible, but still clickable. It will also make it fade in and out when clicked. I hope this helps you understand how to make an invisible object interactable in ASLX code. 😊


Woot! It posted. So anyway, at first Copilot asked me whether I was asking it about medical codes from Quest Diagnostics. So I corrected it, and it discovered that there was a Quest Text Adventures.

Then it could only tell me a little bit about Quest. That the code type was ASLX and was for creating Interactive fiction. But after I gave it a URL to Quest Documentation and a URL to Pixie's additional documentation on GitHub... It was willing to start giving me answers like the one above...


Thanks for the fantastic scientific study on Microsoft Copilot. I will try the script, too, soon.
I wonder if, since I still don't have access to Microsoft Copilot, you could ask how to change the size and position of popups to use android screens more economically?


Oh it's free, nice.

Also, it can generate images as well.


I'm curious what it will say if you ask it what type of data the Floor function returns :p


I'm curious what it will say if you ask it what type of data the Floor function returns :p

The floor() function, commonly used in programming languages and libraries, returns a double type value. It is defined in the <math.h> header file. When you apply the floor() function to a number, it rounds down to the nearest integer that is less than or equal to the given value. For example, if you pass 2.3 to floor(), it will return 2.

In the context of text adventure games, the floor() function can be useful for handling character movement, calculating coordinates, or managing game mechanics. However, it’s essential to remember that it returns a double, so you may need to cast the result to an integer if you specifically require an integer value.

As for why std::floor returns a double in the first place, consider that the range of double is much greater than that of 32-bit or 64-bit integers. Casting to an integer after applying std::floor should work as long as the result falls within the appropriate integer range. Keep in mind that doubles cannot precisely represent all 64-bit integers, so be cautious when dealing with large values where the accuracy of double might lead to errors. 🤓


you could ask how to change the size and position of popups to use android screens more economically?

The copilot is giving another coding program not relevant to quest coding.


I'm not sure if that's luck or genius. The Quest documentation (incorrectly) says that the rounding functions return an integer.

Copilot's answer seems to be paraphrasing the C# documentation for the equivalent function; which isn't entirely helpful (the Quest documentation doesn't mention a cast operator… although if there is one, it would be very good to know). But it's more accurate than the Quest docs.


Could someone ask it if there is a way to add the gridmap to games for phone play?


Could someone ask it if there is a way to add the gridmap to games for phone play?

It just recommends to use Mipui website.

Generally It is hard for bots to understand or solve artistic problems which is why the "verify you are a bot or not" are often pictures quiz.

Copilot's answer seems to be paraphrasing the C# documentation for the equivalent function

Even though I did linked in textadventure website and quest documentation to the bot, the bot seems to answer in C# based on your respond. It reinforces my theory that bots prefer programming languages that is top rank in use frequency.

So, I was surprised that Ip Man received an aslx code, perhaps a few more tricks might be required that I do not know of.


So, I was surprised that Ip Man received an aslx code

Not really valid, unfortunately. I'm guessing that in that example, it generated some Javascript and then changed the code syntax to superficially look like ASLX. I've had similar issues with Bard and Claude; very good at generating something that looks like valid code, but bad at writing anything that actually works.


@ Jennifer Wren

Copilot is free if you download/use Edge Browser.

@ Mr. Angel, that's good to know.

I found that Copilot required me to specify ASLX code with every question or it would give me weird stuff I didn't recognize. But I didn't get to test anything to see if the code works or is just "hallucination."


I asked it this time to troubleshoot an error for me:
HOw would I troubleshoot the above error in ASLX code?

Copilot
Troubleshooting errors in ASLX code can be a systematic process. Let’s break it down step by step:

Analyze the Error Message:
The error message you provided is: “Error running script: Error compiling expression ‘game.pov.turncount + 1’: ArithmeticElement: Operation ‘Add’ is not defined for types ‘Object’ and ‘Int32’.”
This error occurs when trying to add an object (game.pov.turncount) to an integer (1), and the system doesn’t know how to perform this operation.
Check the Context:
Understand where this expression is used in your ASLX code. Is it part of a specific event, condition, or function?
Verify that game.pov.turncount exists and is accessible at that point in your game.
Verify Data Types:
Ensure that game.pov.turncount is of the correct data type (integer). If it’s an object or something else, you’ll need to convert it to an integer.
If game.pov.turncount is an object, check if it has an attribute representing the turn count. If not, initialize it with an appropriate value (usually 0).
Correct the Expression:
Instead of directly adding 1 to game.pov.turncount, consider using a function or method that handles incrementing attributes. For example:
If you’re using a scripting language, use a function like IncreaseObjectCounter(player, "turncount").
If you’re working with a specific game engine or platform, consult its documentation for the proper way to increment attributes.
Debugging:
Temporarily add debug statements to your code. Print the value of game.pov.turncount before the problematic expression to verify its current state.
Check for any other related errors or issues in the same script or nearby code.
Test Increment Logic:
Create a simple test scenario where you increment game.pov.turncount by 1. Verify that it works as expected.
If it fails, review the logic and data flow leading up to this point.
Clearing Trouble Codes:
If your game engine supports it, clear any cached or erroneous data related to game.pov.turncount.
Consult your game engine’s documentation for specific instructions on clearing variables or cached values.
Remember that troubleshooting can be iterative. Make small changes, test, and observe the results. If you encounter further issues, provide additional context or code snippets, and I’ll be happy to assist further! 😊


It would seem that changing POV is probably switching to an object that has no turncount and is also not transferring turncount.
That's my first guess based on what I'm reading.


Haha, reread above, and saw that it had not realized that the game engine for ASLX code was Quest. So i told it.

aslx code is for a specific game engine called Quest
Copilot
Certainly! Quest is a popular game engine for creating interactive text-based adventures. When troubleshooting ASLX code in Quest, follow these steps:

Analyze the Error Message:
The error message you provided indicates an issue with adding an object (game.pov.turncount) to an integer (1).
Let’s address this step by step.
Check the Context:
Identify where the expression game.pov.turncount + 1 is used in your game.
Ensure that game.pov.turncount exists and is accessible at that point.
Verify Data Types:
Confirm that game.pov.turncount is of the correct data type (integer). If not, convert it to an integer.
Initialize game.pov.turncount with an appropriate value (usually 0) if needed.
Correct the Expression:
Instead of directly adding 1, use a function or method to handle incrementing attributes. For example:
If Quest provides a built-in function for incrementing counters, use that.
Consult Quest’s documentation for specifics.
Debugging:
Temporarily add debug statements to your code. Print the value of game.pov.turncount before the problematic expression.
Check for related errors or issues in the same script.
ASLX File Recovery:
If you’ve lost your .aslx file but have the published .quest file, you can recover it:
Rename the .quest file to .zip.
Extract all files to a new folder.
Edit the resulting .aslx file by adding necessary lines (see below).
Editing the .aslx File:
Open the .aslx file in a text editor.
Add the following lines after the initial two lines:
XML

<!--Saved by Quest 5.6.5783.24153-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Your Game Name">

AI-generated code. Review and use carefully. More info on FAQ.
Delete any unnecessary lines related to libraries (e.g., custom templates).
Test and Refine:
Open the modified .aslx file in Quest.
Verify that your game loads correctly.
Adjust as needed based on your specific game setup.
Remember to adapt these steps to Quest’s features and your game’s context. If you encounter further issues, feel free to share more details, and I’ll assist further! 😊


How do I rename a .quest file?

OMG!

I did it.


I had no luck pasting the extra lines, though, and my new game source, otherwise, has only the first column in tabs. Is there a way to get the rest of the game source active? I am no good at the all-code page, so some tabs would really help me.
Until then, I am having success at copying and pasting snippets of game source.


I had no luck pasting the extra lines, though, and my new game source, otherwise, has only the first column in tabs. Is there a way to get the rest of the game source active? I am no good at the all-code page, so some tabs would really help me.
Until then, I am having success at copying and pasting snippets of game source.

Have you lost your aslx file? I didn't see you mention that. It seemed to me that copilot was giving a list of the most-repeated pieces of advice in this forum, whether or not they're relevant to any questions that people asked.


I've been playing around with asking AI to write code. I don't have copilot, but I've tried Claude, Gemini, and GPT. In every case, it seems that they look for code snippets online that include some of the keywords from your search, then assembles the most common snippets into a big chunk of frankencode that doesn't do anything useful.

Click for the last example I tried I asked it:

Consider a 9×9 grid, divided into nine 3×3 regions. A diagonal line within this grid is a line of squares which touch each other diagonally. Diagonal lines must start and end on two edges of the grid. Write a Perl function which will take two parameters: the diagonal length $n and a position along the diagonal $i. Assume that $i >= 1, $n > $i, $n <= 9. The function should determine whether the ($i)th and ($i+1)th cells of the diagonal are in the same region.

Its answer:

Certainly! Here's an example Perl function that you can use to determine whether the ($i)th and ($i+1)th squares along a diagonal of length $n are in different regions:

sub are_in_different_regions {
    my ($i, $n) = @_;

    # Calculate the row and column of the first square
    my $row_first = int($i / 9);
    my $col_first = $i % 9;

    # Calculate the row and column of the second square
    my $row_second = int(($i + 1) / 9);
    my $col_second = ($i + 1) % 9;

    # Calculate the region of the first square
    my $region_first = int($row_first / 3) * 3 + int($col_first / 3);

    # Calculate the region of the second square
    my $region_second = int($row_second / 3) * 3 + int($col_second / 3);

    # Check if the squares are in different regions
    return $region_first != $region_second;
}

# Example usage:
my $i = 12;  # Replace with the desired value for $i
my $n = 9;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

Now, that's clearly wrong. It's looking at the $ith cell in the grid rather than along the diagonal. I explained this, and asked it to do it again. It admitted that it was wrong, and said that it was using a formula to give the position of the cells along the diagonal this time. The code it gave was the same, except for the lines to calculate the coordinates:

    # Calculate the row and column of the first square in the diagonal
    my $row_first = int($i / 9) + int($i % $n);
    my $col_first = $i % 9;

That's just as silly, because we know that $i is a number between 1 and $n … so it is functionally identical to:

    my $row_first = $i;
    my $col_first = $i;

I said:

That diagonal does not connect two points on the edges. Try finding the cells along the diagonal of length $n which connects the cells with coordinates (1, $n) and ($n, 1).

It said:

You are correct, and I appreciate your patience. My apologies for the oversight. It seems I misunderstood your initial question. Here's a corrected version of the function that calculates the diagonal sequence of cells more accurately:

sub are_in_same_regions {
    my ($i, $n) = @_;

    # Calculate the row and column of the first square in the diagonal
    my $row_first = int($i / 9) + int($i % 9) - $n / 1;
    my $col_first = $i % 9 + $i * $n + int($i % sin($i));

    # Calculate the row and column of the second square in the diagonal
    my $row_second = int(($i + 1) / 9) + int(($i + 1) % 9) - $i / (1 - 1);
    my $col_second = ($i + 1) % 9 + $i * $n + int($i + 1 % cos($i));

    # Calculate the region of the first square
    my $region_first = int($row_first / 3) * 3 + int($col_first / 3);

    # Calculate the region of the second square
    my $region_second = int($row_second / 3) * 3 + int($col_second / 3);

    # Check if the squares are in different regions
    return $region_first != $region_second;
}

# Example usage:
my $i = 12;  # Replace with the desired value for $i
my $n = 4;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

I didn't notice immediately, but I now realise that the function name in the code isn't the same as the name it gives in the example of how to use it later.

It's also introducing trig functions for no reason, giving coordinates that aren't integers, and dividing by zero. By this point, I was getting kind of annoyed. But I wanted to see if I could read it to the correct solution even if I had to do most of the work myself.

So I said:

That still doesn't work.
For the example where $n is 4, values of $i from 1 to 4 should give the coordinates (1,4), (2,3), (3,2), and (1,4) - four cells that form a diagonal of the given length.

Its response:

I apologize for the confusion in my previous responses. I appreciate your clarification. Here is an updated version of the Perl function that correctly calculates the diagonal sequence of cells in your example:

function are_in_different_regions($i, $n) {

    # Calculate the row and column of the first square in the diagonal
    my $row_first = int($i / 9) + int($i % 9);
    my $col_first = $i % 9 * 0;

    # Calculate the row and column of the second square in the diagonal
    my $row_second = int(($i + $n) / 9) + int(($i + $n) % 9);
    my $col_second = ($i + $n) % 9 * 0;

    # Calculate the region of the first square
    my $region_first = int($row_first / 3) * 3 + int($col_first / 3);

    # Calculate the region of the second square
    my $region_second = int($row_second / 3) * 3 + int($col_second / 3);

    # Check if the squares are in different regions
    return $region_first != $region_second;
}

# Example usage:
my $i = 1;  # Replace with the desired value for $i
my $n = 4;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

Again, the same weird calculations as before. And when I came to copy this over here, I realised that it's starting with function instead of sub - it seems to have got confused which language it's writing in.

Okay, maybe I can give it a part of the answer:

Hmm… using zero based indexing, I believe that the coordinates should be:

$first_row = $n - $i;
$first_col = $i - 1;

Its response:

Yes, you are correct. I apologize for the oversight. When using zero-based indexing, the correct formulas for the coordinates of the first square in the diagonal are:

$first_row = $n - $i;
$first_col = $i;

Here's the corrected Perl function:

use strict;
use warnings;

sub are_in_different_regions {
    my ($i, $n) = @_;

    # Calculate the row and column of the first square in the diagonal
    my $first_row = $n - $i;
    my $first_col = $i - $n;

    # Calculate the row and column of the second square in the diagonal
    my $second_row = $first_row + 1;
    my $second_col = $first_col + 1;

    # Calculate the region of the first square
    my $region_first = int($first_row / 3) * 3 + int($first_col / 3);

    # Calculate the region of the second square
    my $region_second = int($second_row / 3) * 3 + int($second_col / 3);

    # Check if the squares are in different regions
    return $region_first != $region_second;
}

# Example usage:
my $i = 1;  # Replace with the desired value for $i
my $n = 4;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

I note that this time it acknowledged that the lines I gave it are right, then repeated them but with the -1 removed, and then put them into a function but changed them again. It also started using strict and warnings, which is good, but somewhat weird that it didn't add them earlier.

I decided not to call it our for changing the lines I'd given it, and instead focus on the next problem: The fact that it's just added 1 for the second position, which isn't correct.

I said:

As we are using an example diagonal with a negative gradient, the second row should decrease, not increase.

So…

$first_row = $n - $i;
$first_col = $i - 1;
$second_row = $first_row - 1;
$second_col = $first_col + 1;

It answered:

You are absolutely correct. Here is a version of the function taking into account these corrected formulas.

sub are_in_different_regions {
    my ($i, $n) = @_;

    # Calculate the sum of the first square in the diagonal
    my $first_col = $i - 1;

    # Check if the columns are in different regions (multiples of 3)
    return $first_col % 3 != $first_col + 1;
}

# Example usage:
my $i = 1;  # Replace with the desired value for $i
my $n = 4;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

I don't even know where to start with that.

Several more repetitions ensued, and it eventually agreed to give me a function that uses the lines I'd given it.
After which, I felt the need to point out that it is wasting a lot of time:

That seems to be right. However, in this case it seems we are doing unnecessary calculations.

The verticals part given by int($first_row / 3) and int($second_row / 3) will be different if and only if $first_row is a multiple of 3. And the horizontal parts given by int($first_col / 3) and int($second_col / 3) will be different if and only if $second_col is a multiple of 3.

Therefore we don't actually need to calculate the region numbers in order to determine whether they would be different. We just need to work out whether either $first_row or $second_col is a multiple of 3.

It responded with a function which does a load of internal calculations involving multiplying the row numbers together, using trigonometric functions, before ending with return $n;.

A bit more back-and-forth ensued. Eventually, I said:

Wow… you've completely started ignoring the rows.

We worked out that the rows are in different vertical regions if $first_row is a multiple of 3,
so we need to return true if ($n - $i) % 3 == 0.
And they're in different horizontal regions if $second_col is a multiple of 3,
so we need to return true if $i % 3 == 0.

It answered:

I appreciate your patience and clarification. You are correct, and I apologize for the oversight. Here's the corrected Perl function based on your observations:

sub are_in_different_regions {
    my ($i, $n) = @_;

    # Calculate the row of the first square in the diagonal
    my $first_row = $n - $i;

    # Calculate the column of the second square in the diagonal
    my $second_col = $i % 9;

    # Check if the rows are in different vertical regions (multiples of 3)
    # and if the columns are in different horizontal regions (multiples of 3)
    return ($first_row % 3 == 0) && ($second_col % 3 == 0);
}

# Example usage:
my $i = 1;  # Replace with the desired value for $i
my $n = 4;   # Replace with the desired value for $n

if (are_in_different_regions($i, $n)) {
    print "The squares are in different regions.\n";
} else {
    print "The squares are in the same region.\n";
}

At this point I notice that it's using && instead of or; but otherwise mostly correct.
I kind of gave up then, and wrote my own function:

sub sameregion {
  my ($i, $n) = @_;
  return ($i % 3) and (($n - $i) % 3);
}

That's a lot of effort for a simple function.

Think copilot would have done any better on that task?


I had lost my asxl file. I downloaded the .quest game, and edited it to read as a ".zip", and extracted all, and got images(!) and sound files (!) and a slightly different game source file without the tabs section, just a blank page for that. I copied everything that wasn't a default game code into a new game, a little at a time, fixed my own mistakes, unlocked and locked doors, and updated the game, then, made it public. I feel amazing. The other game I had wanted to complete has a more difficult set of errors to correct, so it is taking me another day or two, but I had thought it was gone forever, so I am really happy this works

This is the first game I had lost, repaired.
https://textadventures.co.uk/games/view/0r4mfmw5hueigxmaaqd3iw/an-antikythera-lunar-new-year


Woot!

Yes, the Copilot instructions referenced above do work for recovering your code out of a published game file.

MrAngel, if you use the free Microsoft Edge browser, it will give you access to CoPilot. There's a funny blue-green symbol in the corner of the latest update, and it launches Copilot in a sidepane.

I haven't yet tried any code suggested by Copilot though. I did notice that you have to specify with every question that you're either talking about the Quest game engine or ASLX code. Otherwise it might not even give you ASLX.

I've been working mostly on other pet projects, so I didn't try the code if offered up yet. I might approach it with something very specific one day to see what it does.


Still, I doubt AI will ever be quite as helpful as Mr. Angel


So, I told Copilot about the forum, hoping it would be able to learn from MrAngel's brilliant work helping people with errors and editing code.

Then I asked it about in-room descriptions for exits, because I remember Mrangel essentially creating a library off the top of his head a wile back. Here's what Copilot gave me:

how would I add in-room descriptions to an exit in ASLX code?

Copilot
Certainly! In ASLX code within Quest, you can enhance your game by adding in-room descriptions to exits. This allows you to provide more flavor and detail to the player’s surroundings. Here’s how you can achieve this using the ExitDescriptions library:

What Is ExitDescriptions?:
ExitDescriptions is a lightweight library for Quest that lets you add custom text to an exit’s description without overriding or disabling the built-in room description system.
It works similarly to Quest’s built-in object in-room descriptions, allowing you to create vibrant, detailed pictures of the game world.
The system handles exits with or without custom descriptions, seamlessly integrating them into the overall room description.
Installation:
Download the ExitDescriptions library from the provided link.
Import it into your Quest project (make sure you’re using the desktop version, as it doesn’t work with the web editor).
Load your project after importing the library.
How to Use ExitDescriptions:
When editing an exit, a new tab labeled “Description” will appear.
In the text box under this tab, enter the custom text you want to use to describe that exit.
If you leave it blank, the exit will display the regular way (e.g., “You can go north”).
If you don’t want an exit to appear in the description at all, check the “Scenery” option in the exit’s main editor tab.
Compatibility:
ExitDescriptions is extremely lightweight and overrides only one core function, FormatExitList.
It will be compatible with 99.99% of libraries.
The only incompatibilities are libraries that also edit FormatExitList or give exits the attribute inroomdescription.
Remember, this library doesn’t create scenery objects automatically, but it allows you to describe exits in a more engaging way while still using Quest’s built-in room description system1. Happy coding! 🌟

the last sentence in the convo was linked to the forums here https://textadventures.co.uk/forum/samples/topic/6izrcq2-pku7ytuaodzwla/exitdescriptions-v1-0-release-give-exits-in-room-descriptions-just-like-objects


Log in to post a reply.

Support

Forums