High Scores Table & Font Size


Recommended Posts

Hi all,

Two queries:

1) I want to generate a high scores table (like in old arcade games) I know I can do this with some scripting effort, but was wondering if there is a smarter way using built in functionality? The table needs to have rank, name, score (elapsed time in this case) and date. The values also need to be retained on reboot so I was thinking about using a v channel with 4 columns for all the data. Can and array contain string and variable data?

2) When the user is performing the task the elapsed time needs to be displayed. I have been unable to get the font for this display large enough. What are the limitiations in font size and how can I get the font larger?

Cheers

Link to comment
Share on other sites

1) You can do this with a single multidimensional string array. You don't need rank because the index into the array will determine that, so it'll just be three columns. You can't mix data types in an array, but its easy enough to convert a string to a number. You can persist the data by using the file.writedelim() function on the array to save, and file.readdelim() to read it back into your variable. The trick is sorting the data in time. There are two ways (I'm assuming you are not using express):

a) when you add a new high score, scan through the array until you find the right spot, then insert it using the variable's InsertAt() function.

:) make your multidim array only two elements and use the time part of all variables to store the time. Just make sure and assign the time last. In this case you can use addvalue() on the variable to simply add a new score to the end, and then use sorttime() to sort it. This only works if the object is to get the longest time listed at the top of the leader board since sorttime() puts the largest time value in [0].

2) there is no limit inside DF and I've done fonts to 100 points and more. It may be that the font you selected isn't true type and doesn't have large font sizes (some system fonts are like this)

Link to comment
Share on other sites

Sorry, I didn't realize you were trying to make a font that big! You are being constrained by the X Size parameter of the component (which allows you to change the size of a component based on an expression). Go to the Size tab in the properties of the component, and set the Range To to something larger than 100 (like 1000). The Range from matches the font size if you didn't specify a size expression.

Link to comment
Share on other sites

Thanks Support. I now have this all working well. FYI for the high scores table I couldn't get the InsertAt() function to work correctly even though I thought I had it going. The problem was I couldn't insert a row of data. In the end I just wrote a while loop that found the correct location and moved anything below 1 row down.

To wrap this application up I have one more query. I would like to make the "game" part of this standalone so that anyone from the public can walk up and have a go. The problem for this is entering the highscores which raises these questions:

1) can the mouse cursor be hidden after a period of inactivity or by a shortcut key combination?

2) to enter the name for high scores I have set up a popup window with an edit box and a submit button (which also closes the window). Currently this requires mouse action to operate. I would like the participant to enter their name by keyboard only so I need the edit box to be selected when the pop up opens for immediate text entry and for the entry to be submitted (and window closed) when enter is pressed.

3) I also have a "change settings" page with push buttons and edit boxes that I would like to be utilised using the keyboard only with either shortcut keys or tabbing between buttons and fields and pressing enter to select.

Is this possible.

Thanks.

Link to comment
Share on other sites

1) Not within DAQFactory, but you might be able to either find (open source) or code up a simple executable that will do it for you and then call it using the system.shellexecute() function

2) I'd use system.entrydialog() instead to get a single string from the user.

3) Tabbing isn't supported (something for R6), but you can assign a speed key to the edit box which, when pressed will cause the edit box to be selected and the cursor placed in it. Its a little funky because the edit box is actually selected, even in runtime mode, but in runtime mode you can't do anything to the edit box (like move, reconfigure etc), you just get the selection rectangle around it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.