Inline scripts within generic description text
BTownTKD
29 Jan 2013, 17:51I added this as a feature request on CodePlex, but I also wanted to check to see if perhaps this feature already exists, and I simply missed it.
Is there some way to embed inline scripts into generic description text? Perhaps using some script tags or escape characters?
For instance:
Is there some way to embed inline scripts into generic description text? Perhaps using some script tags or escape characters?
For instance:
You are in a cave.<% if(flashlight.IsActivated) { %> Your flashlight illuminates some <% ObjectLink("drawings"); %> on the wall. <% } %>
Alex
29 Jan 2013, 17:58I'm planning a feature like this for Quest 5.4 as I think this would be really useful too.
My proposed syntax is similar - your example would look like this:
Would certainly be grateful for any thoughts on this! What else would be useful? I'm thinking of allowing things like:
My proposed syntax is similar - your example would look like this:
You are in a cave. {if flashlight.IsActivated:Your flashlight illuminates some {object:drawings} on the wall.}
Would certainly be grateful for any thoughts on this! What else would be useful? I'm thinking of allowing things like:
You are at a crossroads. You can go {exit:east} or {exit:west}.
You can see a gun. Do you want to {command:pick up the gun}?
You can see a sandwich. It looks good enough to {command eat sandwich:eat}
You are in the garden. {once:It's cold here.}
BTownTKD
29 Jan 2013, 18:06Your syntax seems somewhat "custom," which may make it harder to implement. If you simply capture and run any valid script syntax contained within <% %> tags, you may make your own job easier, and the feature could become much more powerful. I'm not a web guy per-se, but I believe the <% %> tags are a standard convention used in ASP.NET server-side HTML generation, which I find to be identical (in concept) to generating a room description. Other programmers may latch more easily onto that convention.
EDIT
As I think of it, I'd be willing to bet there's some ready-to-use library, or built-in .NET class which can get you 90% of the way there, if you chose to use the .ASPX syntax. My initial Google searches haven't turned up a good result yet, but I also am not really sure what the 'proper' term is, for what I'm searching for...
I'm completely new to Quest, and am still gathering my bearing (as evident by my onslaught of newb questions), but I am a developer and .NET is my forte, so I'd love to contribute once I've gathered my bearings.
EDIT
As I think of it, I'd be willing to bet there's some ready-to-use library, or built-in .NET class which can get you 90% of the way there, if you chose to use the .ASPX syntax. My initial Google searches haven't turned up a good result yet, but I also am not really sure what the 'proper' term is, for what I'm searching for...
I'm completely new to Quest, and am still gathering my bearing (as evident by my onslaught of newb questions), but I am a developer and .NET is my forte, so I'd love to contribute once I've gathered my bearings.
BTownTKD
29 Jan 2013, 18:34AH-HA. Eureka!
What you need is a View Engine, for which there are many open-source libraries!
The WebFormViewEngine class is the one built into .NET, which uses the syntax I suggested originally.
Also noteworthy; the latest ASP.NET/MVC releases use the Razor view engine. It looks like you could easily pass the "Description" text into the engine, as well as an instance of the current world context, and VOILA. That's another one I could recommend, due to its wide use and familiarity.
What you need is a View Engine, for which there are many open-source libraries!
The WebFormViewEngine class is the one built into .NET, which uses the syntax I suggested originally.
Also noteworthy; the latest ASP.NET/MVC releases use the Razor view engine. It looks like you could easily pass the "Description" text into the engine, as well as an instance of the current world context, and VOILA. That's another one I could recommend, due to its wide use and familiarity.
Alex
29 Jan 2013, 19:00The inline stuff would need to be part of a parameter to a command like "msg" - you'd call it like this:
This would need to be processed by some implementation of "msg". Currently this is one of the core script commands, so it has an implementation in Quest's WorldModel (which processes scripts), and also has a separate JavaScript implementation for games which are converted into smartphone apps.
What I am proposing for Quest 5.4 is to have all output go through an ASLX function. This would implement a new text processor to parse commands such as {if}, {object}, {command}. Because it would be written in Quest script, no extra work will be required to support this in apps, or on any future platform that Quest might be ported to.
msg ("You are in a cave. {if flashlight.IsActivated:Your flashlight illuminates some {object:drawings} on the wall.}")
This would need to be processed by some implementation of "msg". Currently this is one of the core script commands, so it has an implementation in Quest's WorldModel (which processes scripts), and also has a separate JavaScript implementation for games which are converted into smartphone apps.
What I am proposing for Quest 5.4 is to have all output go through an ASLX function. This would implement a new text processor to parse commands such as {if}, {object}, {command}. Because it would be written in Quest script, no extra work will be required to support this in apps, or on any future platform that Quest might be ported to.
BTownTKD
29 Jan 2013, 19:01Sounds like a solid implementation, then! I'm looking forward to it 


Pertex
29 Jan 2013, 20:34Does this mean that these inline scripts would only work in msg functions? Or will it be possible to use them in descriptions, too?
Alex
29 Jan 2013, 21:24A room description gets routed through msg, as does all Quest output. So the idea is you can use these text formatting codes anywhere.

Pertex
30 Jan 2013, 07:35This would be great, then I could work with the gui again!
Hmm, would it be possible to use normal scripts instead of a new script format? Something like
Then Newbies must not learn another script syntax.But on the other hand you could do this by using a script instead of a description text. I think it's best to start developing this inline script with <object verbs="lookat/open">door</object> as fast as possible
Hmm, would it be possible to use normal scripts instead of a new script format? Something like
msg ("You are in a cave. {{if (flashlight.IsActivated) {msg('Your flashlight illuminates some' + Objectlink(drawings) +' on the wall.'}}")
Then Newbies must not learn another script syntax.But on the other hand you could do this by using a script instead of a description text. I think it's best to start developing this inline script with <object verbs="lookat/open">door</object> as fast as possible
