Game Development Community

$pref::game::logo_bitmap

by hamed · in Game Design and Creative Issues · 03/17/2012 (1:04 am) · 14 replies

if($pref::game::logo_bitmap !$= "")
		GarageGamesGui.bitmap = $pref::game::logo_bitmap;
would anybody tell me that what does $pref mean ?
and is logo_bitmap has been deifined anywhere in the last code thatnow we can use it or its a fix part of engine classes ?

About the author

the great costly games, but the only purpose is killing, and the only amuse but why we just should kill to be satisfied,why the games should not change ? great drama in the games ? maybe today , is the time to change from bullets to flowers


#1
03/17/2012 (2:11 am)
A $pref is a preference setting (global variable) that gets saved (if modifed) and reloaded each time the game is ran.

From that code example it simply checks if the preference has been set and if it has then tells the game to use the defined logo_bitmap on the GUI. If the preference has not been set, then it skips on ahead to the next bit of code.
#2
03/17/2012 (2:19 am)
so we should have a bimaap ctrl in a gui called logo_bitmap ?
#3
03/17/2012 (2:25 am)
and why ::game after $pref ?
pardon me i know these are silly questions but i really dont know the answers
#4
03/17/2012 (2:37 am)
i pay money for answering
would anybody ..... ?
#5
03/17/2012 (10:43 am)
For free:

With global variables, sometimes you want to have them better organized. By using "::" you can add further sub-sections.
#6
03/17/2012 (10:50 am)
thanks for your favor , but would you tell me that
in which file we should define this sub-sections for example in this case :: game
#7
03/17/2012 (11:19 am)
You could search for that pref with Find In Files to see if it exists. If it exists then you'll know what bitmap image that it is looking for. The preference will be declared using a string for the path and filename of the image, like so:
$pref::game::logo_bitmap = "art/gui/someLogo.png";

The game:: attached to $pref:: is a (sort of) namespace that allows you organize groups of similar type preferences. For example:
$pref::imposter::canShadow = "1";
$pref::Input::JoystickEnabled = "0";
$pref::Input::KeyboardEnabled = 1;
$pref::Input::KeyboardTurnSpeed = 0.1;
$pref::Net::DisplayOnMaster = "Always";
$pref::Net::LagThreshold = "400";
$Pref::player::CurrentFOV = 45;
$pref::Player::defaultFov = 90;
$pref::Player::Name = "VisitortMale";
$pref::Player::zoomSpeed = 0;
You can see how it could make it easier to find a specific preferences if you know what "group" it belongs to.

If a default preference is set or intialized the majority of them can usually be found under the client scripts in a defaults.cs script file for client-side defaults, and server defaults can be found in the server scripts. You will have to search using the expression $pref to find all others since they can actually be initialized in any script that gets executed. Game code and selecting options in a GUI screen can cause these preferences to be changed from their defaults. There should also be a prefs.cs script file found in both the client and server scripts that lists all $prefs that get exported by the engine at shutdown.
#8
03/18/2012 (10:03 am)
hamed,
are u familiar with c++?

something like this:
using namespace std;
and
std::cout<<"print it";\

if yes, then :: is similar to c++ ::.
(there is another ::,but that is for another purpose )
#9
03/18/2012 (10:37 am)
not completely but i nearly know and i even studied data structure in c , but now ive fpund that my problem is incomplete game source that rake in gras team have uploaded here
http://blog.rakeingrass.com/?cat=3
i dont know that you have downloaded it or not but im sure that if you see it youll admitt me that there are some cs files that havent been uploaded, the files that declares variables such as $pref::game::loading_bitmap and etc...
now i should find another source code, i think its the best way for learning ,spicially gui menu loaading logo..
#10
03/18/2012 (11:45 am)
Quote:now i should find another source code, i think its the best way for learning ,spicially gui menu loaading logo

forget learning from source.try to utilize gui docs of tgb.specially script manual.
do not know about tgb's doc.

but t3d's doc is not good for gui.but if u are really curious u will be able to find your way using them.

there is no need of c++ source to learn gui.
#11
03/18/2012 (5:50 pm)
Where did the discussion about C++ come from? The questions here all relate to script variables...

The :: characters when used as part of variable names in Torque script have absolutely no relation to the :: operator found in C++
#12
03/18/2012 (9:29 pm)
@michael hall,u are an old torque user and i am very new in programming(about 3 years).so i am not going to any arguing.

Quote:
The game:: attached to $pref:: is a (sort of) namespace that allows you organize groups of similar type preferences

is not this line looks like something similar to this:

[quote]Namespaces allow to group entities like classes, objects and functions under a name./[quote]

from:
http://www.cplusplus.com/doc/tutorial/namespaces/

t3d doc has very small part on namespace.so programmers need to imagine some things.from my c++ background i have imagined torque scripts's :: is similar to c++'s :: .

i am scripting ts from last years.and so far this imagination was right.that is why i belive torque scripts :: and c++ scope operator are same.
am i right?
if not then where is the difference.plz?

this page has some similar example(like $pref::imposter::canShadow = "1"; )
http://www.cplusplus.com/doc/tutorial/namespaces/

#13
03/18/2012 (9:31 pm)
Quote:The :: characters when used as part of variable names in Torque script
also i am not seeing any doc that describes what will happened when :: will be used as part of an variable.
#14
03/18/2012 (10:20 pm)
In Torque script those characters when used in such a conjunction as mentioned have no power or meaning, except to make things look "pretty" for easier readability -- you don't even have to use them. With a one line code change in script I could actually use preferences stored as something like $ReusableOption[GameVariable, ScoreLimit] = n. I'm not going to argue semantics and such, I was simply pointing out that it's better not to confuse the guy who is struggling with something so simple and basic as the problems he's been posting by complicating things with an outside reference or assumption that' isn't 100% true.