Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Coding Syntax

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
frsotywinters Joined: 25 Jan 2006 Posts: 14 |

Posted: Tue Feb 21, 2006 3:40 pm Post subject: Coding Syntax |

Hey im kinda new to the whole QuakeC programming experience, i've written a little piece of code and was just wondering if i have the fundamentals right, like is there anything i've left out that should be in every QuakeC code written (like leaving out a main method or return type in java)
Anyway heres how my code basically looks, any feed back would be greatly appreciated!!
void main() =
{
map myMap; //Define the map to be used
// Create a dynamic entity and make it static cause i want it for the whole game
entity a_1 = spawn();
a_1.movetype = 2;
a_1.solid = 1;
setmodel(a_1, "progs/entity.mdl");
setsize(a_1, VEC_MAX);
setorigin(a_1, x y z);
makestatic(a_1);
//Some code to specify how my entites behave when interacted with
} //End my main method

Back to top |

lth Joined: 11 Nov 2004 Posts: 129 |

Posted: Tue Feb 21, 2006 5:10 pm Post subject: Re: Coding Syntax |

frsotywinters wrote:
map myMap;

This line doesn't make a whole heap of sense - you need to declare what datatype you're using from QuakeC's limited selection of: float, string, vector or entity.
_________________
randomviolence - tactical combat boardgame

Back to top |

RenegadeC Joined: 15 Oct 2004 Posts: 370 Location: The freezing hell; Canada |

Posted: Tue Feb 21, 2006 6:23 pm Post subject: Re: Coding Syntax |

frsotywinters wrote:
void main() = { map myMap; entity a_1 = spawn(); a_1.movetype = 2;
a_1.solid = 1;
setmodel(a_1, "progs/entity.mdl");
setsize(a_1, VEC_MAX);
setorigin(a_1, x y z);
makestatic(a_1);
}

Corrected:
void main() =
{
local entity a_1;
// map myMap; This is invalid, if you want it to see what map you're currently on then do this:
if (world.model == "maps/blah.bsp")
do_stuff();
a_1 = spawn();
a_1.movetype = 2; // use MOVETYPE_BLAH in defs.qc for easier reading
a_1.solid = 1; // Same dealie, SOLID_NOT for example..
setmodel(a_1, "progs/entity.mdl"); // Right
setsize(a_1, VEC_MAX); // Wrong, it's setsize (entity, lower bounding box, upper bounding box);
setorigin(a_1, x y z); // fill x,y,z origin in or use entity.origin
makestatic(a_1); // You should be aware that makestatic entities
// cannot have think functions, makestatic is good for detail objects! Also remember only 128 static entities can be placed in a
// map unless you're using darkplaces which has zero limits as far as I know! Makestatic entities are also not solid.
}; // put a semicolon ; at the end, it's just prettier and people will thank you for it...

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group