Quest troubles...

I have been trying to figure something out but I just simply can’t do it. I have been trying to figure out how to utilize weight on Quest for my game but for the past few months I can’t seem to make the connection of turning weight into an attribute (or anything at this point). Scouring the questions sections has been a bit of a nightmare so I am hoping someone here ma have an idea.
Now currently I am trying to use the Health system to help display weight gain (kind of like Master of Flesh) after doing certain actions. While I can change how much food and other options will either increase/decrease I am trying to make so at certain health stages will offer different descriptions. For example stepping on the scale at 120 health will give one description, while having 180 health will give another description. Another thing I am trying to figure out with certain health stages that it will either allow or prevent the player from doing certain actions.
I am sorry if this bothers anyone, I have some idea of coding (needing certain items and how to make things vanish) but trying to figure out attributes looks to be a whole another beast.

Also I do understand there is a tutorial but once it got to the part I need it is throwing me off with the different values and the fact it is using weight in it, almost suggesting weight is already some predetermined value.

So you could use the prebuilt Health system if you’d like but just know that comes with a number of other things. Like the HP stat is percent-based, can’t go above 100 natively.
https://docs.textadventures.co.uk/quest/score_health_money.html

Anyway, though this question is really code-centric, I’ll tell you the basics you need to know with Quest (Quest is VERY friendly to new coders). There are certain attribute names that you can’t use (ex. “game”), but I have never had a problem with using “weight” - granted, I have never used the Inventory Limits feature in any of my projects so that may affect things if you are using it.

Attributes are just little pockets of information on what is called the parent object. They can store Boolean (true/false), String (a line of text), Integer (a whole number), Script (essentially a little function). This is a basic if/else.
image

In Quest, you’re going to do a lot of [Setting an attribute] and a lot of if/else statements. In this example, we tested to see if the object messyFloor’s presumably Boolean attribute cleanliness was true or false. Notice that neither true nor false are in quotation marks; that is because they are hard-coded, unlike strings. If we were testing for Strings on a String attribute, it might look like:
image

Take a look at this more on-the-nose example.
image
Let me explain: we have a character whose object name is fatty1. They have an Integer attribute called hunger that can be used to determine if they will eat when prompted (such as when you use the “feed” command, or whatever verb you program). The object fatty1 also has a stomach Integer attribute, used to aggregate the value of the Integer attribute of the object food1 and any other food they consume.

They - like all objects - have a display name under the String attribute alias. When combining strings, we use Print [expression], add String attributes and custom strings in quotes and add them together with + signs. We can make Print [expression] output a regular quotation mark ( " ) by adding a backslash ( \ ) before the mark, indicating that it is supposed to be printed like regular text.

You’ll also notice I used a few operators you might not recognize. When setting attributes or testing using if/else, <= means “greater than” in Quest, just like in math. Meanwhile, += means “add the right side of this equation to the attribute on the left side.” It’s called recursion. So:

thisAttribute += otherAttribute

is equal to:

thisAttribute = thisAttribute + otherAttribute

That’s the breakdown. For now, I recommend you emulate the simplest things about that:

  1. Set attributes
  2. Test for value of those attributes using If/Else
  3. Print messages and/or set other attributes based on test

There are more nuances but that will generally do everything you need at the start. Funny enough, Quest is what brought me into coding when I knew nothing at all, so it’s not a lost cause if it feels overwhelming. Just do the stuff that makes sense to you. The documentation is there when you need it.

1 Like

I hate to say this but it still isn’t working.
I went and tried to replicate the messy floor situation to see if that will help solve the problem, however the boolean version ran a script error while the string version only resulted in the “The floor is not clean or dirty”.
I understand the explanation but I can’t seem to apply it correctly. Also I think another problem (I forgot to mention) is that I am using the web version of the game and not the desktop.

2 Likes

That’s a good distinction. I would recommend the desktop version, personally, for a cleaner experience. The web version has no easy way to access an object’s attributes (as you can see from my first screenshot, it’s a lot clearer on desktop). You probably need to actually create that attribute before you set it.
https://docs.textadventures.co.uk/quest/tutorial/custom_attributes.html


Their example here should help. The problem with this method is, obviously, it’s really messy. You need to set attributes during game initialization. I have no idea why the web version of Quest is so incomplete but it leads to situations like these.

In your case:




I checked off Scenery because I did not want the floor to appear on the list of objects but to still be interactive by typing.

And also go into the Inventory tab and take out the Take display verb, just no reason to have it there.


What this example will do if you follow it the way I have written when you test it (which unfortunately is also a chore in the Web version) is: you will be in a room. If you type “Look at floor” it will read “A filthy tile floor.” If you clean it, that changes the String attribute to “clean”. Then, when you look at the floor again - since it calls the String attribute - it will read “A clean tile floor.”

That should give you a better understanding of setting variables using the web version. Sorry for the misunderstanding.

1 Like

Oh no don’t be, the fact I was able to get one of the strings to work (even if it wasn’t intended) is a lot better then having the past few months of trying script and it resulting in error.
After following your directions I finally had something work! It was very helpful, thank you very much.

2 Likes

This will probably be the last question, since quite a bit of everything else is fitting since then.

Currently I am trying to figure out how to switch characters in the game, and while I understand the ChangePOV command… it doesn’t seem to result in anything other than just say (I made the verb doing so this) “lend command” to the other character. The problem is I want the attribute for the both of them to be different (which doesn’t happen) so that it doesn’t then mess up the other characters when their attribute appears.

Sorry for disturbing anyone once again, but if I can figure this one final thing I think the rest of what I am making will fall into place. Though I understand if this is either impossible or difficult to pull off.

I’m having trouble replicating. By using the ChangePOV(desired player object) command, I am seeing my new player use the attributes of that new player object as intended. Not sure if I am reading you correctly, though.

Did you use player instead of game.pov? If you kept the original name of the player object = player and referenced the player object’s attributes, that would cause the problem that I think you’re having.

These guys gave a lot of resources for help on the subject thankfully: https://textadventures.co.uk/forum/quest/topic/sgaq3wiejkke_xjjnvrswq/choosing-changing-characters

On a related note, if there is ever a situation where you have code nested under an object and you want to reference that object but find yourself unable to because you don’t know what that object’s name is or will be, use this. That is Quest’s keyword solution you can use - for instance - for Object Types to give each object inheriting that class the same line of code referencing themselves. Example:

this.weight += 15

Hope you find a solution to that problem!

1 Like

Ah I figured out why, accidentally had the other player listed when the change happens. However the attribute is still shared between them, not sure if this is due the attribute in question (been using score in order to have events/descriptions to be trigger, since I still can’t make custom attributes to work) or if I need to set a second collection of code that triggers when that particular player is in command.

Edit: Also thank you again, looking at that page did give me the idea that I might of swapped the characters.

1 Like

No problem. In fairness, you’re being held back by using the Web version that artificially makes it harder for you to see and edit your attributes.

I understand the need to use Score since your custom attributes aren’t working, but just know there is a way to have custom attributes on each object even on the Web version. If you do want to give it a try, take a look at this page again and look at the section after the Desktop Version.

The web version has no easy way to access an object’s attributes (as you can see from my first screenshot, it’s a lot clearer on desktop). You probably need to actually create that attribute before you set it.
https://docs.textadventures.co.uk/quest/tutorial/custom_attributes.html

Like I said, those prebuilt systems like Health, Score, and Money come hardwired with a bunch of stuff to create straightforward text adventure games. Quest wasn’t built specifically for stuffing and weight gain, but instead just as an easily accessible point-and-click text adventure creator for aspiring authors. It’s just that our authors have always gotten creative with the system to make it work.

Don’t give up! What you’re trying to do is very much possible with basic Quest tools. The desktop version is way cleaner so do consider switching to that as a solution; other than that, I wish you good luck.

That’s the weird thing, trying to set up the attribute weight doesn’t seem to add anything to the game. Not only have I tried setting it like how score is set up, but I also did it where I add the attribute in the player page (in the game section) to see if that does anything but still nothing. I really don’t know what I am doing wrong, and it only keeps returning a script error on an unknown variable. That is why I am going with score since that seems to be working without trouble.
However I am trying to set it up so the score is different for each player, say player1 has a score of 50 but I want player2 to have a score of 100, so it doesn’t muddy possible results due to sharing the same score. I don’t know if this is limit with score itself or I’m not separating something correctly here since fiddling around the code is yielding nothing.

I would love to switch to desktop version, but sadly since my laptop may be used by other people they may not only see it but will try their best to figure out what is on it. To sort of keep another round of ridicule and jabs at me from happening I can’t think of even doing it (heck I already had gotten flak for downloading RotMG, even though they know I have been playing on and off for years).

1 Like

I wish I knew more about the Web version at the moment to help you. What you’re trying to do is not only possible but easy with Quest, if only you didn’t have that unfortunate situation of simultaneously learning Quest and working around the flaws of its Web tools.

Anyway, I believe what you are seeing could be fixed with some more visuals, otherwise you can continue with Score but… yeah, I do think the preset Score system is limited. And it’s probably constant between POVs. Continuing with your current system will require custom attributes, so one or the other will have to give.

If you feel like this doesn’t work for your situation right now: Twine has a cleaner Web creation tool but is more of a choose-your-own-adventure type of tool. Probably not what you are aiming for, but for the convenience of learning to code step-by-step, it is also a valuable alternative.

1 Like

Ah got it, well I still have quite a bit of time before the deadline I set up for myself. Just need to keep trying different things with either score to figure out why or to actually make working custom attributes.

Thank you very much, I probably would not have even made it this far without your help. Just got to figure out the how all the pieces fit and move from there.

1 Like

This will be the last time on the thread but I FINALLY FIGURED IT!

Okay the first problem that I running into was how score was being shared by everyone, the reason why is that I didn’t set up an initialization script on the player directly! Because I had it set up on the game section of the coding it regarded everything to share it, so score is possibly still an option to use.
However that is not all, I even figure out how to set up my own variables while doing this. Instead of using score I inputted “weight” (directly on the player) and set it up exactly how it was in the game section and after testing with other objects it worked perfectly! I would have gotten back sooner had it not been for the status display glitching due to me putting an actual number instead of an ! instead. After that everything else fell into place, needing to specify the exact character when an action is performed, setting values and conditions, EVERYTHING!

Thank you very much leifwarfer, this entire thread made the past few months worth it. Now I have the chance to make something, the only question now is whether it will be too big for Quest to handle.

1 Like

Awesome news, dude! Keep on working with Quest, figure out its limitations and their workarounds. With all the hate that it gets at times, making a few projects in Quest can prepare you for not only other interactive fiction creation tools (like TADS or Twine or even Inform 7), but it can also prepare you to code in other environments, too.

I didn’t know that about Score, so that is good. I’m glad you’ve unlocked that arcane Web developer, I know it was well beyond my scope when I started using Quest :joy:

Can’t wait to see what kinds of things you create!