problems

Pertex
19 Jan 2011, 14:47
Hi Alexs,
I started programming some dialogs with Q5 and ShowMenu. There is still the problem with long lines. Its possible to resize the box manually, but could Q5 resize the box to the complete size? Or to use a line break?
And its not possible to use german umlaute öüä in the menu.

Is it /will it be possible to read data from a file?
Image1.jpg

Alex
19 Jan 2011, 18:55
I've logged the menu caption issue here: http://quest.codeplex.com/workitem/527

You can use those characters in menus. If you're getting an error when Quest tries to load your XML file, ensure that it is saved using UTF-8 encoding. In the attached test game you can type "test" to see a menu showing these characters:



I may add a feature to read/write external files... it has been requested in the past. But what would you use it for? (Bear in mind that we want to have games that work when played online as well)

Pertex
19 Jan 2011, 20:00
Alex wrote: I may add a feature to read/write external files... it has been requested in the past. But what would you use it for? (Bear in mind that we want to have games that work when played online as well)


In fact, it is only the reading of files I am interessted in. Dialogs can be pretty voluminous, but I dont want to write code like "dictionary add(...........)" all the time in the aslx. So I thought it would be nice to read the data from a file and create the dialogs dynamically. And the dialogdata is seperated from the ASLX-File, so you can test changes with an extra test.aslx easily. And it can be loaded on demand so you dont have to load this at the start of the game.

Pertex
20 Jan 2011, 14:35
I found something new:

<function name="dialog" >
input=DictionaryItem(man.knowledge, "2")
test=split(input, "||")
foreach (key, test) {
msg (key + ": " )
}
</function>

<function name="dialog2" >
test=split(DictionaryItem(man.knowledge, "2"), "||")
foreach (key, test) {
msg (key + ": " )
}
</function>

dialog works fine, dialog2 says "Error running script: Error compiling expression 'split(DictionaryItem(man_knowledge, "2"), "||")': FunctionCallElement: Could find not function 'split(Object; String)' "

Alex
20 Jan 2011, 14:56
The clue is that it says it can't find a function "split(Object; String)" - this is because the split function takes two strings.

It's looking for a version that takes an object because you're passing in a call to DictionaryItem - see http://quest5.net/index.php?title=DictionaryItem

If you use StringDictionaryItem instead, this will work.

(The reason your first example works is that "input" is set as a string before it tries to compile the "split", so it knows to look for the "string, string" version.)

Pertex
21 Jan 2011, 10:17
ah yes, the wiki is my friend, I should read it :D Thanks

Could you tell me, how to cast variables (int->string, string->int)?
Here is my problem:

test = NewStringList()
...
count=4+ListItem(test,0)

Alex
21 Jan 2011, 19:42
I've updated the Technical Preview and added some new functions for you...

ToInt
ToString
IsInt

and I've added documentation on the wiki.

Pertex
21 Jan 2011, 20:44
You are great! Thank you

Pertex
05 Feb 2011, 16:06
Hi Alex, could you check my dummy.aslx please? The switch-command in function blabla always starts the default-script
Thanx
Pertex

Alex
05 Feb 2011, 16:41
You're missing brackets around the "case" in your "blabla" function.

You have:

case 1 {msg("one") }

But it should say:

case (1) {msg("one") }

Pertex
06 Feb 2011, 21:26
aaarggh, yes its true :oops:

I hope my next question is not as foolish as my last one. I want to compare to variables not to be equal. <> and != is not working. Could you help me? I didnt find it in the wiki

Pertex
07 Feb 2011, 09:22
With the walkthrough-command you can execute a list of commands to simulate playing the game. Does this work with menus, too, when you have to choose between several options?

Alex
07 Feb 2011, 21:05
The syntax for "not equal" is <>

But, any time you use these characters in a script you have to surround that bit of XML with a <![CDATA[ ... ]]> section, as otherwise the XML parsing will fail.

For example:


<script>
<![CDATA[
if (1 <> 2) {
msg ("values are not equal")
}
]]>
</script>



Regarding walkthroughs, they currently don't handle menu selections, but this will need to be implemented. I've logged an item on the Issue Tracker: http://quest.codeplex.com/workitem/544

Pertex
05 Apr 2011, 11:15
Hi ALex,
if you load an ASLX-file with XML-errors, you get the message: "Failed to load game. The follwing errors occured. Invalid XML...." If you change the ASLX-file now(at the moment with a texteditor), you cant save the file, because it is locked by Quest. Is it possible to unlock the file after displaying the error-message in Quest?

Alex
05 Apr 2011, 11:49
Thanks for reporting that bug, I've now checked in a fix.

Pertex
06 May 2011, 20:23
Its not a problem but a questions. I try to test the hyperlinks as shown in the demo. Exits are ok, now I want to test it with objects like this

<object name="Raum1">
<start/>
<inherit name="editor_room" />
<descprefix>You are in</descprefix>
<description><![CDATA[
A nice room. You can go to <exit>south</exit> and you see an <object>apple</object>.
]]></description>
<exit alias="south" to="Raum2" />
<object name="apple">
<displayverbs type="list">Look at; Eat</displayverbs>
<inherit name="male" />
<inherit name="editor_object" />
<take />
</object>
</object>

When I click on apple, Q5 always looks at the object, but it doesnt display the displayverbsmenu. Isnt this yet implemented or is there something wrong with my code?
CU
Pertex

Alex
07 May 2011, 18:50
The XML in your <description> tag is sent directly to the Player, and so the <object> tag needs to include the display verbs for them to be shown (since the Player doesn't know anything about what you're outputting).

If you look in CoreDescriptions.aslx you'll see how this is done by default. At the bottom is the GetTaggedName function, and it outputs the displayverbs in a "verb" attribute, as a string delimited by forward slash "/" characters.

For example:


<object verbs="Look at/Eat/Take">apple</object>


So at the moment you have to specify the verbs manually if you're using manual room descriptions.

We'll probably need to add some helper functions to make manual room descriptions easier (and by "we" I realistically mean "I", though there's always the possibility that somebody else might like to implement this :) ). Maybe some special markup for manual description strings? Any suggestions welcome!

Pertex
07 May 2011, 20:22
Alex wrote:. Maybe some special markup for manual description strings? Any suggestions welcome!


Is it possible to start scripts with a markup?

Alex
07 May 2011, 23:27
I don't think I understand the question?

Pertex
09 May 2011, 06:44
If you click the link, a function is executed. So you would not need an object to create interaction.

You see <script function="doSomething">something strange</script>

Alex
10 May 2011, 08:31
Yes you can do that - you can call the JavaScript ASLEvent function. At the moment the only way to embed a call to ASLEvent would be to embed your own HTML using the insert command (http://quest5.net/index.php?title=Insert) but we could easily add a syntax like your example.

But that would still not solve the problem of a simple way to embed the object's displayverbs, because you'd still need to list them explicitly to get them to be passed to the UI.

Pertex
10 May 2011, 11:07
Sorry, I dont get this now.

Alex wrote:Yes you can do that - you can call the JavaScript ASLEvent function. At the moment the only way to embed a call to ASLEvent would be to embed your own HTML using the insert command (http://quest5.net/index.php?title=Insert) but we could easily add a syntax like your example.


Do you mean Javascript-functions? With the insert command you can insert a HTML-file with Javascript-code, which can be executed? I want to call an aslx-function.

Alex wrote:
But that would still not solve the problem of a simple way to embed the object's displayverbs, because you'd still need to list them explicitly to get them to be passed to the UI.


Do you mean this as a technical problem of Q5 or as a problem of the User in the editor?

Alex
10 May 2011, 14:16
With the "insert" command, you can insert HTML like this:


<a onclick="ASLEvent('someASLfunction', 'my parameter')">click this</a>


This will call the ASL function "someASLfunction" with parameter "my parameter".


Do you mean this as a technical problem of Q5 or as a problem of the User in the editor?



I mean as a problem for the user in the editor.

Pertex
10 May 2011, 15:35
Alex wrote:With the "insert" command, you can insert HTML like this:


<a onclick="ASLEvent('someASLfunction', 'my parameter')">click this</a>


This will call the ASL function "someASLfunction" with parameter "my parameter".


Cool. I will test this today.

Alex wrote:
I mean as a problem for the user in the editor.


Ahh, I see. I am writing my code in notepad++ so its not really a problem for me :D .
Perhaps you could do this: If a user selects a word in the descriptionfield of the editor, he gets a rightclick-contextmenu with 'displayverbs'. This option compares the selected text with the names of all existing objects with displayverbs. If there is a match, the user can choose 'replace text' and the markup will be inserted. Maybe he is able to add some new verbs from a list of all possible commands.

Pertex
11 May 2011, 08:24
Do I need the insert-command or can I do something like this:

<object name="house">
<alias>house</alias>
<description><![CDATA[This is a <a onclick="ASLEvent('test', 's')">house</a> ]]></description>
</object>

If I do so and click the link, the windowsdirectory is displayed in the gamewindow. Hmmm, isnt it a securityproblem, if you can call external content?

Alex
11 May 2011, 09:28
You need the insert command, because that will allow you to write any HTML to the game window.

You can't just put HTML in the "description" tag. Although it looks like HTML there, it is not HTML. It is a custom XML format which the PlayerHelper converts into HTML. That's why you can put Quest <object> and <exit> tags in there.

In that XML, the <a> tag only supports the href attribute at the moment, not onclick. So in your example the href is being set to an empty string, which will be the current directory of Blank.htm (the base HTML file for the Player window). That's why the webbrowser control is showing you a directory listing when you click the link.

I don't see this as a security risk (you can't do anything to the files from ASL - the page has reloaded so Quest's javascripts won't be loaded, meaning ASL can't interact with the page any more). But it's certainly undesirable to be able to navigate away from Blank.htm, so I've just checked in a fix for this.

Pertex
11 May 2011, 10:54
Alex wrote:You need the insert command, because that will allow you to write any HTML to the game window.


But you can call the insert-command only from a script, not from inside the description-tag itself?

Alex
11 May 2011, 11:31
At the moment, yes.

Pertex
19 May 2011, 19:23
new local build of Q5:
if you add something to the game (room,object) you get a message "Please enter a name for...". With Windows XP its ok, with Windows 7 the buttons "OK" and "Cancel" are hidden by the inputfield

Alex
19 May 2011, 20:37
Really? It's working fine for me, and I haven't changed that in the last couple of days. Are you using a high DPI setting in Windows or something like that?

Pertex
20 May 2011, 05:53
Perhaps my screenresolution of 1920*1080?

Pertex
20 May 2011, 13:06
Here is something, that is not clear to me. One room with 2 object with the same alias 'Object'. If you type 'take object' a menu opens with the two entries 'Object' in it. Is this menu needed if you click the link of one of this objects in the gamewindow or the displayverbmenu? Then it should be clear, which object is chosen.

Alex
20 May 2011, 14:35
When you click something in the verbs menu, you don't pass any hidden extra information to Quest. So, when you click "Look at", the command "look at object" is transmitted, and that is all - there's no extra info about the specific object which you clicked on.

I suppose the way to fix this would be to have another interface for passing these "commands" into the game. The game would still display "look at object" to give you some idea of what happened, but internally the object name would already have been resolved to a specific WorldModel object.

I don't think this should be a priority for v5.0, but if somebody wants to design and/or implement this then I'd be happy to assist.

Pertex
22 May 2011, 16:00
There is a problem with Strg+F4. If you run a game from editor and you use the menu 'Stop game' you come back to the editor. If you press the keys Crtl-F4, you come to the startwindow with the tabs play and edit. And there is a problem, when you load, then start a game and then make a click into the gamewindow, then Ctrl-F4 is not working.

And if you are in the CodeView, you can load an other game for editing, but in CodeView still the old game is shown. And if you change to the "normal" view, it shows the old game in the tree.

Alex
22 May 2011, 16:50

Pertex
23 May 2011, 13:35
You can set 'Player starts in this room' in every room. If you choose a new startroom, the old start-tag should be deleted

If you deselect the option 'Player starts in this room' Q5 saves <start type="boolean">false</start> in the file. It would be better/cleaner to delete unnecessary tags completely

I want to load my game but get a message "Failed to load game due to the following errors: No template named 'LockedExit'" Do you have an idea, what this means? I dont use locked exits in my game at the moment. I can create a new game withot a problem.

Alex
23 May 2011, 14:22
At the moment there's nothing "special" about the "start" attribute - so there's nothing to stop you applying it to multiple rooms. The Editor has no way of knowing that it should only apply to one room, as it's just an ordinary checkbox defined by CoreEditorObject.aslx.

I suppose one solution may be to have a way to specify a script to run when an attribute changes in the editor. After setting "start=true", iterate through all other objects and set "start=false" for them. That way the behaviour could be entirely defined within ASLX libraries.

We can't simply remove false attributes. Otherwise if an object inherits a type, and that type has a default boolean attribute which is "true", there would be no way of turning it off. I don't think there's any harm in leaving "start=false" explicitly - if you really want to remove it, you can go to the Attributes tab and delete it there.

"LockedExit" is a new template, so check you're using an up-to-date English.aslx. If you're using your own language template, I recommend now that all language templates inherit English.aslx themselves, so you have a default for any missing templates. See Nederlands.aslx for an example. (Also if you're using your own language template, I'd be very happy for contributions! The more languages we can ship with Quest, the better)

Pertex
23 May 2011, 14:44
Alex wrote: I don't think there's any harm in leaving "start=false" explicitly - if you really want to remove it, you can go to the Attributes tab and delete it there.

Its not only the start-attribute, scenery or locked exit is the same. I Think this will happen with every boolean attribute. But you are right, when working with the editor, its not a problem. I will work with an external editor, so it will be no problem, too. Only in CodeView, it could be a bit un-nice (as we say in german :-))

Alex wrote:
(Also if you're using your own language template, I'd be very happy for contributions! The more languages we can ship with Quest, the better)

:lol: I think you should check your email. I sent you a mail yesterday (?)/some days ago(?).

Isn't the still a ToDo within the english.aslx? And I think we need some more templates für the directions. I dont know how to translate the directions (north,south...)

Alex
23 May 2011, 14:53
Ah, thanks! It was in my spam folder.

Yes there is still a "to do" comment in English.aslx. It's only on the "turn off" command for some reason, and I can't remember what was wrong with it... I'll need to go through looking for all the "to do" comments in the source and ensuring there are Issue Tracker items for all of them, and delete the unnecessary ones.

How do other German text adventure games handle compass directions?

Pertex
23 May 2011, 19:33
Alex wrote:How do other German text adventure games handle compass directions?


Its of course the same but I have problems to work with them. First in the editor you only have the english aliases in the combobox.
And if I click on an exitlink in the game, I get "go Süden" in the gamewindow which does not work. Using Süden in the "Places and Objects"-pane is OK, but the compass does not show any direction.

Ah by the way, the buttons for new game and open game do not work in the editor

Alex
23 May 2011, 21:20
Thanks for this. I have now checked in some updates that should fix all of the above, so let me know what you think!

Pertex
24 May 2011, 14:41
OK, I will test it in the evening.

There is another thing. If you insert a new exit, in the left tree "Exit: (nowhere)" is displayed. If you set the TO-attribute with the combobox, it says "Exit: testroom" (for example). If you change the name of the exit to testname, on the left tree only "testname" is displayed, "Exit:" is missing

Alex
24 May 2011, 16:14
That is by design - the "Exit:" followed by the destination only appears for anonymous exits. Once you specify a name, it's no longer anonymous, so it just displays the name in the tree.

But it might be nice to visually distinguish exits somehow, maybe with an icon in the tree.

Pertex
24 May 2011, 20:14
Hi Alex,
fine to have the betaversion! Yes, exits are working now! When I first saw the displayverbmenu, I was not pleased with clicking a second time. But then an idea came to my mind, why not expanding the menu? Why not examining the exit? I added "look" to the the displayverbs and Q5 shows it in the menu. I added a look-script to the exit but this did not work ("I cant see this here"). Do you think its possible to add this functionality?

Now that beta1 is published, could I convince you to handle #623 in the near future? :D I am thinking of an game without the lines "You are in...", "You can see..." and "You can go...", only displaying the room- and the objects-descriptions.

Alex wrote:But it might be nice to visually distinguish exits somehow, maybe with an icon in the tree.

Yes, its a bit confusing to have different displays for exits. I lost the overview having only 2 rooms with 6 exits.

On problem with the Player: the header of the panes (Inventory, Places and Objects, Compass) can not be translated.

Pertex
25 May 2011, 13:28
here is the new version of the german languagefile

Alex
25 May 2011, 13:39
Thanks, I've checked this in.

I've just given you Developer permissions on CodePlex so you should be able to check in updates yourself if you prefer - any problems please let me know.

Pertex
25 May 2011, 15:31
Thanks, but how do I update files in CodePlex?

Alex
25 May 2011, 15:49
You need to use TortoiseSVN or something similar to connect - see the "Source control" section on http://quest.codeplex.com/SourceControl/list/changesets

After you've checked out the code using SVN, you can check in modifications if you're logged in to SVN using your CodePlex account.

Pertex
26 May 2011, 13:02
Pertex wrote:
Now that beta1 is published, could I convince you to handle #623 in the near future? :D I am thinking of an game without the lines "You are in...", "You can see..." and "You can go...", only displaying the room- and the objects-descriptions.


I think I did it (#623). Could you take a look and check the appended files?

Alex
26 May 2011, 15:26
Very nice! I think this is a nice example of what I've been saying for a while about how easy it is to extend the Core libraries.

Just a couple of small points. On a minor note, I'd probably name the property "appendobjectdescription" or something slightly more explicit. More importantly, I'd change this line in CoreDescriptions.asl a bit:


if (LengthOf(val.description)>0 and val.alias <> "me" and val.description <> val.look) {


I think you should check the type of the "description" property first, in case the user has changed it to a script. Because if they have, the call to LengthOf will fail.

Secondly, I wouldn't use the alias property to check that the object isn't the player, because the user might change that. You can use "val <> player" instead.

Thirdly, I'm not sure why you're comparing the "look" and "description" properties there? Presumably if the user wants to automatically add object descriptions to the room description, it's fine if "look at object" shows some text that has already been displayed?

So I think this may be better (not tested!)


if (HasString(val, "description") and LengthOf(val.description)>0 and val <> player) {


Please let me know what you think!

Pertex
26 May 2011, 19:50
Alex wrote:Very nice! I think this is a nice example of what I've been saying for a while about how easy it is to extend the Core libraries.


Yes, its really fantastic, that it is possible to add a checkbox (or other control) to the editor and all of its functionality without changing the code!

Alex wrote:Thirdly, I'm not sure why you're comparing the "look" and "description" properties there?


:lol: Because you wrote it in the issue tracker: " As suggested in the forum, ..., since an object's "look" property is separate from its "description" property, and the "description" property of a ...."

Alex wrote:Please let me know what you think!


Of course you are right, for that reason I asked you to review it. But I found one thing that is not ok. If you have "<description></description>" or "<description/>" within your object, Q5 throws an error. Do you have an idea how to change the if-clause to fix it?

By the way: what is a WPF Editor?

Alex
27 May 2011, 08:46
Maybe I should have explained more clearly - I just meant that an object has both "look" and "description" properties, but unless the object is a room, then its "description" property is (currently) unused. Which means we can use it to implement your suggestion :)

If you have <description></description> or <description/> then that property will be a boolean. I'd have thought the "HasString" part of the "if" would cover this. I'll take a look (as I said, I hadn't tested the code I suggested!).

Regarding your WPF question, there are two ways of creating user interfaces in .net - WinForms and WPF. Up until now I'd been using WinForms, but this a bit old and clunky sometimes. In the Editor, all the tabs are dynamically generated from the ASLX file, and I found some of the layout was a bit buggy at times, particularly when using the Script Editor. WPF is better than WinForms at laying out dynamic user interfaces, so would be a better choice for the Editor. I need to enhance the Script Editor to include an expression editor, so I'm redoing the various editor controls (textbox, checkbox, multi, stringdictionary, etc.) in WPF first so that we don't have a hard-to-maintain, flickery UI that draws its controls in the wrong place half the time.

I'm doing this work in the "EditorControls" branch, so trunk should remain stable. I'll merge the EditorControls branch back into trunk when I've reimplemented the controls, which will probably take a week or so.

Pertex
27 May 2011, 12:37
Uuuh, there is a heavy problem with xml in description-fields. If you insert "<object verbs="look/take">window</object>" into the description-field of the editor, Q5 doesn't show the menu, but only prints this text to the window.
If you use an external editor and write something like this
<description><![CDATA[This is a <object verbs="look/take">window</object> .]] </description>  

it works in the player but in the editor you see strange icons in the descriptionfields and many errors appear.

Is there a workaround or solution for this at the moment?

Alex
27 May 2011, 14:58
The rich text editor used for the <description> attribute currently only supports <b>, <u> and <i> tags. It uses an embedded web browser in edit mode, meaning that <object> tags will make it do strange things.

As a workaround, you can use a textbox instead. Open CoreEditorObject.aslx and find this block:


<control>
<controltype>multi</controltype>
<caption>Description</caption>
<attribute>description</attribute>
<types>
string=Text; script=Run script
</types>
<editors>
string=richtext
</editors>
<listwidth>150</listwidth>
<expand/>
</control>


This specifies to override the default string editor with a richtext control. So you should be able to either set "string=textbox" in the <editors> tag, or just delete the <editors> tag entirely.

Pertex
30 May 2011, 19:42
Is there something wrong with functions? Just start the appended game and type 'test'

Alex
30 May 2011, 22:31
Yeah there seems to be a bug around function calls at the moment. The problem is the brackets after the function call - if you change "SomeFunction()" to "SomeFunction" it works.

The problem is that it thinks the version with the brackets has one parameter, but your SomeFunction has zero parameters, so it fails when trying to populate the parameter list.

Alex
30 May 2011, 22:33

Pertex
16 Jun 2011, 19:54
Here I am with a curious problem. I have a game-file (dict.aslx) including a lib. There are the same string dictionaries in both files (with german Umlaute in it). The stringdictionary in the main file seems to be ok, the stringdictionary in the lib throws the error "Error loading XML data for...- enure that it contains no nested XML".

Second thing: If this error appears, you still can save the main-file in an external editor. The lib-file cannot be saved ("Please check if this file is opened in another programm").

Alex
17 Jun 2011, 07:41
Be careful with your encoding. Your lib file is not UTF-8 which makes it invalid XML. What are you using to edit these files?

Notepad++ is pretty good at telling you the encoding of a text file and letting you switch between encodings.

Pertex
17 Jun 2011, 08:15
Ahh yes. But is this perhaps a problem of Q5? I created a new game within Q5 and opened the file with notepad++. There it says it is ANSI-coded

Alex
17 Jun 2011, 09:02
If I paste the string "Cän I help yö" into the Editor and save it, the resulting file according to Notepad++ is "ANSI as UTF-8" which is fine - this is the encoding that works.

So I don't know how yours is ending up as just ANSI - are you editing it manually?

Pertex
17 Jun 2011, 11:13
Hmm, normally I copy a gamefile (created in Q5) and rename it and delete all unnecessary code to create a lib. And as I said, if I create a gamefile within Q5, notepad++ says it is ANSI-encoded. If I paste text into it, it is still ANSI-coded. If I transform it to UTF with notepad++, everything is ok and it stays UTF-8-encoded.
I cant find the display "ANSI as UTF-8" in notepad++ anywhere.

Alex
17 Jun 2011, 15:05
It's in the bottom-right of the status bar in Notepad++. In the Encoding menu it appears as "UTF-8 without BOM".

Pertex
17 Jun 2011, 19:29
Ahhh, now I got it. If you create a game in Q5 without changing anything, just saving, it is saved as ANSI. If you insert now öäü in the Q5-editor, Q5 changes this to ANSI-AS-UTF8.
But if you take the fresh generated und just saved game and insert öäü with notepad++, the editor saves it again as ANSI and after opening the file in Q5 you get the errormessages.

paul young
23 Jun 2011, 15:26
Hi Alex
Could you please tell me when you can run a Tutorial
for the beta.2.
I have programed a program on the 4.10 version and now i am having
to start all over again.

Hope you can help

Paul

Alex
23 Jun 2011, 15:30
I'll start work on the tutorial fairly soon - but of course I need to have the software reasonably complete first :) So hopefully within a month or two I'll start to work on something, probably over on the wiki to start with (http://quest5.net)

Pertex
25 Jun 2011, 16:35
Hi ALex,
do you mind me coding the objectdescription to Q5?

Alex
26 Jun 2011, 15:47
Yes please, that would be great!

Pertex
29 Jun 2011, 13:44
Hi Alex,
I am storing variables in objects like this:

<object name="testObject">
<dict type="stringdictionary" >
f=
</dict>
<test type="int">0</test>
<teststr type="string"/>
</object>

As you can see, string does not need a value. A Stringdictionary in contrast requires an inital value. Without a value Q5 reports a bug "missing =".
For scripting it would be a good thing to have an empty dictionary at start( <dict type="stringdictionary" /> ).Is it possible to change this?

Alex
29 Jun 2011, 16:59
OK, I have just checked in a fix.

Alex
01 Jul 2011, 09:25
Thanks Pertex for implementing the "room object descriptions" feature. I've made a few small tweaks but it all seems to be working well. Nice work!

Pertex
01 Jul 2011, 10:55
Thanx!
I tried to add some string-functions (trim, instrrev) to stringfunctions.cs, but this doesnt seem to work. Must I change an additional file?

Alex
01 Jul 2011, 12:29
Changing StringFunctions.cs should be all you need to do. Just make sure they're public static.

Pertex
01 Jul 2011, 13:38
Ok, just another question. I have this function:

<function name="test" parameters="size">
if (size=null) {
msg("empty")
} else {
msg("parameter")
}
</function>

I can call this function with test("1") and its working. If I call test(), I get a error. How can I check, if size is set?

Alex
01 Jul 2011, 13:57
There are no optional parameters, so you can't use test() - you'd have to use test(null)

Pertex
01 Jul 2011, 14:31
Bad luck! I just played with the scopefunctions of Q5 (scopevisible,...) and changed them in that way, that you can pass a parameter 'room' to them to get the scope of a spezific room. So I had to double functions and rename them.
Do you think there is a better way to add this to Q5? Or is it better to work with an external library?

Alex
01 Jul 2011, 15:44
I think something like this should be in the Core library.

I think the best way to do it would be a little refactoring. Keep the original functions (ScopeVisible etc) and have them call the new functions which take a room parameter (ScopeVisibleForRoom etc.)

So it would look a bit like this:

Current:


<function name="ScopeVisible" type="objectlist">
return (ScopeVisibleNotHeld() + ScopeInventory())
</function>


New - something like this:


<function name="ScopeVisible" type="objectlist">
return (ScopeVisibleForRoom(player.room))
</function>

<function name="ScopeVisibleForRoom" type="objectlist" parameters="room">
return (ScopeVisibleNotHeldForRoom(room) + ScopeInventory())
</function>


(not creating a ScopeInventoryForRoom in this example as that doesn't make sense, as the inventory doesn't depend on the current room)

Pertex
02 Jul 2011, 19:32
I added some functions to stringfunctions.cs. The problem is, that a new builded Q5 throws exceptions when opening or creating a game, so I cant test it. Perhaps you can have a look at the file and put it into the SVN?

Pertex
03 Jul 2011, 15:56
I changed the CoreScopes.aslx now. My tests seem to be ok, but I hope you will check it.
And I added the functions to the wiki. Is it possible there to create an list 'A-Z' with all functions (no categories or groups at all)?

Alex
03 Jul 2011, 18:27
Your changes to CoreScopes.aslx look good from what I can see (I've only looked over them, not tested them at all).

I have checked in your update to StringFunctions.cs - I couldn't see any particular problems, though I did fix one syntax error as otherwise it wouldn't build. You may see error messages when running a game using the very latest code, as the implementation of status variables is only half finished.

What are your thoughts about moving the code over to Github? I'm already finding it difficult to manage contributions on CodePlex - when I do an SVN update, it often doesn't pick up your changes and I have to do a fresh checkout! Github seems much better designed for this kind of thing - you'll be able to make changes and then send me a pull request, then I can review them before merging with the master branch.

Pertex
04 Jul 2011, 08:16
I do not know Github as I did not know Codeplex befor I discovered Quest. But this pull request sounds good. So if it does not delay the development of Q5 I would support the change

Alex
04 Jul 2011, 08:44
Cool. I've put the code in Github already - https://github.com/alexwarren/Quest

I'm currently still making changes in SVN on CodePlex, then pulling them across into Github, so the two are running side-by-side at the moment. It would probably be a good idea for you to create your own fork in Github, which you can make your own changes on. There's a bit of a learning curve (I'm learning it too) but I think it's worth taking the time to figure it out, as it will save time in the long run.

Pertex
05 Jul 2011, 20:08
So, after trying github I decided not to use it. I dont have the time to learn all this commands. The GUI is primitive (how do you start a pull request?) and there is not one good tutorial in the web.

Alex
05 Jul 2011, 20:59
Ah, that's a shame. To be honest it's quite a lot for me to learn as well.

I think I'll continue with CodePlex for now, but I'll continue to keep the Github mirror up to date (as it can directly take all SVN updates, so it will stay in sync easily). So if anybody wants to fork it and play around on Github, that should be possible.

In the meantime, I requested CodePlex switch the hosting over from SVN to Mercurial a few weeks ago. Mercurial is similar to Git, but it's much easier to use on Windows. Unfortunately it seems like CodePlex is really understaffed right now and they haven't got round to switching it over, so it looks like we'll be on SVN for a while yet.

Pertex
07 Jul 2011, 19:13
Codeplex is down so I post the bug here:
If you create an If within the editor with "If objectproperty Object expression mouse Property test=2" it creates the code
"if (mouse .test = 2) {"
with an blank between mouse and .test.
(Is it understandable what I want to say?)

Alex
08 Jul 2011, 08:18
Yes I understand - logged http://quest.codeplex.com/workitem/745

Pertex
13 Jul 2011, 11:09
This time I have a problem with timers and objects. If you start a timer and in the timerfunction an object is moved to another room via script, the "Places and Objects" -pane is not refreshed ( I think same with inventory or compass). If you type a command in the game while the timer is running, the pane is refreshed. Perhaps a new script-command is required to refresh the screen.

If you start the appended tut.aslx, you can type 'start' to start a timer and the object tree should be moved to your room.

Alex
13 Jul 2011, 12:19
Thanks. In Q5 the objects panes are only updated at the end of the turn - I need to update this so that they get updated when a timer runs too.

Pertex
16 Jul 2011, 16:36
I am trying to create a new command "attack" as descripted in the tutorial with a new created version of Q5


<command name="attack">
<pattern>attack #text#</pattern>
<script>
msg("attack")
</script>
</command>


but Q5 says "I don't understand your command."

Alex
16 Jul 2011, 16:40
That looks like it should work. Is the command in scope? If it has a null parent it will be in scope everywhere, but if it's in one room it will only work in that room.

Pertex
17 Jul 2011, 08:46
:oops: bull**** you are right. Sorry :oops:

Pertex
17 Jul 2011, 14:36
I try to write a function to set attributes to an object, something like that:

<function name="cmb_setAttrib" parameters="object,attrib,value">
if (cmb_chkObject(object)){
...
}
</function>


At the "..." I tried several commands like "object.attrib=value" but it does not work. Do you have a suggestion how to do it?

Alex
17 Jul 2011, 14:57
Assuming attrib is a string, you can use


set (object, attrib, value)


http://quest5.net/wiki/Set

Alex
18 Jul 2011, 08:50
Pertex, you've broken Deutsch.aslx by the way! :shock:

There are some funny characters in the XML for the new templates - between "template" and "name":


<template·name="NeutralPluralGender">sie</template>


Did you copy the lines from a diff tool I wonder?

Pertex
18 Jul 2011, 09:14
Yes I am guilty :oops: It was the diff-view of codeplex

How did you notice this bug. Are you using the german template?

Alex
18 Jul 2011, 09:18
It wasn't me that spotted it - I got an email from a German user who had just downloaded Beta 3.

Alex
18 Jul 2011, 10:29
To prevent this happening again, I've added some unit tests (more like integration tests really) which go through all templates, create a game with each one and attempt to initialise the EditorController. These tests will fail if there is any invalid XML in the templates.

Pertex
28 Jul 2011, 12:37
I read the following text on the homepage: "Every turn in the game is undoable, as the UndoLogger tracks all changes made while the game is in progress." Does this work with user-scripts, too? I have done a script for moving NPCs, where objects move in random times to other rooms. If I undo my moves, the moves of the objects will not be undone. Right?

Alex
28 Jul 2011, 13:03
I thought about the design of "undo" very carefully when it comes to timers. The idea is that when the player types "undo", the state of the game is rolled back to the point at which they typed the previous command.

So...

At time [1]:
> take thing
Thing is moved to the inventory.

Ten seconds later, a timer fires. The thing explodes.

> undo

Now you're back at time [1] again. Thing is unexploded, and it's not in the inventory any more.

So in your case, the NPCs will be moved back to the previous place when you type "undo".

Pertex
28 Jul 2011, 13:50
Does that mean, that Q5 saves a snapshot of the complete system every turn (objects, variables,...) for undo?

Alex
28 Jul 2011, 16:36
No, not a complete snapshot. The UndoLogger stores changes, and each change happens in the context of a transaction. A new transaction begins when you type a command. If you undo, all of the changes in that transaction are rolled back - so this will include any changes that have been made by timers since the command was typed in.

Pertex
28 Jul 2011, 18:57
ahh, thanks for the explanation

Pertex
31 Jul 2011, 17:04
grrr, I cant handle this Mercurial. I can see the history of the english.aslx but I can not update my local file. Dont know why.
I do not dare to checkin files, so I post Deutsch.aslx here. Perhaps you could check it and put it into the repository?
By the way, shouldn't the template EditorVerbDefaultExpression be a dynamictemplate?

Alex
31 Jul 2011, 22:40
Are you using TortoiseHg or the command line?

Either way you basically just need to do "hg pull", then "hg update". If you can see the history, it sounds like you've done the "hg pull" part, so you just need to "hg update". If you're using TortoiseHg you should be able to right-click the latest revision and select Update.

Alex
31 Jul 2011, 22:42
EditorVerbDefaultExpression is not a dynamic template - it's kind of a template for a dynamic template... it's only used by the Editor, and it populates the <defaultexpression> attribute for a new verb, which is itself an expression.

Pertex
03 Aug 2011, 07:03
Hi Alex, in the wiki there is a howto-section now. Do you want us to post our libraries there or would it be better to do this in the forum (perhaps after changing the structure of the forum)?

The Pixie
03 Aug 2011, 07:34
The "How to" was my idea. There were fairly basic things I wanted to do in my game, and it took some working out how to do it. I figured that if I write it down and put it all in one place, it will be that much easier for others.

I appreciate that does not answer your question, but hopefully it gives some context to it at least.

Pertex
03 Aug 2011, 08:08
OK, but I think such a Howto will grow wildly and will hold redundant information (as "implement containers - See tutorial"). Informations like "use verbs" or "use functions" should be moved to the tutorial.
"implement a journal" sounds interesting for my game :-) Dont you want to write a library so that other people could use it,too?

By the way, Alex, will it be possible to create libraries within Quest?

Alex
03 Aug 2011, 08:21
I'd like to set up an area for libraries, probably on the main textadventures.co.uk site. So please email me if you want to submit a library and I will add it to a new section.

I don't plan to add library editing features to the editor in this release, but maybe in a future version.

Pertex
03 Aug 2011, 09:01
Alex wrote:I'd like to set up an area for libraries, probably on the main textadventures.co.uk site. So please email me if you want to submit a library and I will add it to a new section.


I think this wouldn't be the best solution. There will be questions of users, tipps and begs to enhance libraries, new versions of the lib,you will need a documentation of the lib... It would be greater to be more flexible

Alex
03 Aug 2011, 10:14
The wiki will be good for library documentation - we can link to it from the "library archive". I'd just like something a bit more structured for libraries on the main site, something similar to the games archive, because eventually I'd like all libraries to be accessible from within the Editor. You could go to an Add Library window, see all available libraries, and download them straight into your game.

But for the moment, yes I suppose we could just do the whole thing via the wiki. Maybe we should set up a Libraries Forum... but first we just need some libraries! We can work out exactly how best to manage things as we go along.

Pertex
03 Aug 2011, 18:47
The number of libraries is not the problem, but writing of documentation in english is :D


Other question. I have problems with the type of objects in german. Several types have the same article and gender, so I cant use them as you did in the english.aslx (function Conjugate). Is it possible to add an attribute to the types in coretypes.aslx? Something like

<type name="maleplural">
<displayverbs type="list">[LookAt];[SpeakTo]</displayverbs>
<gender>[MalePluralGender]</gender>
<article>[MalePluralArticle]</article>
[b]<xtype>maleplural</xtype>[/b]
</type>

This could be read by script.

Alex
04 Aug 2011, 08:32
Good idea. I think it would be even better to have a function that tells you generally if an object inherits a particular type name, then we wouldn't need the dummy "xtype" attributes at all.

Logged http://quest.codeplex.com/workitem/837

Pertex
07 Aug 2011, 16:22
I try to create a new command:
  <command name="merken">
<pattern>merke #blabla#</pattern>
<script>
msg (blabla)
</script>
</command>


This returns: "Error running script: Unhandled command variable 'blabla'"

If I use the pattern <pattern>merke #text#</pattern>, it seems to be ok. So only the variable text is allowed in commands?

Alex
07 Aug 2011, 17:01
The variable must start with either "text" or "object".

I think this is simpler than the Quest 4 approach of using an "@" character to denote an object variable in a command pattern.

The Pixie
13 Aug 2011, 21:21
I have found a bug. If youy create a string list as an attribute, it gets an empty string added to it (NewStringList works okay).

Simple adventure to illustrate. List 1 is an attribute, and gets this extra empty string, list 2 is not. Invoke the test command to see.

<!--Saved by Quest 5.0.4239.31339-->
<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="StringListTest">
<start type="script">
player.list_2 = NewStringList()
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<list_1 type="list"></list_1>
</object>
</object>
<command name="test">
<pattern>test</pattern>
<script>
Test
</script>
</command>
<function name="Test">
msg ("count for list 1 is " + ListCount(player.list_1))
msg ("count for list 2 is " + ListCount(player.list_2))
msg ("first element of list 1 is " + StringListItem(player.list_1, 0) + ".")
</function>
</asl>

The Pixie
14 Aug 2011, 18:59
Another one I think (though this could be by design). A template that is invoked using square brackets in a library cannot be overriden.

Here is a simple library.
<library>
<template name="Test1">This is test 1</template>
<template name="Test2">This is test 2</template>
<command name="test1">
<pattern>test1</pattern>
<script>
msg ("[Test1]")
</script>
</command>
<command name="test2">
<pattern>test2</pattern>
<script>
msg (Template("Test2"))
</script>
</command>
</library>

The Test1 template cannot be overwritten in the users code, as it is used with square brackets. Test2, invoked with the Template function, works properly.

Example code tp illustrate that when run.
<!--Saved by Quest 5.0.4239.31339-->
<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="Template Test_lib.aslx" />
<template name="Test1">This is test 1 again</template>
<template name="Test2">This is test 2 again</template>
<game name="Template Test" />
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
<walkthrough name="test">
<steps>
test1
test2
</steps>
</walkthrough>
</asl>


ETA:
This means that text in an XML element cannot be overridden, eg:
<unresolved>[BuyItemNotKnown]</unresolved>

The Pixie
14 Aug 2011, 22:12
Here is another. If you create an exit with the create exit command in a diagonal direction, the abrievation does not work.

Here is some quick test code.
<!--Saved by Quest 5.0.4239.31339-->
<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="create_exit_test" />
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
<object name="room2">
<inherit name="editor_room" />
<exit alias="east" to="room">
<inherit name="eastdirection" />
</exit>
</object>
<object name="room3">
<inherit name="editor_room" />
<exit alias="southeast" to="room">
<inherit name="southeastdirection" />
</exit>
</object>
<command name="create">
<pattern>create</pattern>
<script>
create exit ("northwest", room, room3)
create exit ("west", room, room2)
</script>
</command>
</asl>

Go into player mode and type "create". Two exits are made. The one to the west can be used with "w" or "west", the one to the northwest only works with "northwest", not "nw".

Alex
15 Aug 2011, 11:18
Thanks, I've logged #874 and #875 on the Issue Tracker.

Pertex
09 Sept 2011, 05:58
Hi Alex, could you check the appended game? It worked with the german languagefile, then I changed it to english within the editor and now I get the error
"System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at AxeSoftware.Quest.LazyFields.Resolve(ScriptFactory scriptFactory)
at AxeSoftware.Quest.GameLoader.ResolveGame()
at AxeSoftware.Quest.GameLoader.Load(String filename)
at AxeSoftware.Quest.WorldModel.InitialiseInternal(GameLoader loader)
at AxeSoftware.Quest.WorldModel.Initialise(IPlayer player)
at AxeSoftware.Quest.Player.FinishInitialise()
at AxeSoftware.Quest.Player._Lambda$__28()"

Alex
09 Sept 2011, 08:48
maleobject and femaleobject are not defined in English.aslx. If the objects are "man" and "woman" they should be "male" and "female" instead.

The Pixie
10 Sept 2011, 08:56
Quest just crashed on me (specifically, it hung as I went from code to GUI) and I am suspicious if there is still a memory leak. Task Manager said it was using >800 Mb when it crashed, when I started it up again (and loaded the same game), it was only 212 MB

Alex
10 Sept 2011, 10:34
Sounds like a memory leak. Can you consistently reproduce it when switching back and forth between code view? It would also help if you could send me the .aslx file you're using.

The Pixie
11 Sept 2011, 14:20
I may be missing something here, but I would assume that if you set the fond size to game.defaultfontsize, then it reverts back to what was set on the display tab for the game object. Instead, SetFontSize seems to change game.defaultfontsize.

<!--Saved by Quest 5.0.4259.15119-->
<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="FontSize">
<defaultfontsize type="int">11</defaultfontsize>
</game>
<object name="room">
<inherit name="editor_room" />
<description type="script">
SetFontSize (14)
msg ("My Title")
SetFontSize (game.defaultfontsize)
msg ("game.defaultfontsize = " + game.defaultfontsize)
</description>
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>

The Pixie
11 Sept 2011, 15:11
Another one; it does not seem to be possible to turn off hyperlinks for objects.

And another. If you have a take message (say), and then delete it, you end up with an empty attribute. When the player takes the object, the empty string gets displayed instead of the proper default text.

The Pixie
11 Sept 2011, 19:56
Another annoying error message is "Error launching game: The given key was not present in the dictionary" If it could just say what key it would be so muuch easier to debug.

Alex
12 Sept 2011, 10:40
Changing the font attributes is by design. The attributes are perhaps a bit misleadingly named, but they have to be updated when the font changes, so that if you save and re-load the game, the updated font is set.

The hyperlinks option does seem to be broken - I've logged http://quest.codeplex.com/workitem/893

Yes that "given key was not present" error message is annoying - that's one of the built-in .net ones. If you let me know what situations this occurs in, I can update the Quest code to catch the error to display a more meaningful message.

Pertex
15 Sept 2011, 10:31
Hi Alex,
I need a scopefunction, which returns all objects of an room, even if the object is in an object (is in an object...). Do you have an idea, how I could do this?

Edit: OK, I think I found it:


foreach (x,AllObjects() ) {
if (Contains(room, x)) {
msg(x.name)
}
}

The Pixie
17 Sept 2011, 14:44
Here is a bug, albeit it a trivial one. The RandomChance function actually gives a certain chance out of 101, not 100. Thus, RandomChance(100) has a 0.9 % chance of returning false.

Should be:

GetRandomInt(0,99) < percentile

Alex
18 Sept 2011, 12:35

Pertex
22 Sept 2011, 09:29
Hi Alex,
I tried to create a command with an regular expression like this:

 <command name="test">
<pattern type="string"><![CDATA[^(test|teste) (?<text>.*) ]]></pattern>
<script>
msg ("This is " +text)
</script>
</command>


Q5 returns "I don't understand your command." Whats wrong with my command?

Alex
22 Sept 2011, 09:54
Could be the space before the end of your CDATA.

Pertex
22 Sept 2011, 10:47
Yes, you're right

spiderslayer12
22 Sept 2011, 17:45
omg Alex you're my hero.

Pertex
26 Sept 2011, 14:31
Hi Alex,
I have this code:

pressKey
MoveObject (player, S1_Platz)
pressKey
MoveObject (player, S1_Garage)
pressKey
MoveObject (player, S1_Baracke)

foreach (x, ScopeInventory()) {
if (GetBoolean(x, "m_dontmove" )) {
MoveObject (x, GetObject (GetString (x,"m_parent" )))
}
}

pressKey
MoveObject (player, S1_Garage)
pressKey
MoveObject (player, S1_Platz)
pressKey
MoveObject (player, ort)

If a player has objects in his inventory when coming to a special location, the script moves him back to an other location where the objects are moved into a container. Then he is moved to the other location again. When doing this, the panes are not refreshed, so the player can see the object in his inventory until the script ends (and the compass is not refreshed when he changes the room). Is there a refresh-command in Q5, something like request (refresh, "Panes") ?

Alex
26 Sept 2011, 15:53
There's no way of forcing a refresh at the moment. I think the correct fix would probably be to update the lists when a script pauses for a keypress?

Logged http://quest.codeplex.com/workitem/910

Pertex
26 Sept 2011, 18:43
Alex wrote:There's no way of forcing a refresh at the moment. I think the correct fix would probably be to update the lists when a script pauses for a keypress?


Yes, this would be fine

Pertex
17 Oct 2011, 14:22
Hi Alex,
there seems to be a bug when playing WAV-Files (perhaps mp3, too). If you dont have any outputdevice like loudspeaker at your computer, the game freezes.

Alex
17 Oct 2011, 16:28
Is that only when the "wait for sound to finish before continuing" is turned on?

Pertex
18 Oct 2011, 06:03
Right

Alex
18 Oct 2011, 08:22

Pertex
19 Oct 2011, 11:06
I created an object 'table' which is a container surface. In it there is another object 'paper'. The surface is open and it hides children until object is looked at.
When I start the game, the paper isn't visible. If I look at the table now, the paper is added to the object pane correctly, but the look-command says "Nothing out of the ordinary" instead of saying something like "There is a paper on the table." Is it possible to change this?

Alex
19 Oct 2011, 13:29
Under the "hide children" option, turn on the option "list children when object is looked at".

Pertex
21 Oct 2011, 09:10
Ah yes, thanx. Now I have another question about containers. I have a locked container which can be unlocked with a key.
If this key is in my inventory, the command "unlock container" unlocks and opens the container. The problem is, that there is no hint, which object has been used as key. Is it possible to add something to the template so that Q5 displays "Unlocked (with object)" ? Or adding a "unlock #object# with #object2#"-command?

Alex
21 Oct 2011, 09:23
You could change the "unlock message".

Pertex
21 Oct 2011, 09:48
Ok.
I have defined a key with my container. Now I want to remove this key again. I can do this in the code view, but can I clear the combobox "Key:" in Q5?

I create an exit like this:


create exit ("Osten", S1_Office, H2_Officeinnen, "eastdirection")


Now I want to delete this exit again. How can I do this? destroy seems not to work. I think, there is a name of the exit missing in the create-command

Alex
21 Oct 2011, 10:50
You can't do it easily from the UI - I think the easiest thing would be to choose another key, or make the container not lockable.

Alex
21 Oct 2011, 10:52
Yes, the "create exit" command doesn't let you specify a name - but I suppose it should.

So, to delete the exit, you need to "find" the temporary name for it, using the GetExitByName or GetExitByLink function.

The Pixie
21 Oct 2011, 10:59
I found it easier to have the exit in the game already, and move it to the appropriate location rather than creating it on the fly. This means you can set a name, and anything else, as normal.

Pertex
23 Oct 2011, 08:49
A small thing: Q5 does not understand 'use ... with ...' but in the template DefaultHelp it is mentioned

Alex
24 Oct 2011, 07:45