formating numbers...

Any want-a-be spaceship captains out there???
OK, still reading, good... now for the problems...

  1. I need a number truncated...
    X=3.14591459024618740238902 (Yea, almost pie)
    but shortened to:
    X=3.1459 (4 place values)
    In Basic I would say:
    X=int(x*1000)/1000
    (Or ToInt(X) in Quest)
    But Quest reads that as a Double and will not convert it to an integer.

#2) I have a command "button" called Nav... (Navigate) to change the ship's heading, which works, but...
I can hit the button, then enter the turn needed... That works.
I can type nav, then enter, and enter the turn... That works.
But, I want to be able to enter nav -20... But how???
GetInput gets the number for the turn, but I don't know how to tell Quest that there may or may not be a number after the command and ask for a number if it is not provided...

Version 0.01 will be just a training exercise in flying the ship...
Version 0.02 will be a simulated combat with your side being 2 corvettes and a destroyer against a frigate and a destroyer. Also planning on an after battle report on your performance.
0.01 will lead into 0.02... (flight practice followed by the combat)
That done, Version 0.1 will be a free-form game where you are in command of a small class ship and depending on a background question, it could be a freighter or passenger ship, or combo, working for a shipping company and flying a set route, or in the military or police force, fighting to protect and defend the civilian ships...
Maybe an option for ion, or impulse drive (easy turns and speed change) or a drive system based on Newtonian movement...
(Think Asteroids here)


You can use DisplayNumber to format numbers for display.
http://docs.textadventures.co.uk/quest/functions/string/displaynumber.html

You might also want to see this page about doubles:
http://docs.textadventures.co.uk/quest/using_doubles.html

For your NAV command, I suggest a RegEx. I have not tried it, but something like this (for integer values):

 ^nav (?<text>\-?\d+)$

Then:

turn = ToInt(text)

OK, I found Truncate which does the int() function I was looking for.
(It would be helpful if the documentation showed and example, or 2 or 3, about how to use the functions and commands)

Now:
#3) When showing a picture, like a scanner image, is it possible to put text beside the picture kinda like a split screen?
IE:
┌─────────────────────────┐
│░░░░░░░░░░░░░░░░░░│ Target A: Rhy (ship systems)
│░░░░░░░░░░░░░░A░░░│ Heading: 120 Speed: 4
│░░░░░░░░░░░░░░░░░░│
│░░░░░░░░░░░░░░░░░░│ Target B: Oholo (Ship systems)
│░░░░░░░░X░░░░░░░░░│ Heading: 40 Speed: 2
│░░B░░░░░░░░░░░░░░░│
│░░░░░░░░░░░░░░░░░░│
└─────────────────────────┘
(X is your ship)
Or would I just need to do this like this example???


I looked at RegEx… Lost does not describe how I felt...
Would that be put in the command tab, under the pattern box?


When showing a picture, like a scanner image, is it possible to put text beside the picture kinda like a split screen?

The cool (but complicated) way would be to generate images on the fly, which would let you do pretty much anything (even a 3d image in theory):
http://docs.textadventures.co.uk/quest/images_on_the_fly.html

I looked at RegEx… Lost does not describe how I felt...

It took me a while to get my head round them. When you do, they are very useful.

Would that be put in the command tab, under the pattern box?

It goes in the pattern box itself, but then you need to set it to be a regex to the left.


When showing a picture, like a scanner image, is it possible to put text beside the picture kinda like a split screen?

If you're printing out an <img> manually, probably the easiest thing to do would be to put it in a table, and add your text to the second cell.

If you want text beside the image in the game panel, you could probably do some JS magic to make it work neatly. I can see how I'd do it; but it depends what effect you're aiming for.

Looking at the example you gave, I think you might even want to display text (or graphics) on top of a picture. The image you showed there is something you'd more likely put together by overlaying a few images onto each other while the game is running. Is that something you want?


About, but even colored dots, then color the target's info to the dot color...
JS Magic is over my head for the moment...
I might just stick to an ASCII scanner for now.
Overlaid images may be the thing I'm looking for...
Checking out images_on_the_fly.html now.

It goes in the pattern box itself, but then you need to set it to be a regex to the left.

You got me totally lost on this one...


Thanks for the link to images_on_the_fly.html and to https://www.w3schools.com/graphics/svg_intro.asp
You make feel like a beggar asking for a few coins for a meal, and you hand me the keys to the treasurery and said, "Here, take what you want."
There's a treasure over there!!!! Maybe even a dragon's hoard!!!

I could possibly add graphics and animation to the game so that instead of "rolling" dice for a hit, you aim the guns to hit the other ship... 2D, maybe even 3d!!!
It may get away from the concept of a "text" game... but oh, well... More fun this way!


I do have the basic version on my game posted: Space Ship...
I most likely rename it later.


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

Support

Forums