Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Defining Global Variables

Author
Message
Rizzle
18
Years of Service
User Offline
Joined: 1st Aug 2006
Location:
Posted: 2nd Aug 2006 18:01
I need to know how to do this, as I am using the following:

DIM Variable_Name()

and making an array with only 1 stored integer for my variables....

There's got to be a more memory efficient way to store just a single global variable....check my code

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 2nd Aug 2006 18:12
Quote: "There's got to be a more memory efficient way to store just a single global variable"


Sure:

global myVar as string



Cheers,

Rich

Bite my shiny metal ass
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 3rd Aug 2006 01:20 Edited at: 3rd Aug 2006 01:23
There IS a better way! First, you can try this tutorial I made about arrays, if you like:http://forum.thegamecreators.com/?m=forum_view&t=84908&b=7 This way you won't need a bunch of variables.
See if that gives you any ideas. You could make one array to store all of the player's integer values (Health, Mana, etc.) And another for strings, and another for real numbers!

Secondly, you could also use types, which would be better for this since you have several different kinds of values (STRINGS, INTEGERS, REAL NUMBERS...)


DBPRO ONLY!!!!!!!!!
Types are not too hard to learn. They can help a bunch, too. To declare a type, use the TYPE command. To end it, use ENDTYPE Simple enough. Now for the good stuff: You can put different categorys into types. Foerexample, say you were making an RPG. (heh heh I bet you are) You may want to store the player's health and his mana in one array. Well, you could try this:


That would allow you do store mana and health both in one array. Only works in DBPro though, for types are not included in DBC. My array tutorial is fine in DBC though, I think. Try it!

Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 3rd Aug 2006 14:22
Also note that GLOBAL is DBP only. Which is why we ask you to put whether you use DBC or DBP in the thread title!

"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library

First you Dream, then you ... - Neil Gaiman, 2001
Rizzle
18
Years of Service
User Offline
Joined: 1st Aug 2006
Location:
Posted: 3rd Aug 2006 17:04
Oops...Only my Third post...I put DBP in the other two just slipped my mind

but I use DBPro so thank you very much...and I like that Array/Type method thats slick should raise my FPS since my computers lame and only pumpin 12 FPS
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 5th Aug 2006 20:35
no problem

Login to post a reply

Server time is: 2024-11-27 12:37:05
Your offset time is: 2024-11-27 12:37:05