jaynabonne wrote:1) A tip if you're working with JavaScript: if when your game is running, you click on HTML Tools in the tool bar, it will bring up a very useful window that, among other things, has a Console tab. You can see any JavaScript errors there. Even given that, it took me *too long* to work out the error, which is that you need a semicolon (";") on the end of the block assigned to TextFX. Otherwise, the JS compiler carries on and tries to combine the anonymous function declaration that comes next with that, and it gets all confused.
jaynabonne wrote:2) The short answer is, no. You have to use ASLEvent to pass data back to the Quest code.
However, a number of statements you made before that, about problems you were having, etc, made me want to say "Can you show some examples of that?" because it sounds like you're having some interesting issues that might have simple solutions given some sample code. For example, you say, "In particular, Quest doesn't seem to support more than one decimal." which I can't even find a way to make meaningful (more than one decimal per number? no. More than one number with a decimal? Well, it should...) So, I don't know what the problem even is. And the sentence that came after that was intriguing as well (having to call a function twice???), but without seeing some actual code to know what you're trying to do, I can't offer any advice on other ways to do it.
One thought: I once implemented some code for command links in a text-input-less game, where I had a single command that took a parametrized string containing an object, a script attribute name, and the parameters to pass to the script. That way, if I had twenty or more different links, I didn't have to create that many individual commands - I just had one general purpose command that dispatched the request to an object's script, which was much cleaner (for me). Functions don't have the same creation overhead as commands, so I'm not sure if that would solve the problem you're experiencing or not, but it is a way to go, if it makes sense for you.
if (switchvar = 0) {
switchvar = 1
targetobj = GetObject(input)
} else {
switchvar = 0
RemoveHP (targetobj, input)
}
jaynabonne wrote:3) For this as well, if you could put together a simple sample app that exhibits the problem, and then we can run it and you can virtually say, "Ok, see that? That's what I want to change", then it will be easier to get some answers. Otherwise, I'd have to try to put together my own sample code and hope it somehow matches yours to the extent of seeing what you're seeing or want to see.
But another short answer: the custom drawing should allow you to draw your own widgets on the map.
jaynabonne wrote:4) Your status attribute can have HTML (see, for example, my progress bar code in the forum's Library section). So you can make it what you want, even an image.
jaynabonne wrote:5) If have experimented with hooking key pressed using JavaScript, and then simply pumping them up the app using ASLEvent. It seemed to work in the desktop version, but you might want to check the online player before committing to using it, if you ever plan to publish that way.
Cylius_Optimi wrote:...
My combat system takes an integer defense for a certain damage type (i.e. defKinetic = 1), converts it into 1% multiplier reduction of that type of damage (1 / 100, 1 - 0.01), then sends the rounded and whole integer back to Quest. Because Quest can't handle those kinds of numbers, I used JS to run the numbers; plus, I'm sure doing it this way will eventually make combat much faster.
...
jaynabonne wrote:A quick reply about the integer calculations: if you have an integer in Quest, if you divide by 100, then it remains an integer, and you will truncate the decimal places. But if you divide it by 100.0, then it will treat it as a floating point calculation, and you will retain the decimals. So:
If you have damage = 1 (as an integer), then
damage/100 = 0
but
damage/100.0 = 0.01
One of those times the variables type comes into play. In case that helps simplify things by you not having to dive into JavaScript for the calculation. I'll check out the rest a bit later.
The Pixie wrote:"Cylius_Optimi"
...
My combat system takes an integer defense for a certain damage type (i.e. defKinetic = 1), converts it into 1% multiplier reduction of that type of damage (1 / 100, 1 - 0.01), then sends the rounded and whole integer back to Quest. Because Quest can't handle those kinds of numbers, I used JS to run the numbers; plus, I'm sure doing it this way will eventually make combat much faster.
...
Quest can handle floating point arithmetic, using double attributes, but in this case you should be able to stay with integers, as long as you multiply by 100 early enough. Say the base damage is 12, and the armour has a value of 2, the first one here will give you 11, which is right, the second gves zero.
12 * (100-2) / 100
(100-2) / 100 * 12
Do all your multiplying before the dividing, and it should be fine. And probably quicker than going into JavaScript and back. And definitely easier!
jaynabonne wrote:Regarding the mapping issue, I don't know if this will help, but you can actually control which sides have the border drawn. Unfortunately, there's no built-in way to (say) not draw the fill. I tried both "rgba(0,0,0,0)" and "transparent", and it just drew black. So even when the border doesn't draw, the fill still draws, which will eat into your parent frame. You might be able to work around that by manually drawing the parent frame just that much further from the rooms so it doesn't get "eaten". I tried that quickly with no luck. I could try again.
I have attached a modified version of your game with two changes (well, two classes of changes):
1) I turned off the border for the parent rooms.
2) I manually edited the "grid_bordersides" attribute for each room. The dropdown with things like "North-South", etc only has a subset of the full 16 possibilities. The border sides are stored as an integer attribute with value from 0-15 (four bits). The bits are:
north = 8
east = 4
south = 2
west = 1
You add together the borders you want drawn and set the grid_bordersides attribute, and it draws just those. So, for example, for your room1, since it had exits to the east and south, I assumed it would have borders north and west. So I set its grid_bordersides attribute to 8+4 or 12. (You can find the attribute in the attributes list for the object. You may have to scroll down to find it.) It does give you that level of control, at least. I think to not draw the white for the room (or shrink it a bit), we'd have to dive into JavaScript and start overriding functions. Not impossible, but I wanted to see what you thought of this before we went further.
Another thought: I have code that "pre-visits" all the rooms in the game, forcing them to draw in the map. That way, the map is fully visible up front. If all the children draw, you might not even need a parent room in that case. Let me know if that would be useful, and I'll dig it up.
jaynabonne wrote:Actually, here's a version where the map fully draws up front. I'm not completely sure why it sort of scrolls into view; I think it might be because in the process of visiting all the rooms, the map shifts, and then it recenters when the game starts.
Anyway, the key is a function called "VisitRoom" which calculates and draws the room you pass and then recursively visits any rooms that lead off it via exits. (It sets a flag on each visited room to keep from recursing forever.) The game just calls it on "player.parent" in the start script to get the ball rolling.
In case it's useful...
I'm actually looking through the second MapTest in Notepad++; it looks like you included some JS, but it didn't get included with the game?
If that's an important component, just thought you should know.
Actually, that feature would definitely be helpful for the greater majority of rooms, but I'd also like some rooms to stay hidden; stuff like unexplored wilderness, alleyways, etc. Is there a way you'd suggest to toggle automapping for certain rooms?