How to change the way Quest interprets this text...

So this is kind of strange and I have NO idea how to describe it in words.

This is the situation I need a game to check if this is true:

Cool, that works.

Now what if I want it to be able to check for multiple variables on the flight?

I could do this


...and it will get uselessly large as the game grows.
There must be a better way to do it right?

I wish the game would be able to recognize this


However, currently I do not see Quest being able to recognize what I am trying to do so it always throws an error.
Any advice to this problem?

I think what you want will be
if (player.col = GetAttribute(player, "StarCol"+number)) {
GetAttribute's second parameter is a string giving the name of an attribute, and is the usual way to do things if the attribute name isn't the same every time.

On the other hand, if you've got numbered attributes like that, it seems likely that the information you're storing might be better in a list. Could you make player.StarCol a list attribute, or a dictionary?

I am not sure if lists will work with what I am trying to do.

I have a complex script which uses those to draw a pseudo-map that is movable and all objects have to follow rules of my graphics script.

Okay, so I have clear idea in my mind what I need to be able to do with those attributes.

-Those attributes must be able to contain another set of attributes (So the star can have planets and the planets are of various types
-Those attributes must be randomly generated at first but then maintain whatever was generated so they remain persistent for the duration of the game session...

I do not know how will the final design even look so...

And I just checked and your if (player.col = GetAttribute(player, "StarCol"+number)) { does not work in my case, it just throws a lot of errors.

EDIT: Or maybe I am just using it wrong! I am still tinkering and I maybe might be able to get this to work so thanks for the advice anyway.

Do you at least know what you are going to do with your code?

Make a game obviously.

Before using GetAttribute, you'd probably have to use HasAttribute to check that the given attribute exists.

Okay mrangel this helped now I only need to be able to set the name of the object itself.

GetAttribute function only allows attributes to be changed by STRING plus whatever-else
Now I need something that would allow me to insert:


Any suggestions please?

GetObject turns a string into an object. So: "player"+1.attribute would be written as GetObject("player"+1).attribute.

In this case, GetObject will return null if there's no object of that name. You should check that the object returned is not null before you try to access its attributes.

The object is not null, but Quest somehow refuses to use the attributes throwing the "unknown variable or attribute..." error, even thought I am 100% sure that those attributes and objects exist at the moment that the function is used.

EDIT: Uh.. the object was actually null, disregard everything I say because I am a terrible coder.

Now I am not trying to disrespect the creators of Quest but I think I may have hit some boundary when it comes to loops.

I am able to set the same loop to work fine but once the loop is a part of a loop that is part of another loop the Quest just gets lazy and gets little bit screwy, I had this problem before with one of my games so I might be forced to make my design more light.

Quest doesn't have much to stop a loop. From what I've heard, putting a print message before and after can at least pin point where the problem is. Then you delete/change the code.

jmnevil54 got it right

unfortunately... you got to get creative (or simplistic) with your code design... as there's nothing that stops/breaks scripting...

This topic is now closed. Topics are closed after 60 days of inactivity.