Scoring system outuputed to notebook file...very difficult

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the when posting support requests.

lzilberm
Member
Member
Posts: 31
Joined: January 19th, 2012, 12:54 pm
Name: lee
IRC Username: zilber

Scoring system outuputed to notebook file...very difficult

Postby lzilberm » April 5th, 2012, 1:56 pm

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

northstar
Member
Member
Posts: 208
Joined: March 1st, 2012, 1:17 pm
Name: steven

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

Postby northstar » April 5th, 2012, 2:11 pm

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...

User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

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

Postby Sircameron » April 5th, 2012, 5:46 pm

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

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

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

Postby chocolatepie33 » April 6th, 2012, 10:45 pm

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.

User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

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

Postby Sircameron » April 7th, 2012, 1:13 am

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..

lzilberm
Member
Member
Posts: 31
Joined: January 19th, 2012, 12:54 pm
Name: lee
IRC Username: zilber

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

Postby lzilberm » April 10th, 2012, 1:03 pm

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);

}

lzilberm
Member
Member
Posts: 31
Joined: January 19th, 2012, 12:54 pm
Name: lee
IRC Username: zilber

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

Postby lzilberm » April 16th, 2012, 2:01 pm

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.

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

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

Postby chocolatepie33 » April 16th, 2012, 6:10 pm

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.

lzilberm
Member
Member
Posts: 31
Joined: January 19th, 2012, 12:54 pm
Name: lee
IRC Username: zilber

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

Postby lzilberm » April 18th, 2012, 1:01 pm

Does anyone have any knowledge of how to integrate the C++ code into the cube engine?

User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

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

Postby Sircameron » April 19th, 2012, 9:09 pm



Return to “Sandbox General Support”

Who is online

Users browsing this forum: No registered users and 1 guest