3 registered members (vicknick, 7th_zorro, 1 invisible),
887
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
is it possible??????
#331006
07/01/10 14:53
07/01/10 14:53
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
hello all, i am working on an educational game for my classroom. i want to help students study mathematics. as the player goes through certain areas of the level he has to solve math problems, if he gets the wrong answer, he's put in peril. my question is, is it possible to change the math problem and the answer so if someone else plays it or the student wants to play the game again, they get a different question? i already figured i would give the student two chances to solve the problem, and then let them advance after falling into peril twice. is it possible to do this? any ideas would be helpful, and a way to code something like this if possible. you guys know i am not that good at writing code, but i can implement.
thanks in advbance.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: is it possible??????
[Re: MMike]
#331036
07/01/10 17:35
07/01/10 17:35
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
thanks, what would a script likethis look like? i understand what you mean, but i dont understand how to set something like this up. thanks for the response
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: is it possible??????
[Re: Blink]
#331040
07/01/10 17:52
07/01/10 17:52
|
Joined: Nov 2009
Posts: 89 Germany, NRW
TrackingKeks
Junior Member
|
Junior Member
Joined: Nov 2009
Posts: 89
Germany, NRW
|
I don't use c-script so I can only give you some tips. You could store all the information in one or many files and read them out in ab big array. Then you could every time the play enters one new place use the same dialog with TEXT objects. The content should be choosen by "random()". Perhaps you could add that the choosen question is only shown one time per round by adding an array where every value is set to 0 and only after showing the question it is set to 1. I have done all this for a quiz one time (it was a project for school ).
Last edited by TrackingKeks; 07/01/10 17:52.
Gamestudio: A7.82 Commercial/A8 Commercial System specs (Laptop): Windows 7 64bit DirectX v10.1 Intel Core i7-720QM CPU @ 1,60 GHz 4GB DDR2 Ram NVIDIA GeForce GT 230M (1024MB)
|
|
|
Re: is it possible??????
[Re: TrackingKeks]
#331122
07/02/10 01:53
07/02/10 01:53
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
thanks, i understand, maybe someone will help me with an example i can work off. i was given a code by a member in lite-c, and i tried to convert it to c-script with no luck,lol. hopefully someone can write a script here that i can work with. this is a bit challenging for me.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: is it possible??????
[Re: Blink]
#331362
07/03/10 19:13
07/03/10 19:13
|
Joined: Jan 2010
Posts: 145
Doc_Savage
Member
|
Member
Joined: Jan 2010
Posts: 145
|
i may not know much about coding yet, but i think this is a VERY possible thing to do with the "random" command, i think somthing along the lines of making every set of math problems a function, or somthing like it, and giving each function a sort of "call number" saying "hey math problem set 1, youre up this round." and then finding a way to randomize which number is picked each time the game starts. i also commend your efforts to bring gaming to an exeptionally good cause. ....well theres my 2 cents
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: is it possible??????
[Re: Blink]
#331396
07/03/10 23:36
07/03/10 23:36
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
//A6.60 c-script
/*
snippet from _helpyqz.wdl
(c)opyright dummy collective
may only be used without permission
*/
// TEXT used to show a question
TEXT qz_tQuestion {
red = 255;
green = 225;
blue = 255;
pos_x = 0;
pos_y = 0;
strings = 1;
flags = VISIBLE;
}
// contains a list of answers some of which are incorrect
TEXT qz_tAnswers {
red = 255;
green = 225;
blue = 255;
pos_x = 0;
pos_y = 50;
strings = 4;
flags = VISIBLE;
}
// contains a list of answers and questions in no particular order
// loaded from qz.txt
// see format file qz.txt
TEXT qz_tLoad {
strings = 60000;
}
var qz_nAnswer = 0; // the actual answer index in the questions TEXT
var qz_nLoad = 0; // number of lines loaded from qz.txt
var qz_bQuestionFound = 0; // result for qzf_getQuestion
var qz_bAnswerFound = 0; // result for qzf_getAnswer
STRING qz_sAnswer[1024]; // an answer temp string used with qzf_getAnswer
STRING qz_sQuestion[1024]; // a question temp string used with qzf_getQuestion
STRING qz_sNum[128]; // used to convert number to STRING in multiple functions
function random_int(_nLow, _nHigh) {
return(int(_nLow + ((_nHigh - _nLow) * random(1.001))));
}
// returns 1 if _sIn starts with _sFind
function str_starts(_sIn, _sFind) {
return(str_stri(_sIn, _sFind) == 1);
}
// loads qz_tAnswers with random answers, non of which are _nNotNumber (the correct answer)
function qzf_getRandomAnswers(_nAnswers, _nNotNumber) {
var n; n = random_int(0, qz_nLoad);
var nCalls; nCalls = 0;
var nAnswersFound; nAnswersFound = 0;
while(nCalls < qz_nLoad * 5) {
n = random_int(0, qz_nLoad - 1);
if (n != _nNotNumber) {
qzf_getAnswer(n);
if (qz_bAnswerFound) {
str_cpy(qz_tAnswers.string[nAnswersFound], qz_sAnswer);
nAnswersFound += 1;
if (nAnswersFound >= _nAnswers) { break; }
}
}
nCalls += 1;
}
}
// sets qz_sAnswer to answer in qz.txt
// modifies qz_bAnswerFound
function qzf_getAnswer(_nNumber) {
str_cpy(qz_sAnswer, "");
var n; n=0;
qz_bAnswerFound = 0;
while(n < qz_nLoad) {
str_for_num(qz_sNum, _nNumber);
str_cat(qz_sNum, "a");
if (str_starts(qz_tLoad.string[n], qz_sNum)) {
str_cpy(qz_sAnswer, qz_tLoad.string[n]);
str_clip(qz_sAnswer, str_len(qz_sNum));
qz_bAnswerFound = 1;
return(n);
}
n+=1;
}
}
// sets qz_sQuestion to question number _nNumber in qz.txt
// modifies qz_bQuestionFound
function qzf_getQuestion(_nNumber) {
str_cpy(qz_sQuestion, "");
var n; n=0;
qz_bQuestionFound = 0;
while(n < qz_nLoad) {
str_for_num(qz_sNum, _nNumber);
str_cat(qz_sNum, "q");
if (str_starts(qz_tLoad.string[n], qz_sNum)) {
str_cpy(qz_sQuestion, qz_tLoad.string[n]);
str_clip(qz_sQuestion, str_len(qz_sNum));
qz_bQuestionFound = 1;
return(n);
}
n+=1;
}
}
// loads all questions and answers from _sFileName into qz_tLoad
// modifies qz_nLoad (number of lines loaded)
function qzf_load(_sFileName) {
if (_sFileName == 0) { return(0); }
qz_nLoad = txt_load(qz_tLoad, _sFileName);
if (qz_nLoad == 0) { error("no questions loaded"); }
return(qz_nLoad);
}
// a test function
// call once from main
// press 1 , 2, or 3 key to select question 1, 2 or 3
// and generate 3 random answers plus one correct one
// note to fix: the 3 random answers might not be unique
function qzf_input() {
qzf_load("qz.txt");
while(1) {
wait(1);
var n; n = 0;
if (key_1) { n = 1; }
if (key_2) { n = 2; }
if (key_3) { n = 3; }
if (n != 0) {
qzf_getQuestion(n);
str_cpy(qz_tQuestion.string[0], qz_sQuestion);
qzf_getRandomAnswers(3, n);
qzf_getAnswer(n);
if (qz_bAnswerFound) {
qz_nAnswer = random_int(0, 3);
str_cpy(qz_tAnswers.string[3], qz_tAnswers.string[qz_nAnswer]);
str_cpy(qz_tAnswers.string[qz_nAnswer], qz_sAnswer);
}
}
}
}
/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{
randomize();
// set some common flags and variables
// freeze all entity functions
freeze_mode = 1;
// no level has been loaded yet...
gid01_level_state = gid01_level_not_loaded;
// entry: Warning Level (0,1, or 2)
// entry_help: Sets sensitivity to warnings (0 = none, 1 = some, 2 = all).
warn_level = 2; // announce bad texture sizes and bad wdl code
// entry: Starting Mouse Mode (0, 1, or 2)
mouse_mode = 0;
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);
qzf_input();
// now load the level
level_load(level_str);
wait(2); // let level load
// level should be loaded at this point...
gid01_level_state = gid01_level_loaded;
//+++ load starting values
// un-freeze the game
freeze_mode = 0;
// save start of game here
wait(6); // allow time for functions that wait for "gid01_level_loaded" to load
file_delete("start0.SAV"); // remove any old savefile
wait(1);
if( game_save("start",0,SV_ALL) <= 0)
{
diag("\nWARNING! main - Cannot save 'start' of level (ignore on restarts).");
}
else
{
diag("\nWDL: main - Game 'start' saved.");
}
// main game loop
while(1)
{
if(gid01_level_state != gid01_level_loaded)
{
freeze_mode = 1; // pause the game
while(gid01_level_state != gid01_level_loaded) { wait(1); }
freeze_mode = 0; // resume the game
}
wait(1);
}
}
format of qz.txt Questions start with a prefix "0q", where 0 is the number of the question. Answers start with a prefix "0a", where 0 is the number of the answer to question number 0.
1qQuestion1
2qQuestion2
3qQuestion3
4qQuestion4
5qQuestion5
6qQuestion6
7qQuestion7
8qQuestion8
1aAnswer1
2aAnswer2
3aAnswer3
4aAnswer4
5aAnswer5
6aAnswer6
7aAnswer7
8aAnswer8
Well that was fun. Maybe that helps for a start, or maybe it doesn't.
|
|
|
Re: is it possible??????
[Re: tD_Datura_v]
#331422
07/04/10 04:37
07/04/10 04:37
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
Thank you so much tD, i will try to implement this. how many times have you saved me? ok, so if i create a node or a block that needs an action like "action quiz_me;", that should start the quiz in that area of my level, right? i am not sure which function to use to create the action.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: is it possible??????
[Re: Blink]
#331520
07/04/10 19:54
07/04/10 19:54
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
Blink, that was just an example, and maybe not a good one at that. Here is a little bit more, but this might not be much more helpful than what was offered before.
//A6.60 c-script
/*
snippet from _helpyqz.wdl
(c)opyright dummy collective
may only be used without permission
*/
// TEXT used to show a question
TEXT qz_tQuestion {
red = 255;
green = 225;
blue = 255;
pos_x = 0;
pos_y = 0;
strings = 1;
flags = VISIBLE;
}
// contains a list of answers some of which are incorrect
TEXT qz_tAnswers {
red = 255;
green = 225;
blue = 255;
pos_x = 0;
pos_y = 15;
strings = 4;
flags = VISIBLE;
}
TEXT qz_tResult {
red = 255;
green = 255;
blue = 255;
pos_x = 0;
pos_y = 60;
strings = 1;
flags = VISIBLE;
}
// contains a list of answers and questions in no particular order
// loaded from qz.txt
// see format file qz.txt
TEXT qz_tLoad {
strings = 60000;
}
var qz_nStage = 0;
var qz_nQuestion = 0;
var qz_nQuestionsUsed = 0;
var qz_naQuestionsUsed[30000];
var qz_nAnswer = 0; // the actual answer index in the questions TEXT
var qz_nLoad = 0; // number of lines loaded from qz.txt
var qz_bQuestionFound = 0; // result for qzf_getQuestion
var qz_bAnswerFound = 0; // result for qzf_getAnswer
STRING qz_sAnswer[1024]; // an answer temp string used with qzf_getAnswer
STRING qz_sQuestion[1024]; // a question temp string used with qzf_getQuestion
STRING qz_sNum[128]; // used to convert number to STRING in multiple functions
define k_1, 2;
define k_2, 3;
define k_3, 4;
define k_4, 5;
function random_int(_nLow, _nHigh) {
return(int(_nLow + ((_nHigh - _nLow) * random(1.001))));
}
// returns 1 if _sIn starts with _sFind
function str_starts(_sIn, _sFind) {
return(str_stri(_sIn, _sFind) == 1);
}
function qzf_clearQuestionsUsed() {
var n; n=0;
while(n < qz_nQuestionsUsed) {
qz_naQuestionsUsed[n] = 0;
n+=0;
}
qz_nQuestionsUsed = 0;
}
function qzf_questionWasUsed(_nQuestion) {
var n; n=0;
while(n < qz_nQuestionsUsed) {
if (qz_naQuestionsUsed[n] == _nQuestion) {
return(1);
}
n+=1;
}
return(0);
}
function qzf_getRandomQuestion() {
var n; n = random_int(0, qz_nLoad);
var nCalls; nCalls = 0;
var nAnswersFound; nAnswersFound = 0;
while(nCalls < (qz_nLoad * 5)) {
n = random_int(1, qz_nLoad);
if (0 == qzf_questionWasUsed(n)) {
qz_nQuestion = n;
return(n);
}
nCalls += 1;
}
if (nCalls >= (qz_nLoad * 5)) {
qzf_clearQuestionsUsed();
}
}
function qzf_checkAnswerKey(_nAnswerIndex, _nScanCode) {
if (_nAnswerIndex == 0 && _nScanCode == k_1) { return(1); }
if (_nAnswerIndex == 1 && _nScanCode == k_2) { return(1); }
if (_nAnswerIndex == 2 && _nScanCode == k_3) { return(1); }
if (_nAnswerIndex == 3 && _nScanCode == k_4) { return(1); }
return(0);
}
// loads qz_tAnswers with random answers, non of which are _nNotNumber (the correct answer)
function qzf_getRandomAnswers(_nAnswers, _nNotNumber) {
var n; n = 0;
var nCalls; nCalls = 0;
var nAnswersFound; nAnswersFound = 0;
while(nCalls < qz_nLoad * 5) {
n = random_int(1, qz_nLoad);
if (n != _nNotNumber) {
qzf_getAnswer(n);
if (qz_bAnswerFound) {
str_cpy(qz_tAnswers.string[nAnswersFound], qz_sAnswer);
nAnswersFound += 1;
if (nAnswersFound >= _nAnswers) { break; }
}
}
nCalls += 1;
}
}
// sets qz_sAnswer to answer in qz.txt
// modifies qz_bAnswerFound
function qzf_getAnswer(_nNumber) {
str_cpy(qz_sAnswer, "");
var n; n=0;
qz_bAnswerFound = 0;
while(n < qz_nLoad) {
str_for_num(qz_sNum, _nNumber);
str_cat(qz_sNum, "a");
if (str_starts(qz_tLoad.string[n], qz_sNum)) {
str_cpy(qz_sAnswer, qz_tLoad.string[n]);
str_clip(qz_sAnswer, str_len(qz_sNum));
qz_bAnswerFound = 1;
return(n);
}
n+=1;
}
}
// sets qz_sQuestion to question number _nNumber in qz.txt
// modifies qz_bQuestionFound
function qzf_getQuestion(_nNumber) {
str_cpy(qz_sQuestion, "");
var n; n=0;
qz_bQuestionFound = 0;
while(n < qz_nLoad) {
str_for_num(qz_sNum, _nNumber);
str_cat(qz_sNum, "q");
if (str_starts(qz_tLoad.string[n], qz_sNum)) {
str_cpy(qz_sQuestion, qz_tLoad.string[n]);
str_clip(qz_sQuestion, str_len(qz_sNum));
qz_bQuestionFound = 1;
return(n);
}
n+=1;
}
}
// loads all questions and answers from _sFileName into qz_tLoad
// modifies qz_nLoad (number of lines loaded)
function qzf_load(_sFileName) {
if (_sFileName == 0) { return(0); }
qz_nLoad = txt_load(qz_tLoad, _sFileName);
if (qz_nLoad == 0) { error("no questions loaded"); }
return(qz_nLoad);
}
function qzf_quizMe() {
qzf_load("qz.txt");
qz_nStage = 1;
while(qz_nStage) {
qzf_getRandomQuestion();
qzf_getQuestion(qz_nQuestion);
str_cpy(qz_tQuestion.string[0], qz_sQuestion);
qzf_getRandomAnswers(3, qz_nQuestion);
qzf_getAnswer(qz_nQuestion);
if (qz_bAnswerFound) {
qz_nAnswer = random_int(0, 3);
str_cpy(qz_tAnswers.string[3], qz_tAnswers.string[qz_nAnswer]);
str_cpy(qz_tAnswers.string[qz_nAnswer], qz_sAnswer);
qz_nStage = 2;
while(qz_nStage == 2) {
if (key_1 || key_2 || key_3 || key_4) { qz_nStage = 3; }
wait(1);
}
if (qz_nStage == 3) {
if (qzf_checkAnswerKey(qz_nAnswer, key_lastpressed)) {
str_cpy(qz_tResult.string[0], "correct");
} else {
str_cpy(qz_tResult.string[0], "wrong");
}
while(0 == key_enter) { wait(1); }
str_cpy(qz_tResult.string[0], "");
qz_nStage = 1;
}
}
wait(1);
}
}
There are new functions including "qzf_quizMe". When placed in main qzf_quizMe should serve up questions from qz.txt. Press 1, 2, 3, 4 and "correct" or "wrong" might be displayed. Press the ENTER key and another question might be displayed...or maybe not.
|
|
|
|