Page 1 of 2

Scoring system outuputed to notebook file...very difficult

Posted: April 5th, 2012, 1:56 pm
by lzilberm
Hey everyone,

I'm posting a somewhat similar post to a post I put up not too long ago...this one is hopefully better articulated.

I have two maze type maps.
1. Right_1
2. Left_1
In "Right_1" the player has to go down a corridor to the right. If he goes to the left corridor by accident..the player is transported back to the beginning of that maze and he/she has to try again. If he goes down the right corridor....he is transported to a randomly selected maze (either Right_1 or Left_1).

The same goes for the Left_1 maze. If the player goes to the left corrider...a random maze loads....if he/she fails by going down the right...the player is teleported to the start of that same maze.

I need a scoring system that is outputed into a notepad document. A "win" would be when the player goes to the correct side of the maze and is thus transported to a new random maze. A "fail" would be when the player goes to the wrong side of the maze and is transported back to the beginning of that same maze.

This seems like a pretty boring game...however this will be used in a lab. We will have various participants play the mazes over several weeks, and we need to keep track of their performance. Therefore I would like to input the players name or ID number before he/she begins the game and also the date. That way I can keep track of the players over time and see how their performance improves.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Here is an example of what I want to see in the notepad file:

Player ID: Justin
Date: April 5, 2012

Wins: 5
Fails: 2
% Success: 5/7
______

Player ID: Sarah
Date: April 6, 2012

Wins: 6
Fails: 4
% Success: 6/10


____________________________________________
Thank you to anyone who tries to take this on...it is truly truly appreciated.

Cheers,
lzilberm

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 5th, 2012, 2:11 pm
by northstar
it certainly seems do-able... i'm not up to scripting yet, but isnt there a radio button option to show the progress/faults at the end of game?... seems you would just send the info to a spreadsheet to calculate then render to notepad... but hey, i'm just guessing...

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 5th, 2012, 5:46 pm
by Sircameron
I havent seen anything that would seem like this is possible in cubescript to my knowledge anyways.. Screenshot my be an alternative.. But like i said i havent seen anything mentioning the use of file headers. If the code is there.. It wouldnt be too hard to do at all

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 6th, 2012, 10:45 pm
by chocolatepie33
I think this may be possible, I'm not entirely sure about how to do it, but here are my ideas:

You could use the echo command to say stuff in the upper-left-hand message area. Now, I believe there's a way to have that "message area" written down. I've seen the file before, and it usually tells me all the stuff you find at startup, like processor and such. If you could figure out a way to have that message saved, that may work.

My other idea (I don't think it's good, however) is if you scripted a series of custom variables, which you had saved to a .cfg file, such as config_fps.cfg (well, not that one). I'm going with how the config file saves certain variables, most notably system settings.

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 7th, 2012, 1:13 am
by Sircameron
Well you can edit the .bat files in windows and add " *> paslog.txt" (without the quotes) at the end of the line it will make a txt file named "paslog" in the same directory as the .bat file.. But i couldnt figure out how to write into the file itself.. Apparently sauerbraten can save chat logs in this same way, but it didnt work in pas fps mode 2.7.0.. I tried "echo" and just plain chatting randomly and it didnt save the text to the file..

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 10th, 2012, 1:03 pm
by lzilberm
I have this code...but I think it is in the wrong format. Does anyone have any insights?

/******************************************************/

// Include files
#include <iostream> // used for cin, cout
#include <conio.h>
#include <windows.h>
#include <string>
#include <fstream>
#include <sstream>
#include <ctime>



using namespace std;

// Global Type Declarations

// Function Prototypes

string stringify(double x){
ostringstream o;
o << x;
return o.str();
}

int print_report(string report_var) {

ofstream myfile;
myfile.open ("todays_report.txt");

myfile << report_var;

myfile.close();
return 0;
}

int main ()
{
using namespace std;
double player_wins, player_fails, player_games;

cout << "Enter Player ID: " ;
cin >> player_id;

cout << "Enter Player Wins: " ;
cin >> player_wins;

cout << "Enter Player Fails: " ;
cin >> player_fails;

player_data(player_id,player_wins,player_fails);
}

//this functions get Name,Wins,Losts and print the report in the end.
int player_data(string player_id,double player_wins, double player_fails){

using namespace std;
double player_games;


string report = "";

// Current date/time based on current system
time_t now = time(0);

//player_wins = 1;
//player_fails = 3;

player_games = player_wins + player_fails;

//Converting double to string
//---------------------------
string player_wins_str = stringify(player_wins);
string player_fails_str = stringify(player_fails);
string player_games_str = stringify(player_games);


report = report + "Player ID: " + player_id + "\n";
report = report + "Date: "+ time_t + "\n\n";

report = report + "Wins: " + player_wins_str + "\n";
report = report + "Fails: " + player_fails_str + "\n";
report = report + "% Success: " + player_wins_str + " / " + player_games_str + "\n\n";
report = report + "_________\n\n";

//creating a report file
print_report(report);

}

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 16th, 2012, 2:01 pm
by lzilberm
maybe this will help a programmer:


What is a win?
~~~~~A win is when the player gets to the correct part of the maze and is transported to a new random maze. There is a hidden object at the correct part of the maze that is picked up and sends the player to the new random maze.

What is a loss?
~~~~~A loss is when the player goes to the wrong part of the maze and is transported to the start point of that same maze. There is a hidden teleport object at the wrong end of the maze that takes the player to a defined starting point.

have all the information outputed to a notebook file

input the players name
input the date

______________

in the notebook file

Player_name:
Date:

Number of wins:
Number of losses:

Number of wins/number of losses.

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 16th, 2012, 6:10 pm
by chocolatepie33
the code you put in your second-to-newest post is in C++, which makes up the Cube 2 engine (the core of Sandbox, put simply). If you can figure out how to convert that to Cubescript (you have to do it by hand, as there's no such thing as a C++ to Cubescript converter), then you could implement it into your map's configuration file and go from there. As for the win-loss thing, you could use a trigger to add a loss or win to the total before changing maps. I think. Maybe.

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 18th, 2012, 1:01 pm
by lzilberm
Does anyone have any knowledge of how to integrate the C++ code into the cube engine?

Re: Scoring system outuputed to notebook file...very difficu

Posted: April 19th, 2012, 9:09 pm
by Sircameron
lzilberm wrote:Does anyone have any knowledge of how to integrate the C++ code into the cube engine?
Im pretty sure there's a post about someone attempting this before, and then giving up.. It'd be such a beautiful thing if it could be done! I'd totally use it if you were able to do so!