hi, ive been learning C++ from a book at home, am past the console and pretty much all the form part of the book but have a few unanswered questions.
Beware this might be quite a large post, as i have no access to the net at home so am posting everything at once, sorry :)
im using borland C++ builder. im trying to create a text rpg via forms, like i did for console, only forms allows media etc.
what im trying to create is a text adventure sorta like the game books you can get where you choose a path and go to the corrsponding page. so say there was 300 peices of text, will i need 300 forms?
how do i exit only the current form, like when i press the 'proceed' button id like the current form to close and the next to take its place.
things like equipment array or object i would just creat a equipment.h and call that?
problems/queries.
Dice part! So i have this little dice code i made, when you press the 'Roll die' button it takes a random Number between 1 & 6 and displays a dialogue box with the coresponding image, heres my code. im not sure wether rand() is okto use though? And is this a decent way to do it?
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
#include <cstdlib>
using namespace std;
{
int result;
result = rand()%6 ; //is this part correct, i cant remember?
ShowMessage(result); //to check result is corresponding to form shown
if (result==1)
{
Form2->ShowModal(); //form showing the number 1
}
else if (result==2)
{
Form3->ShowModal(); //form showing the number 2
}
else if (result==3)
{
Form4->ShowModal(); //form showing the number 3
}
else if (result==4)
{
Form5->ShowModal(); //form showing the number 4
}
else if (result==5)
{
Form6->ShowModal(); //form showing the number 5
}
else if (result==6)
{
Form7->ShowModal(); //form showing the number 6
}
} }
2. Battle Code
For this i have just written pseudo code'ish so far but for forms i can just creat a header file and calle the function battle() ? also does that look ok, sorry its not proper pseudo.
/*Luck In Battle
WOUNDED ENEMY
1. if you wounded the ENEMY, and are lucky you Subtract and EXTRA 2 points from ENEMY STAMINA.
2. If unlucky you must restore 1 point to ENEMY STAMINA
WOUNDED PLAYER
1. If PLAYER is wounded and are Lucky restore 1 STAMINA point
2. If inlucky Subtract 1 EXTRA STAMINA point */
/*LUCK
Testing LUCK
LUCKY - Roll 2 Dice, if number is equal to or less than your CURRENT LUCK score you have been lucky.
UNLUCKY - If the number is higher than your CURRENT LUCK score, you are UNLUCKY.
Each Time you test luck, 1 LUCK point must be subtracted. */
/*
Read Battle ID
Call coresponding battle stats
////Determine opponent stats\\\\\
Read INIT_ENM_SKILL
Call ENM_`Roll2dice();
INIT_ENM_SKILL + ENM_Result = ENM_ATTCK
////Determine Player stats\\\\\\
Read CURR_PLAY_SKILL
Call Roll2dice();
CURR_PLAY_SKILL + 2DResult = PLAY_ATTK
Do
{
if ENM_ATTK ==PLAY_ATTK = miss
else if { ENM_ATTK > PLAY_ATTK}
STAMINA -2 points.
else if { ENM_ATTK < PLAY_ATTK}
ENM_STAMINA -2 points.
}
WHILE STAMINA && ENM_STAMINA != 0
*/
// dice are 6 sided
3. opening an internet page
i had a look at all the internet buttons that i could see but still cant find any thing, i have a 'website' menu button, and would just like to open up a url inb the default browser.
So far im good to creat forms call the, dialogue boxes, etc. its just these niggly bits f code so in summary:
1. rand() - yay or nay?
2. closing a form as a new one opens
3. opening a web browser to a certain url from menu button.
4. Use and creation of header files for objects and battle system etc. (im pretty sure im
ok with this though, just double checking)
oh and hello everyone, very nice site wish i could take it home with me. im glad to have found and become a part of this community.
Balinor