advanced JS documents how do I set a variable?

Jennifer Wren
13 Sept 2023, 03:46

How would I word a document that set a variable attribute or else if not that set or unset an object flag?
This is what I tried. I'm not saying I know anything about code.

Object.defineProperty (player, direct, 1)

So, I wasn't surprised when it didn't work, but I would really like help finding out what does.


GamerOver9000
14 Sept 2023, 01:00

You can create a function in Quest and call it in the .JS file. Your Quest function must take a string parameter. You'll have to use ASLEvent("Quest Function Name", "string parameter") in the .JS file to call the function.

https://docs.textadventures.co.uk/quest/ui-callback.html


Jennifer Wren
14 Sept 2023, 01:53

Thanks for telling me how that's done! And thanks for the reference page, too. I really appreciate your help.


Jennifer Wren
15 Sept 2023, 21:07

The function is still blank. When I add ASLEvent("function name") above the compassClick script, the keys do nothing. When I add it below the compassClick script, the game asks me which south I want, SOUTHEAST OR SOUTHWEST. If I try to key for southeast or southwest whish have the same function but specify SE or SW, nothing happens, even though ASLEvent("function name") is beneath the compassClick script. Before I added ASLEvent("function name") southeast key and southwest key worked as keys.


GamerOver9000
15 Sept 2023, 22:01

When you say the function is blank, you mean you haven't put any code into yet? Did you pass in a string as the second parameter for the ASLEvent("function name", "string parameter")?


Jennifer Wren
15 Sept 2023, 22:53

No, I didn't pass in a second parameter. I didn't know I had to specify string.
That is probably what was wrong with my ASLEvents.
The reason I was getting a choice at trying to head south was that I had undone my adding the south direction to the game. I just added it.
I got around the ASLEvent script not working by adding a script inside the game that did the same thing in a different way.
I will have to try the ASLEvent script, as well, now that I know what went wrong for me.
Thank you.