where is the 'attributes' tab on web quest?

ej88
hiya,

i'm totally new to quest, and pretty excited about using it. however, i can't find the 'attributes' tab anywhere on the web version of quest. how do i create attributes, without something similar to what is visible here - http://quest5.net/wiki/Custom_attributes ?

i have had a long look on the questwiki and searching these forums, but can't find anything. i assume i'm missing something obvious?

thanks!

jaynabonne
I was personally shocked to discover that there is no support for editing attributes in the web editor. They seem so fundamental to everything...

So basically, you can't use the graphical interface to create or edit attributes. (The desktop version is fine.)

Also, attributes are created when they're first assigned to, so you can use script code to simply assign initial values (perhaps in the game start script). Not ideal, I know, but a workaround.

Grondhammar
Thread necromancy, I know, but this is exactly the question I had.

Is there any movement towards getting this implemented? I'd be happy to contribute to the effort myself, but the source code for the web version is (perhaps understandably with a server involved) not on github.

If this will not happen anytime soon, is there in fact a workaround? I attempted what jaynabonne suggested, but runtime kept throwing "Unknown object or variable '[var name]'" inside even a super-simple example game.

Silver
Well the object has to exist to put an attribute on it. So if you set an integer such as:

gun.bullets = 10

There has to be an object in your game called gun.

Alex
The code is on GitHub, it's the WebEditor project in the quest repository. There is in fact a half implemented attributes editor in there already - it was something I paid somebody on odesk to create, and it's very rough around the edges. I have some notes somewhere on what needs to be done to get it into shape if anyone's interested.

Grondhammar
Alex, thanks for the GitHub location. I'll take a look -- any particular file(s) or functions you could point me towards to get a grasp of what's there?

Silver's answer made me go look at my code again, and behold, a misspelled object name! How embarrassing... thanks for the reminder. That works perfectly.

Alex
OK, below is the info I originally sent to the ODesk contractor a couple of years ago:


First, some background. Everything in a Quest game is an element. All objects that appear in the game are elements, rooms are elements, the player is an element, even the game itself is an element.

All elements have attributes. The element's name is an attribute, its description is an attribute, any script attached to it is an attribute, etc.

When editing a game, you've seen files like CoreEditorObjectSetup.aslx which contain definitions for how the editor is layed out. This file specifies the type of controls that are shown for each attribute of an element. For example, an object's "name" attribute is editable with a textbox, which has the caption "Name".

In addition to the "friendly" layout of the editor, on the desktop version there's an "Attributes" tab for each element, which allows the user to go in and add, modify and delete all attributes directly. This control is loaded wherever <controltype>attributes</controltype> appears in an editor aslx file, and is always on the tab called "Attributes" which is currently hidden from the web editor - this is because the tab specifies the <desktop/> flag.

So the first thing to do is remove that flag. You'll then get errors when the editor is running because the "attributes" control does not exist in WebEditor, so you'll need to implement this control.

Implement the control by adding a new switch case to RenderEditorControl in ElementEditor.cshtml. Like the script editor, this should call an Action which will render a new partial view.

Look at WFAttributesControl in the EditorControls project to see the WinForms version of the attributes editor. It shows a list of all attributes for the currently selected element. When an attribute is selected, a "MultiControl" is rendered, allowing the user to set the type of the attribute and enter a value. We already have the concept of a MultiControl in WebEditor - see RenderMultiControl in ElementEditor.cshtml. I expect this will need to be refactored out of ElementEditor, so that the new Attributes partial view can access it too.

I wouldn't worry about the "Inherited Types" section at the top of the attributes control yet. We can implement this after we have implemented the attributes editor section itself.

One thing we will have to bear in mind is that the other editor tabs are all able to edit the same attributes. For example, when a user enters an Alias for an object on the Setup tab, that changes the value of the "alias" attribute. So, when the user clicks on to the Attributes tab, we need to ensure that they see the latest values there, and when they click elsewhere the attributes will need to be saved. Currently, elements are only saved when the user clicks on another element in the tree. We will need to change this so that the element is also saved when the user clicks on the Attributes tab, so then the attributes editor will be seeing the latest values.

I think that when the user clicks the name of the attribute in the attributes control, the multicontrol for that attribute should be loaded via AJAX. Then when they click on a different attribute name, it should be immediately saved.

That's quite a lot to think about so I hope I haven't overwhelmed you with information! I think we just need to break this up into steps. For now, I would just like you to:

- make the Attributes tab appear in the WebEditor
- create a very basic attributes viewer - not even an editor yet, so we'll just be listing the names and values of the attributes for the current element.

I think that will do to start with - then we can move on to actually making those attributes editable, and updating when and how the element is saved.



The contractor did indeed do some of that, but it doesn't work very well. If you grab the code and remove the <desktop/> flag from an attributes editor, you'll see the current state of things.

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

Support

Forums