Jump to content
Cluas

I always wanted to make games

Recommended Posts

Hi all,

 

I'm glad to have joined theese forums, looking forward to PE, and i just wanted to say, i always dreamt of beeing part of making a game. It never really happened, but i got no regrets. Here is my story...

 

When i was younger i wanted to be a writer, but my massive interest in roleplaying made me make adventures for my friends in stead.

Then we played a lot of Baldur's Gate and Icewind Dale. Then i started making music, and couldn't decide a career path. I should have gotten into the business back then. But as i live in Denmark, there was really no options to get educated as a gamedeveloper, the market here is too little for that. My dreams kind of shattered. I got older made a lot of music, i got kids and thought, what the hell, it was just a dream, it would have never worked out for me. Then NWN came out, i thought wouw a toolset, let metry this. Got new hope i guess. Time to make a game.

 

I did get to make games. I made a few modules for my kids to play. They loved it. It educated them to learn to read better (and to think for themselves). And kill the bad evil monsters all around them just like in real life.

 

Now here i am, thinking how different my life could have been, had i been a little wiser in my younger days. I am no expert in anything beeing a self-learner. I COULD have been. I am very good allround, as long as things don't get too complicated. I have done stuff like translating, music, 3D, and even storytelling (and programming in Aurora - i was using a script generator, and never wrote much code, but i learned how the basic scripting workes).

 

So what i am really trying to say, is that i am happy things played out this way. As long as i know that I COULD HAVE been a game maker.

And for all the bright people out there, that got cought by the headline, my advise is: Follow your dreams where ever they take you.

 

I chose this different path, as it was destined long ago. Now im a happy amatour, making my stories come to life.

 

- Now that's a happy ending, right ?

 

 

:cat: (thought this 'smiley' was the cutest)

 

And sorry for my spelling :biggrin:

Hope the mods can move this if it's in the wrong subforum

Edited by Cluas
  • Like 1

UFWDJRj.jpg

Share this post


Link to post
Share on other sites

yeah, really got some same as that time I hadn't got involved into the game industry. Got that thinking when I was in high school, that time in China the PC game was just become popular, and most families still haven't got computer, so did my family. The chances that I play the games is in others' home and internet bar. So when I at home I have to copy those games in a pen and paper version, such as Heroes of M & M and Civilization. And like most players, always got such "that could be better if put this in..." or "if that story could be..." thinking, then I decided to be a game designer in my rest life, and as there's no such a education for game making(especially for designer) in China that time, I chose a computer major as a path for what I want to be, and when the university time I finally got my first computer, and then catch up lots of games that I should've played at early time, and as I want to be a designer not just a coder, I began to analyse games when I was playing, which is good, which is bad, and use some editor try some modding. On the other hand, after 4 years muddling, I graduated, then try to find some game designer jobs, I've sent some resume to 2K, UBI or kind of that, but no reply, I know I may not be qualified, but I still feel lost, don't know the future of mine.

With a coincidence I took my life to Australia, after another muddling life, in the end of 2011, at the point of my 25, I make a thought of my life again, I still want to get into this industry, no matter how hard I would be. Then I back to Shanghai start my plan to get into the industry, I start apply QA jobs and other job that need low qualification, and also began getting some game developing knowledge. Luckly, I found a translation job in a small game company and then getting doing the executive designer work after some weeks.

So as you said,

my advise is: Follow your dreams where ever they take you.
Sometimes it really feel great if you can realize the dream, yes, some one might say that job won't gets lots of money, and look at that lawyer, earn some much. But I was happy when I making games, that's it. Now what troubles me is how can I move on, to make some games I really interested, not just make some IOS or Andorid nameless trash(as most Chinese Company does).
  • Like 2

I have struggle to understand a Universe that allows the destruction of an entire planet. Which will win this endless conflict - destruction or creation? The only thing I know for certain is never to place your faith entirely on one side. Play the middle if you want to survive.

 

Everyone else is a fanatic. I am Gauldoth Half-Dead. Your savior.

Share this post


Link to post
Share on other sites

Hi all,

 

I'm glad to have joined theese forums, looking forward to PE, and i just wanted to say, i always dreamt of beeing part of making a game. It never really happened, but i got no regrets. Here is my story...

 

When i was younger i wanted to be a writer, but my massive interest in roleplaying made me make adventures for my friends in stead.

Then we played a lot of Baldur's Gate and Icewind Dale. Then i started making music, and couldn't decide a career path. I should have gotten into the business back then. But as i live in Denmark, there was really no options to get educated as a gamedeveloper, the market here is too little for that. My dreams kind of shattered. I got older made a lot of music, i got kids and thought, what the hell, it was just a dream, it would have never worked out for me. Then NWN came out, i thought wouw a toolset, let metry this. Got new hope i guess. Time to make a game.

 

I did get to make games. I made a few modules for my kids to play. They loved it. It educated them to learn to read better (and to think for themselves). And kill the bad evil monsters all around them just like in real life.

 

Now here i am, thinking how different my life could have been, had i been a little wiser in my younger days. I am no expert in anything beeing a self-learner. I COULD have been. I am very good allround, as long as things don't get too complicated. I have done stuff like translating, music, 3D, and even storytelling (and programming in Aurora - i was using a script generator, and never wrote much code, but i learned how the basic scripting workes).

 

So what i am really trying to say, is that i am happy things played out this way. As long as i know that I COULD HAVE been a game maker.

And for all the bright people out there, that got cought by the headline, my advise is: Follow your dreams where ever they take you.

 

I chose this different path, as it was destined long ago. Now im a happy amatour, making my stories come to life.

 

- Now that's a happy ending, right ?

 

 

:cat: (thought this 'smiley' was the cutest)

 

And sorry for my spelling :biggrin:

Hope the mods can move this if it's in the wrong subforum

 

You should've taken the games over the kids bro.

Share this post


Link to post
Share on other sites

You should've taken the games over the kids bro.

 

He might be happier with them than if he had gone into games, ultimately that's his choice to make.


"A little inaccuracy sometimes saves a ton of explanation."
-H. H. Munro

 

"Geez. It's like we lost some sort of bet and ended up saddled with a bunch of terrible new posters on this forum."

-Hurlshot

 

 

Share this post


Link to post
Share on other sites

 

You should've taken the games over the kids bro.

 

Really? I don't understand? Are you saying i should not have brough my children into this world?

If i could choose today between my children and a career, what would i choose? Do you have any children?

  • Like 1

UFWDJRj.jpg

Share this post


Link to post
Share on other sites

You should've taken the games over the kids bro.

 

Really? I don't understand? Are you saying i should not have brough my children into this world?

If i could choose today between my children and a career, what would i choose? Do you have any children?

 

We don't want your children. Sex is not rape. You must choose the right time to have a child. The right time is when you can financially support them. This means everything from therapy to education to basic essential like food, love, etc.

 

If you are too ill to raise your children, don't have children. Get therapy yourself.

 

Children need parents to take care of them, not a full time job raising their guardian to be upstanding citizen . You offend all virgins. The world is 7 billion strong and you have the nerve to tell us it's our problem you didn't get to play/make games? IT WAS YOUR CHOICE TO HAVE A CHILD.

 

And don't forget you brought your family into this and not us.

 

A plan for you:

1. Are your kids adults yet? If so you have no excuse not to be living up your video-game producing dreams.

2. Are your kids not adults yet? Then wait until they are. Keep in good health while.


redacted

Share this post


Link to post
Share on other sites

You should've taken the games over the kids bro.

 

Really? I don't understand? Are you saying i should not have brough my children into this world?

If i could choose today between my children and a career, what would i choose? Do you have any children?

 

Obviously you would choose your career. As such without that your children would die of starvation or you would be humiliated in having them have been taken from you for being a **** parent with no job. Boom. You should have aken the games bro.

Share this post


Link to post
Share on other sites

...for being a **** parent with no job.

 

I'm not seeing where he said he lacked a job, he simply said he did not go into the gaming industry.


"A little inaccuracy sometimes saves a ton of explanation."
-H. H. Munro

 

"Geez. It's like we lost some sort of bet and ended up saddled with a bunch of terrible new posters on this forum."

-Hurlshot

 

 

Share this post


Link to post
Share on other sites

 

Obviously you would choose your career.

 

Obviously You don't have children. ;(

 

Children need parents to take care of them, not a full time job raising their guardian to be upstanding citizen . You offend all virgins. The world is 7 billion strong and you have the nerve to tell us it's our problem you didn't get to play/make games? IT WAS YOUR CHOICE TO HAVE A CHILD.

 

And don't forget you brought your family into this and not us.

 

A plan for you:

1. Are your kids adults yet? If so you have no excuse not to be living up your video-game producing dreams.

2. Are your kids not adults yet? Then wait until they are. Keep in good health while.

 

Yeah you both misunderstood - So the plan is no good, but thanks for the reply's. All virgins offended can PM me :biggrin:


UFWDJRj.jpg

Share this post


Link to post
Share on other sites

I spent a few teenage years dipping my toes in and out, but mostly amounted to several barely-finished NWN area files, lots of word files and such. I don't actually think I'd like to work in the games industry, and I think I knew that deep down - from what I know of the process, especially these days, I wouldn't have wanted to make it a career.

 

But it's a pity I never buckled down and actually finished a mod or two. I still want to reach that stage, but sadly it's rarely high enough on my priority.

  • Like 1

Share this post


Link to post
Share on other sites

I spent a few teenage years dipping my toes in and out, but mostly amounted to several barely-finished NWN area files, lots of word files and such. I don't actually think I'd like to work in the games industry, and I think I knew that deep down - from what I know of the process, especially these days, I wouldn't have wanted to make it a career.

 

But it's a pity I never buckled down and actually finished a mod or two. I still want to reach that stage, but sadly it's rarely high enough on my priority.

 

I apologize for you having the kill the thread. I see you only had to do was necessary. Please accept my apologies.

  • Like 1

Share this post


Link to post
Share on other sites

This has got to be one of the weirdest threads I have seen in a long time.

 

I'm hoping there's a lot of Poe's Law in effect here because otherwise I'm just mostly confused....

 

Everyone is Prosper, Prosper is everyone.

Share this post


Link to post
Share on other sites

I've always wanted to make games too, since I was playing stuff on C64 back in the 80's. But, after looking at the industry for the last 15 years or so there is one thing I am very certain of now: I still want to do it, but I'd rather not do it for a living.

 

I'm a Sr. Enterprise Admin, I like it and I'm good at it. Ironically, I probably get to write more "passion" code here than I would have if I had worked for a gaming studio. The code I write is entirely related to making my own job easier, as opposed to some random middleware platform connector code I could care less about.

  • Like 1

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Share this post


Link to post
Share on other sites
The code I write is entirely related to making my own job easier, as opposed to some random middleware platform connector code I could care less about.

You're assuming that your job would consist of hooking up middleware all day. I work with middleware on a regular basis, but it is not what defines my job in the least.

  • Like 1

https://twitter.com/IridiumGameDev

Ex-Obsidian Senior Programmer

Share this post


Link to post
Share on other sites

You're assuming that your job would consist of hooking up middleware all day. I work with middleware on a regular basis, but it is not what defines my job in the least.

 

Well of course it's not all you do, and I didn't actually mean for it to sound that way. What I meant was that I don't think I could code for a living when so much of what I do wouldn't be for my own personal benefit. I like doing it when it saves me time, and wouldn't find it as interesting if it were part of some larger project not directly consumed by myself. You might say that, where coding is concerned, I like to tinker, but not get into large scale industrial production. Not that there's anything wrong with that, if it's what you like to do.

  • Like 1

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Share this post


Link to post
Share on other sites

This has got to be one of the weirdest threads I have seen in a long time.

 

I'm hoping there's a lot of Poe's Law in effect here because otherwise I'm just mostly confused....

 

Off course there isn't. My intentions was to confuse you :devil:

 

(Just kidding, friend. Meant you no harm by making this thread)

 

BTW: Wierd is my middle name :biggrin:


UFWDJRj.jpg

Share this post


Link to post
Share on other sites

I'm in a similar boat.

 

Been modding for years - 3D models, 2D sprite art, texturing, map-making, scripting, writing, balancing.. heck even did a bit of music.

Worked on a LOT of various mods. Even helped a few proper projects (like UFO: AI, Infinity). Freelanced a few models for a real game development studio.

 

I'm a decent all-rounded, but balancing and 3D modeling are my real forte.

 

Now I work as a Junior DBA and IT (a little bit of everything really...but to be honest I'm not that good at it) and I do wonder what it would be like if I really worked in a gaming industry.

But from a little personal experience I can tell you it wouldn't be quite as interesting - working on what other people tell you insted of doing your own stuff is a big difference.

Edited by TrashMan
  • Like 1

* YOU ARE A WRONGULARITY FROM WHICH NO RIGHT CAN ESCAPE! *

Chuck Norris was wrong once - He thought HE made a mistake!

 

Share this post


Link to post
Share on other sites

I do wonder what it would be like if I really worked in a gaming industry.

But from a little personal experience I can tell you it wouldn't be quite as interesting - working on what other people tell you insted of doing your own stuff is a big difference.

If you're passionate about something, then even the "boring" or mundane work becomes a lot more interesting.  Every bit of work you do contributes to the creation of something that thousands (or millions!) of people will see.  Sure, there is plenty of work that you get "stuck" with that you'd prefer someone else do, but that's true with any job.  

 

By no means am I saying this industry is for everyone, but, personally, I find it very rewarding.

  • Like 2

https://twitter.com/IridiumGameDev

Ex-Obsidian Senior Programmer

Share this post


Link to post
Share on other sites

My personal experience with the game industry as a software engineer has been overall not very positive. High pressure to deliver a working product under a tight schedule, stringent performance requirements, not nearly enough time to master the tools and engine - by the time the game ships is approx. the time developers start understanding what they're working with as far as technology; this all means code is sloppy, hackish, not much refactoring goes on, summary code reviews at best, metrics are non-existent, unit tests are non-existent, nobody knows if stuff is really working - "it works at my desk!" is the standard and then you hire an army of teenage drones to randomly mash buttons and produce thousands of bug reports i.e. what they call a beta test. Long hours, high stress, lots of potential candidates at the door waiting to replace you if you don't like unpaid overtime. Also C++ i.e. the by far least productive and most ****ed up language in mainstream use is endemic in the game industry, although depending on performance requirements, more or less "scripting" can get done in higher-level languages (i.e. C#, Lua, etc).

 

One can look past all that if one's passionate enough about games, I decided I wasn't. Your call.

Edited by Zeckul
  • Like 1

Share this post


Link to post
Share on other sites

 

 

One can look past all that if one's passionate enough about games, I decided I wasn't. Your call.

Thanks friend, good post :yes:


UFWDJRj.jpg

Share this post


Link to post
Share on other sites

High pressure to deliver a working product under a tight schedule, stringent performance requirements, not nearly enough time to master the tools and engine - by the time the game ships is approx. the time developers start understanding what they're working with as far as technology;

 

No doubt the industry isn't for everyone and you will definitely have your companies where they are a charm to work for and those that are dreadful. Yes there are deadlines, yes there are hardware and performance issues to keep in mind, and your game and tools evolve as the project goes. But it's really how you approach your job that can affect how your experience will be.

 

To be honest, some of the issues you mention are fun to tackle sometimes. Making an important piece of your engine more efficient either memory or speed wise is actually enjoyable to most of us when we do it. And the real way to solve those problems is to try to implement features that are already speed and memory conscious to begin with so you don't have to dig too much as the project continues. Also, make sure to bounce ideas off of your fellow coworkers before starting. A lot of times someone you are talking to can suggest a solution that's a little faster or memory efficient than you were originally planning to try.

 

this all means code is sloppy, hackish, not much refactoring goes on, summary code reviews at best, metrics are non-existent, unit tests are non-existent, nobody knows if stuff is really working - "it works at my desk!" is the standard

 

Is there hacked/sloppy code? Sure, it's inevitable at some point. But, hacked and sloppy code can be prevented with some discipline. One of the hardest things to do as a programmer is to not always do exactly what you are told. For example, a designer may request that you give the player 25 bonus health if the player was able to beat the boss without using any magic or, if they beat the boss under two minutes or, if they only used nothing but ranged attacks. They also want this in the game within 2 days so they can show it off in the next team meeting. So, it's very easy for you to go "Okay, I can do that." and program in the code that gives the player 25 extra health if they fulfilled those challenges.

 

Boom! You're done, designer is happy, you even finished it with the given estimated 2 days they gave you, you're the champ. However, this is actually an easy trap to fall into and how projects can become slop and a pain to keep developing.

 

A better way to approach such a problem would be to try to do as little specifics as possible and to build something that can do a lot more and what was requested. So instead, make the game track a ton of stats while you are fighting (number of spells used, number of items used, time fighting a boss, damage taken, times died, etc.). Track anything you think might ever be relevant to know. Then, build a system that allows the designers to check these values and make whatever conditions they want (I.E if "number of spells used" is less than 3, etc.). Then make it so it also allows them to specify the rewards given if conditions are met (give the player 25 extra health, give the player 100 extra gold, etc.). 

 

Now, not only did you give them the ability to do exactly what they asked, they can now change what the originals conditions and rewards were (i.e. change the 25 bonus health to 50), and they can add even more conditions and rewards without having to come bother a programmer. Yes, you may spend a little more time doing it this way, but it almost always saves you more than double that time in the future when designers inevitably change their minds or, new features get requested where you can leverage your existing systems to solve the issues. Plus, your code becomes more generic and easier to bug fix. Sure you can't do that for every single feature but, if you do it more often than not, you will have a better product that's quicker to develop, easier to manager, and will keep you from binge drinking after work.

 

lots of potential candidates at the door waiting to replace you if you don't like unpaid overtime.

 

Good developers are hard to come by. And from my experience alone, the developers I have worked with are not easy to replace. There sometimes can be turnaround in game development studios but, a majority of it is people just moving to new places or new things. 

 

Also C++ i.e. the by far least productive and most ****ed up language in mainstream use is endemic in the game industry, although depending on performance requirements, more or less "scripting" can get done in higher-level languages (i.e. C#, Lua, etc).

 

C++ is a very straight forward language where everything is exposed and there isn't really any "magic" going on once you know it. It's not hard to be productive with it nor is it much harder than programming in something like C#. While higher level languages add some form of ease to themselves, they usually do at a performance and/or memory cost. Sometimes, to figure out where your performance hits are coming from with languages like C#, you have to start learning a lot of the unseen nitty-gritty stuff which can end up making it more complicated to work with than C++. Even simple issues like "boxing" in C# are hard to spot and can become major problems performance wise. That's the beauty in C++, everything is pretty straight forward. What effort you put into it, you get out. Scripting languages are good to have and good for designers but, you don't want to be building an entire game engine with it.

  • Like 1

Twitter: @robyatadero

Share this post


Link to post
Share on other sites

If you're passionate about something, then even the "boring" or mundane work becomes a lot more interesting.  Every bit of work you do contributes to the creation of something that thousands (or millions!) of people will see.  Sure, there is plenty of work that you get "stuck" with that you'd prefer someone else do, but that's true with any job.  

 

By no means am I saying this industry is for everyone, but, personally, I find it very rewarding.

 

I can agree with this because many might find SysOp work, the Component Information Model and Windows Installer tables boring. Personally, I like the challenge the obscurity of such things provides, as well as the surprise a client shows when you manage to deliver something they don't expect. i.e. "I didn't know you could tell me how many memory slots were used/unused in bulk like that." "Actually, I can include the serial numbers off the DIMMs if the vendor's system board supports it." :biggrin:

 

I can code in a number of languages, but VBScript is what I use most of the time by far. While it definitely isn't the greatest language out there, it gets what I need and quickly. I can tell you from experience that there's no quicker fix for applying client settings to an install where the vendor didn't bother to support transforms in their MSI packages. Power Shell is much better, but it can't be my focus until more clients GTF off of Windows XP.

  • Like 1

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Share this post


Link to post
Share on other sites

 

 

Also C++ i.e. the by far least productive and most ****ed up language in mainstream use is endemic in the game industry, although depending on performance requirements, more or less "scripting" can get done in higher-level languages (i.e. C#, Lua, etc).

C++ is a very straight forward language where everything is exposed and there isn't really any "magic" going on once you know it. It's not hard to be productive with it nor is it much harder than programming in something like C#. While higher level languages add some form of ease to themselves, they usually do at a performance and/or memory cost. Sometimes, to figure out where your performance hits are coming from with languages like C#, you have to start learning a lot of the unseen nitty-gritty stuff which can end up making it more complicated to work with than C++. Even simple issues like "boxing" in C# are hard to spot and can become major problems performance wise. That's the beauty in C++, everything is pretty straight forward. What effort you put into it, you get out. Scripting languages are good to have and good for designers but, you don't want to be building an entire game engine with it.

 

 

I'll add to what Roby said from my own research: C++ is really a mid-level language. I think one of the reasons it's used in the gaming industry so much is due to memory management. Consoles in particular have very tight on memory space and leaving the details to a garbage collector just won't work there. Automatic memory management is anything but efficient, and can even create a host of issues that result in frame stutter, etc. I'll drop a quote from the book Game Engine Architecture, "Memory management. Virtually every game engine implements its own custom memory allocation system(s) to ensure high-speed allocations and deallocations and to limit the negative effects of memory fragmentation." - Jason Gregory. Game Engine Architecture (Kindle Locations 461-462). Kindle Edition.

 

If you were writing system level API's or kernel code then C/C++ is one of very few suitable languages. There is a whitepaper out on the web that highlights the pitfalls a MIT research team ran into trying to write an OS kernel in a high level language called Haskell.

 

 

 

this all means code is sloppy, hackish, not much refactoring goes on, summary code reviews at best, metrics are non-existent, unit tests are non-existent, nobody knows if stuff is really working - "it works at my desk!" is the standard

Is there hacked/sloppy code? Sure, it's inevitable at some point. But, hacked and sloppy code can be prevented with some discipline. One of the hardest things to do as a programmer is to not always do exactly what you are told. For example, a designer may request that you give the player 25 bonus health if the player was able to beat the boss without using any magic or, if they beat the boss under two minutes or, if they only used nothing but ranged attacks. They also want this in the game within 2 days so they can show it off in the next team meeting. So, it's very easy for you to go "Okay, I can do that." and program in the code that gives the player 25 extra health if they fulfilled those challenges.

 

Boom! You're done, designer is happy, you even finished it with the given estimated 2 days they gave you, you're the champ. However, this is actually an easy trap to fall into and how projects can become slop and a pain to keep developing.

 

A better way to approach such a problem would be to try to do as little specifics as possible and to build something that can do a lot more and what was requested. So instead, make the game track a ton of stats while you are fighting (number of spells used, number of items used, time fighting a boss, damage taken, times died, etc.). Track anything you think might ever be relevant to know. Then, build a system that allows the designers to check these values and make whatever conditions they want (I.E if "number of spells used" is less than 3, etc.). Then make it so it also allows them to specify the rewards given if conditions are met (give the player 25 extra health, give the player 100 extra gold, etc.).

 

Now, not only did you give them the ability to do exactly what they asked, they can now change what the originals conditions and rewards were (i.e. change the 25 bonus health to 50), and they can add even more conditions and rewards without having to come bother a programmer. Yes, you may spend a little more time doing it this way, but it almost always saves you more than double that time in the future when designers inevitably change their minds or, new features get requested where you can leverage your existing systems to solve the issues. Plus, your code becomes more generic and easier to bug fix. Sure you can't do that for every single feature but, if you do it more often than not, you will have a better product that's quicker to develop, easier to manager, and will keep you from binge drinking after work.

 

 

 

Changing my style to write most code as functions in VBScript was one of the most helpful things I've ever done. Being able to reuse code in more than one script to address more than one piece of data is a huge time saver. So, yea... I can see why writing something that allows you to dynamically adjust rewards, as opposed to hard-coding that +25 health, would be very useful.

 

My first really large script was used to convert a large and sloppy single table billing database into a 4 table relational database and to normalize the data in the process. One of the functions I wrote was named ExtractPhoneNumber, and has been used dozens of times since. The original database front end had no pattern enforcement, so phone numbers were formatted at the whim of the person entering the data.

Function ExtractPhoneNumber(sPhoneData)

        ' This function returns a monolithic integer representing a phone number.
        ' A return length of 10 digits indicates that only a phone number exists.
        ' A return length of 13 to 15 indicates that an extension is also included.
        ' All digits after 10 represent the extention, if it exists.
        ' A return value of Null indicates that the operation wasn't successfull.

	Dim oRootExp, oPartExp, oRootMatch, oPartMatch, sExtractedNumber

	sExtractedNumber = ""
	
	Set oRootExp = New RegExp
	Set oPartExp = New RegExp
	oRootExp.IgnoreCase = True
	oPartExp.IgnoreCase = True
	oRootExp.Global = True
	oPartExp.Global = True
	
	' This expression finds numeric pattern: XXX*XXX*XXXX Where X's are numbers.
	' The * can be one or more of any non-numeric characters. Regardless of the
        ' spacing or characters in between, 3 digits followed by another 3 followed 
        ' by 4 more is most likely what we're looking for in a phone number.
	oRootExp.Pattern = "\d{3}[^\d]+\d{3}[^\d]+\d{4}"
	
	If oRootExp.Test(sPhoneData) Then
	
		Set oRootMatch = oRootExp.Execute(sPhoneData)
		
		oPartExp.Pattern = "\d{3}" ' Finds three consecutive numerics.
		Set oPartMatch = oPartExp.Execute(oRootMatch.Item(0))
		sExtractedNumber = sExtractedNumber & oPartMatch.Item(0) ' First Trio
		sExtractedNumber = sExtractedNumber & oPartMatch.Item(1) ' Second Trio
		Set oPartMatch = Nothing
		
		oPartExp.Pattern = "\d{4}" ' Finds four consecutive numerics.
		Set oPartMatch = oPartExp.Execute(oRootMatch.Item(0))
		sExtractedNumber = sExtractedNumber & oPartMatch.Item(0)
		Set oPartMatch = Nothing
		
		Set oRootMatch = Nothing
		
	End If
	
	' This expression finds the letter X followed by any number of
	' non-numerics, including none, followed by 3-5 consecutive numerics.
        ' The existance of a prefix letter X is necessary to make sure that
        ' part of an actual phone number isn't mistaken for an extension number.
	oRootExp.Pattern = "X[^\d]*\d{3,5}"
	
	If oRootExp.Test(sPhoneData) Then
	
		Set oRootMatch = oRootExp.Execute(sPhoneData)
		
		oPartExp.Pattern = "\d{3,5}" ' Finds 3-5 consecutive numerics.
		Set oPartMatch = oPartExp.Execute(oRootMatch.Item(0))
		sExtractedNumber = sExtractedNumber & oPartMatch.Item(0)
		Set oPartMatch = Nothing
		
		Set oRootMatch = Nothing
		
	End If
	
	Set oPartExp = Nothing
	Set oRootExp = Nothing
	
	If sExtractedNumber = "" Then
		ExtractPhoneNumber = Null
	Else
		ExtractPhoneNumber = sExtractedNumber
	End If		

End Function
 

FYI - I'm not a fan of Hungarian notation in general, and I'd never use it in a strongly typed OO language. However, VBScript is not only very weakly typed, it also has some very strange implicit conversions that can make run-time bugs a nightmare. For instance, Boolean True converts to signed integer -1 !!! Now imagine starting up a For-Loop to your miss-typed Boolean identifier and trying to figure out why the script freezes.

  • Like 1

Fere libenter homines id quod volunt credunt. - Julius Caesar

 

:facepalm: #define TRUE (!FALSE)

I ran across an article where the above statement was found in a release tarball. LOL! Who does something like this? Predictably, this oddity was found when the article's author tried to build said tarball and the compiler promptly went into cardiac arrest. If you're not a developer, imagine telling someone the literal meaning of up is "not down". Such nonsense makes computers, and developers... angry.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...