ShawnCplus 456 Code Monkey Team Colleague

Thanks for the assistance:

If I were to do the following, why does it only show the information for Kenez from my inFile?

for (int j=0; j<stunum; j++)
    while (inFile>>stuname>>Test1>>Test2>>Midterm>>Final>>Term);

That line keeps overwriting the values. In the end it is left with only the last values

ShawnCplus 456 Code Monkey Team Colleague

actually that is the actual code, it came with cd in which i opened and copied pasted. :) thanks for editing my post.

Looks to me like Daniweb parsed the greater and less than into html entities or you accidentally copied and pasted from a html document on the CD.

iamthwee commented: B I N G O! +12
ShawnCplus 456 Code Monkey Team Colleague

I've been trying to decide how to handle saving game data. At first I was using plaintext which is quick and straight forward but also very, very ugly. I wanted to delve into the world of XML to save data since although it is a bit slower since it has to run through an XML parser (albeit custom built) but definitely the more elegant of the two. Also, since XML can be ported so easily it could, with very little effort, have a second life in a completely different form, ie. a graphical game instead of textual.

So the argument comes down to quick and dirty or elegant and portable. Which would you choose, or have you found to be successful?

ShawnCplus 456 Code Monkey Team Colleague

I did a quick-fix for it by eliminating all spaces on SaveChar by converting them to dashes and converting back upon load. That way I don't have to use the getline function which was giving me such a hassle.

Here is what it actually accomplished

ShawnCplus 456 Code Monkey Team Colleague

EDIT:
I found the source of the problem. the getline call is causing the crash. I ran through and tested all the input and that is the only one causing a crash. So now that I've pinpointed the problem I just have to solve it. So what could be causing it to crash for Loadfile.getline(player.descrip, 56)?

> file = const_cast<char*>(filename.c_str());
Why are you casting away the const-ness here?
Doesn't ifstream Loadfile(filename.c_str(), ios::in); work?

nope, it's an invalid cast from const char* to char* .

I have the identical function for SaveChar though it's an output stream and it works fine.

void SaveChar(Entity &player, char saveNum)
{
     string filename;
     string saves;
     saves = saveNum;
     filename = "save/Save" + saves + ".sav";
     char *file;
     file = const_cast<char*>(filename.c_str());
     ofstream SaveFile;
     SaveFile.open(file, ios::out);     
     
     if (!SaveFile)
     {
       cout<<"Whoops, something went wrong!"<< endl;
       return;
     }
         if ( SaveFile.is_open() )
         {
              try
              {
                  SaveFile << player.name << endl;
                  SaveFile << player.health << endl;
                  SaveFile << player.strength << endl;
                  SaveFile << player.inRoom << endl;
                  SaveFile << player.descrip << endl;
                  SaveFile << player.isNPC << endl;
                  SaveFile << player.hasScript << endl;
              }
              catch (exception&)
              {
                  cerr<<"Something went horribly wrong!"<< endl;
              }
         }
     SaveFile.close();
}

This works completely fine.

As per the function being called, I've edited it on a few occasions where the outside variables are ignored and I use static arguments to the constructor. IE. ifstream Loadfile("save/Save1.sav", ios::in)

ShawnCplus 456 Code Monkey Team Colleague

I'm having a slight problem. This particular function is crashing caused by the Loadfile ifstream being opened.

void LoadChar(Entity players[], char saveNum)
{
     string filename, saves;
     saves = saveNum;
     filename = "save/Save" + saves + ".sav";
     char *file;
     file = const_cast<char*>(filename.c_str());
    
     ifstream Loadfile(file, ios::in);  //this little diddy right here

     if (!Loadfile)
     {
       cout<<"Error saving player data!"<< endl;
       return;
     }
     if ( Loadfile.is_open() )
     {
              try
              {
                  Loadfile >> players[0].name;
                  Loadfile >> players[0].health;
                  Loadfile >> players[0].strength;
                  Loadfile >> players[0].inRoom ;
                  Loadfile.getline(players[0].descrip, 56);
                  Loadfile >> players[0].isNPC;
                  Loadfile >> players[0].hasScript;
              }
              catch (exception&)
              {
                  cerr<<"Something went horribly wrong!"<< endl;
              }
     }
     Loadfile.close();

}

I surrounded the problem line with a try/catch block and it catches as a st9exception which is about as useful as telling me something went wrong.

Anyone have any ideas on why this is happening, I had the same problem with the SaveChar function and I completely forgot how I fixed it.

ShawnCplus 456 Code Monkey Team Colleague

Most likely you've seen a flash MP3 player or two while searching the web but I have a favorite. This is the JW MP3 Player, mainly because it has external JavaScript functions that can be used to access data about the player dynamically. I've written a few things for it that don't come "standard." While searching around I found a CSS progress bar and found it pretty pointless since it's static, then I put 2 and 2 together. This is a little script that can be used with the external functions of the MP3 player to show the loading buffer.

The JavaScript for the external functions are found at http://www.jeroenwijering.com/extras/javascript.html
After adding the the variables to allow external javascript functions in the player (explained in the readme).

  1. Add a currentLoad variable to the script.
  2. Inside of the getUpdate function add
    var id2 = document.getElementById(typ);
  3. Below else if(typ == "item") add the following
    else if(typ == "load"){currentLoad = pr1;}
  4. After that line go below the if(typ == "time") add this line
    else if(typ == "load"){id2.style.width = (currentLoad-1)+"%" ;}

Done with the JavaScript, now onto the CSS for the image-less progress bar.
In your stylesheet add the following

#prog-border {
  height: 13px;
  width: 205px;
  background: #e6d3a9;
  margin: 0;
}
#load {
  height: 10px;
  margin: 1px;
  padding-right: 1px;
  background: #006600;
  width: 0%;
}

The colors can be changed any way you like which is the reason why I chose to go with …

iamthwee commented: nice +12
ShawnCplus 456 Code Monkey Team Colleague

If it's specific to Windows then use the Windows API since that's the purpose of it. Also, are you writing it just to see if you can or because you think there are some things cygwin lacks? I've used cygwin for a while and I find it a pretty decent virtual environment

ShawnCplus 456 Code Monkey Team Colleague

(Was sent in a PM, I figured I might as well post it for searching purposes)

Right from the start let's differentiate between the different types of text games. We have:
MUDs(Multi-User Dungeons): These are the bread and butter of the hack and slash genre of text games (most people play these). They have a Intermediate to small amounts of story for players to go on and focus on raw fun.

MUSH(Multi-User Shared Hallucination): These generally have no combat system to speak of and are solely for RP(RolePlaying) These are probably the second most popular

In both cases they focus very heavily on player interaction. If your game is not online and doesn't provide that interaction then the story, every room, every item, every mobile must have extremely in depth descriptions to make up for it.

Well what you want to write is more of a Zork clone with a sci-fi twist. The whole point of a MUD is to be a MULTI-USER Dungeon.
Manual combat is much harder to code than automated combat, room-based areas is definitely the easy way to go, overworld being the next easiest and grid-based has only been pulled off successfully in one MUD that I know of EVER.

By in-game building system AKA OLC (OnLine Creation), will you allow other people (most likely admins[imps, immortals]) to create areas, items, mobs directly in the game?

By Mob scripting I mean a scripting system in which each mobile …

ShawnCplus 456 Code Monkey Team Colleague

You forgot brackets for the while loop so it's only doing the first if-check

while(condition)
{
    //do this stuff
}
ShawnCplus 456 Code Monkey Team Colleague

hi, it could be that your video card doesn't match with the required specs of the games...

Yeah if it's a new computer that's not the case. I ran Gunbound on a 5 year old computer with embedded video.

ShawnCplus 456 Code Monkey Team Colleague

Yeah, I fixed it. The line that was actually checking the alphabetical order wasn't comparing the characters. And switching to a char* array forces me to use strcmp and the sub-point of it was to sort the array without any extra functions. But using NULL was fairly ingenious *thumbs up*. It's not like it really matters it was just something to do while I was bored. (Bad things happen when I'm bored... mainly to my computer)

ShawnCplus 456 Code Monkey Team Colleague

Well this is my problem, I wrote a function to sort a 2d char array but right now the second dimension bound cannot be variable so it has to be hardset (which I don't particularly like)

This is what I have

void multi_charSort(char array[][5])
{
    int i,j;
    char temp2[5];
    for(i=0;i<5;i++)
    {
        for(j=0;j<i;j++)
        {
                    
             if((array[i][0]>='A' && array[i][0]<='Z') && (array[j][0]>='A' && array[j][0]<='Z'))
             {
                 if(array[i]>array[j])
                  {
                        for (int k=0;k<5;k++)
                        {
                            temp2[k]= array[i][k]; 
                            array[i][k]=array[j][k];
                            array[j][k]=temp2[k];
                        }
                  }
             }
             else if((array[i][0]>='a' && array[i][0]<='z') && (array[j][0]>='a' && array[j][0]<='z'))
             {
                  if(array[i]>array[j])
                  {
                        for (int k=0;k<5;k++)
                        {
                            temp2[k]= array[i][k]; 
                            array[i][k]=array[j][k];
                            array[j][k]=temp2[k];
                        }
                  }
             }   
       }
   }
}

Output:

2d char Array initialized!
Printing char Array:
1: Shaw
2: Tom
3: Bill
4: Adam
Sorting charArray!
1: Adam
2: Bill
3: Tom
4: Shaw

Any suggestions? (I'm also not completely sure if this is sorting correctly)

ShawnCplus 456 Code Monkey Team Colleague

School have filters in place for a reason. The state and/or federal government requires the schools to place filters on the network in order to be given certain grants. I remember when I first started working as an Admin at my old school I asked why they put filters on them in the first place and that was the answer I got.

They get grants for new computers and wicked discounts on computers they buy, otherwise school taxes would go through the roof and your parent's would not be pleased. Nor would you if your school couldn't afford new computers having to pay near-retail.

And if you have a good reason to visit a certain website just ask your Net Admin kindly and he will probably unblock it. Sites like Myspace and Facebook should be blocked during school hours, that's what your home computer is for.

ShawnCplus 456 Code Monkey Team Colleague

I'm fairly sure the Gunbound website has the updated drivers on the same page you downloaded the game. Otherwise just update the drivers by going to the OEM website.

ShawnCplus 456 Code Monkey Team Colleague

Well, as i said, i myself would really like to learn how to go about all this stuff.

Well there are a few things you would have to ask yourself:

  • What is the theme going to be?
  • Automated or Manual combat system?
  • Online? (will you need to code sockets?)
  • Encryption for passwords? (SHA256 recommended)
  • Room based, grid based, or overworld?
  • Quest systems?
  • Ingame building system?
  • Mob scripting system?

This is just a few out of a huge collection of details you have to ask yourself before you even begin to code. I recommend heading over to MudConnector.com and join in on some discussions.
I've been MUDding for about 7-8 years, been an administrator for 2 and been coding them for about a year and a half. Detail is key if you want a good game, most fail within the first month if not the first week.

If you have anymore questions feel free to PM me or shoot me an email.

Killer_Typo commented: Great information +5
ShawnCplus 456 Code Monkey Team Colleague

You might want to take a look at existing C++ codebases such as SocketMUD, and I believe TinyMUD is C++. ftp.game.org has a huge archive of mud codebases along with MudBytes.net

Building your own codebase is an extermely in-depth endeavor and most are written with entire teams upwards of 10 people. I have made additions and changes to existing codebases (mainly SmaugFUSS),
this is much easier. Diku, was original made at the University of Copehagen so perhaps your school can create the new Diku as it were, where hundreds of codebases would derive themselves from.

ShawnCplus 456 Code Monkey Team Colleague

ShawnCPlus's example will be of little use, since it doesn't even handle the general n x n case amongst other things...

Thanks, I appreciate that :)

ShawnCplus 456 Code Monkey Team Colleague

There is a snippet in the cplusplus section that I wrote to solve a matrix using Cramer's rule that might help you a bit.

http://www.daniweb.com/code/snippet643.html

ShawnCplus 456 Code Monkey Team Colleague

#include "stdafx.h"

if (x<0001 || x>9999);

Well, you put the if statement in there but you didn't really do anything. Look up if-check syntax in your book it should be:

if (var relation value)
{
     statement;
}

Example:

if (userInput == 93)
{
     cout<<"You entered "<<userInput<< endl;
}

That example is completely useless but it's good enough to show syntax. Though a while loop would probably be better for input validation since it would only show the message once then happily let you input an incorrect value.

ShawnCplus 456 Code Monkey Team Colleague

You want to run that by me again? If i enter a value from the keyboard-doesn't a program automatically do the calculation? You kinna lost me there.

Yes it does but you are trying to do the calculations before you have gotten any input. It is trying to do the math on a number that doesn't exist.

ShawnCplus 456 Code Monkey Team Colleague

Well firstly you are trying to do math with x before it actually has a variable so once it gets the others (a, b, c, d, e, sun) aren't actually giving the correct number

ShawnCplus 456 Code Monkey Team Colleague

You are trying to output the value of x before actually getting the value. IE. You are using cout<<x<< endl; before cin>> x;

ShawnCplus 456 Code Monkey Team Colleague

Do you have your Data Adapter and Data Connection configured correctly?

ShawnCplus 456 Code Monkey Team Colleague

Specifically what errors are you getting? When the program breaks look into the output window. It should throw an error like System.IO.InvalidCastException (just an example)

ShawnCplus 456 Code Monkey Team Colleague

Well what I mean is this:
If you have a situation in which you don't know the size an array needs to be, dimming and redimming just wont work, you can't define an array size with a variable.

Example

Dim x as Integer
Dim ExampleInput as Integer
ExampleInput = Val(InputBox("How Many Names do you want to put in?", "Input", 0)
Dim ExampleArray(ExampleInput) as String
For x=0 to (ExampleArray.Length-1)
     ExampleArray(x)  =  InputBox("What is the name?",  "Names",  "John Smith")
Next

It wouldn't even let you build that because you cannot use a non-constant to define the size of an array. But this would work:

Dim x as Integer
Dim ExampleInput as Integer
ExampleInput = Val(InputBox("How Many Names do you want to put in?", "Input", 0)
Const ExampleConst as Integer = ExampleInput
 Dim ExampleArray(ExampleConst) as String
For x=0 to (ExampleArray.Length-1)
     ExampleArray(x)  =  InputBox("What is the name?",  "Names",  "John Smith")
Next

This works and allows you to have a array sized at runtime instead of having a set size.

ShawnCplus 456 Code Monkey Team Colleague

If you mean redimming it on the fly then yes, I do that too.

Well redimming does not allow you to take input for the size of an array and it serves almost no purpose on top of destroying the contents of the array unless you preserve it. Redimming just like dimming does not let you use a non-constant variable for the new size

ShawnCplus 456 Code Monkey Team Colleague

It is most likely cause by DEP yelling at your program.
I'm not sure if there is an API to add your program to the exception list. You can test it on one machine by going to Control Panel -> System - > Advanced -> Click on Performance - > DEP and then adding your program to the exception list.

If that doesn't help, the only other thing I thought of was this.

When you build and run the app on your machine does it give the same problem? If it does what exception does it throw? in that case put the OpenDialog code around try/catch blocks

Try
<Your Code Here>
Catch Break as New <thrown exception here>
Endtry

That's the only way I could think of that would solve a problem.

ShawnCplus 456 Code Monkey Team Colleague

As many of you that have worked with VB.NET know, and have been irritated by, you can't use a nonconstant variable to size an array.

A simple workaround, reply if this is a problem, is to take input on the size of the array (Yes, I know you can't do this, but wait) Now you create a constant and set it equal to the new input. While this is not the best case scenario for working with many arrays (just go multidimensional).

I hope this helps, and if it is wrong or will cause problems someone tell me but it's worked for me.

iamthwee commented: Thanx for enlightening me (thwee) +8
ShawnCplus 456 Code Monkey Team Colleague

I have an acer 4504Lmi. It wouldn't start, went through steps, ordered a motherboard last night. I have one concern however. I have read in a few places that a virus can damage your motherboard. Is this true? I don't want to replace the motherboard and put my hard drive in and the same thing happens. Can you check somehow? BTW I had Norton System Works on my computer and it did find some virus's before the macing went down. I took care of the ones it found. Any help would be appreciated. Thanks

As far as I have ever known they cannot damage a mobo unless there are some code maniacs out there that can make the platters jump out of the case and onto the board:lol: , but some can however damage your hard drive in one sense by affecting various aspects of your OS and sometimes the MBR.

Some preventative maintenance is always a good idea though, run virus scans and update your definitions atleast once a week. Defragmentation is also a good habit to get into usually at bare minimum once every one-two months (depending on how much you download/delete/move/etc.)

ShawnCplus 456 Code Monkey Team Colleague

Well first and foremost my site is definitely not meant to be "professional", just look at the name. Secondly I made a new title with the Verdana font but kept the old one incase I want to switch back. The menu I really don't want to part with I just like it too much. The only thing I was thinking might happen with the logo is that I make it static. Also, regarding readability I have started uploading the exported html files, which one was already there when you went to the site. And in terms of portability I just don't care right now. If I write a program that I'm actually going to distribute that's not solely for the purpose of learning more about the language I'll focus on it, but until then I'll stick with my system() calls, though I do use cin.get for pauses.

ShawnCplus 456 Code Monkey Team Colleague

Hello,

I have received some tips to take advantage of the whitespace on my homepage and I was wondering; What is a good way to utilize whitespace in a way that still pertains to my website and doesn't overcrowd the page? I was thinking of using more defined spacers between the different areas of the site but I would like to get some more opinions. I believe there is a link to the site in my signature but if there isn't the link is LazyCode.info

Thank you in advance for any input.

ShawnCplus 456 Code Monkey Team Colleague

Well from what I can dig out of my very shallow pool of knowledge it seems that in your prototype you are telling it that you want it to accept a pointer but when you call the function you are passing by value instead of by reference IE. &list

ShawnCplus 456 Code Monkey Team Colleague

OK, my father evidentally gave my name to some lady to fix her computer but I got there and it is impossible to work on the computer as I left my spare monitor 120 miles away in my apartment. So here is the situation:
The monitor (Compaq FP5017) goes black for 4 seconds and then flashes the screen for a split second then continues to go black. At first I thought it was just a loose cable until I realized once I unlplugged the monitor it took 8 seconds for the monitor to even realize that it was unplugged.

I am fairly convinced the monitor is just shot since the screen is about as dirty as an LCD screen could possibly be I imagine there were multiple things dumped on/in the panel.

So if any of you have any suggestions that would be fairly helpful. If all else fails I'll just drive back to my place and grab the extra monitor.

Thank you.

ShawnCplus 456 Code Monkey Team Colleague

Is it a desktop or a laptop, because if it a desktop there is a jumper on the motherboard to reset the BIOS password. The label next to the pins should either be labelled BIOS PWD or something like that. If it is a laptop I do not believe there is a jumper. If you know someone that is fairly tech-savvy have them reset the BIOS password using the jumper. Hope that helps, and I apologize for the late response.

ShawnCplus 456 Code Monkey Team Colleague

He's somewhat right that it had to be reformatted but the fact that it was writing binary to the hard-drive is a little off since its ALWAYS writing binary to the hard-drive. 1s and 0s(on and off) is the only way something can be stored magnetically. Also did you try booting from a startup disk or a recovery disk before you thought of reformatting?

ShawnCplus 456 Code Monkey Team Colleague

Well one thing you could do to test and rule out the power supply is to take it back to that shop and have them try it in another computer. They should do this for free unless they are really mean, it literally takes 2 minutes. Or if you have a second computer at home and you know someone who is fairly knowledgeable I'm sure they wouldn't have a problem. However, the motherboard is a bit more work and will cost you a bit of money as you aluded to so you might also have the shop test the motherboard also though that is a bit more extensive and may cost you a little money.
There are a lot of people here more knowledgeable than myself so be sure to keep supplying information and I'm sure others can help you. I hope I helped atleast a little.

ShawnCplus 456 Code Monkey Team Colleague

They are correct about installing a 350 watt power supply, if you are replacing a power supply never install a lower wattage. But the fact that they told you that it would not work with the recovery disk is somewhat suspicious since the power supply doesnt really communicate with the BIOS and there would be no way for the computer to determine what type/brand of power supply you have.

ShawnCplus 456 Code Monkey Team Colleague

Sorry, while it is booting hold the F8 key, a menu screen should show up. One of the choices will be VGA Mode. Select that with the arrow keys and press enter. If it works past that then right click on the desktop and move over to the settings tab, drag the slider from whatever it currently is to whatever your choice is 800 x 600 if you have bad vision or 1024 x 768 which is the normal display for most computers. Click apply, and if it got this far restart and enjoy.

ShawnCplus 456 Code Monkey Team Colleague

Try botting in VGA mode with F8 the resolution may be set to high and making your screen freak out trying to provide a picture it just cant. Once in (if it works) check and change the resolution.

ShawnCplus 456 Code Monkey Team Colleague

I had a similar problem, it wasn't the box that you mentioned but it was a video of a grandma kicking a baby, there were no processes/hidden processes to speak of and no installed programs nor registry entries. How I got rid of it was pure luck, normally the mouse moves over it like its part of the background but one time I saw something flash when I moved over it so I tried a couple more times and a frame appeared around it with a small almost invisible X in the corner and click... gone. Don't know if there is a similar situation with your bug.

ShawnCplus 456 Code Monkey Team Colleague

I am not sure which solutions you tried but if this was not one of them it usually is the fix. There should be a fn key on your keyboard, hold that and repeatedly press the up arrow. Hope that helps, sorry if it doesn't.

ShawnCplus 456 Code Monkey Team Colleague

If you don't have a Windows XP boot discs there are many guides online that tell you step by step how to make an XP boot floppy. After creating it go into the BIOS and configure the floppy to be the first boot device.

ShawnCplus 456 Code Monkey Team Colleague

Well since it will not boot in safe mode the first thing you could do is create/obtain a Windows 2000 Boot disk. Please reply if you need help making one. If you boot from the disk and windows loads successfully then the problem is with one of the following: *Ntldr, *Ntdetect, *boot.ini, or there is a problem(virus) with the Master Boot Record. In which case for the files mentioned with the * they can be replaced by placing the file on a boot floppy and overwriting the old files. However, if the computer still refuses to boot, then it more than likely came with a recovery disk, boot with that and go into the recovery console, and type chkdsk /r at the prompt, if you recieve a message stating there is an invalid MBR, then run fixmbr. There are more steps but until I know the results of these steps they are of no use, reply to this and tell me which you have done and/or what has helped.

ShawnCplus 456 Code Monkey Team Colleague

Well first which is always a wide misconception is that Mbps is not MegaBytes but MegaBits. Also, in general Linksys is a good router but There are others out there if you want to shop around IE. Newegg, etc.

ShawnCplus 456 Code Monkey Team Colleague

OK, like I always do I'll ask a few basic questions, other than the hard drive did you add any new hardware or install any new programs? Have you tried to boot it in safe-mode?

ShawnCplus 456 Code Monkey Team Colleague

If you right click on an empty space on your desktop and move to the Appearance tab there will be a drop-down box at the bottom labeled Font size, if you move that to Large or Extra Large that should help significantly. Also in Internet Explorer and Mozilla Firefox you can change the font size by holding CTRL and pressing + on the number pad.

Hope that helps.

ShawnCplus 456 Code Monkey Team Colleague

Can you hear one(1) beep when the machine starts? Also are you sure the monitor cable is connected firmly and plugged in, if the cables aren't secured they pop out fairly easily.

ShawnCplus 456 Code Monkey Team Colleague

Sorry I made HUGE grammar error, I meant to say Are the hard drive cables firmly connected. Like cscgal said any media in a drive(floppy, cd, zip) or other could cause the computer to attempt to boot from the incorrect device. To reiterate on what cscgal said to go into the BIOS you usually have to hold the delete or F2 key (BIOS manufacturer dependent) while it is starting then going to the Boot Sequence option will show you which is first. Confirming these three things will show that it is not a BIOS conflict and more likely a hard drive failure (lets hope not).

ShawnCplus 456 Code Monkey Team Colleague

Well PCI is a white slot and AGP is a shorter normally brown slot with a retention clip around it (sometimes)