Forum

Error compiling QW progs, but NQ progs compile fine.

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Error compiling QW progs, but NQ progs compile fine.

Postby Fragasaurus » Mon Jun 07, 2010 10:30 pm

G'day all.

As a means to learn programming, I've decided to start by modding Quake(World) a bit. After all, I've been playing QW on and off since around '97 or '98, so it's something I know a bit about.

So I grabbed the CleanQCC sources (for both Netquake and QuakeWorld) and started tinkering. After doing a few of the tutorials here, I've started getting errors on the QW side.

Particularly, with the Weapon Naming tutorial, the compiler errors out when doing it with QW, yet making the same changes to the NQ source compiles fine.

This is the code I used to test it.
Code: Select all
/*

============

WeaponName

============

*/

void() WeaponName =

{

   local   string   weaponName;

   

   if   (self.weapon == IT_AXE)

      weaponName = "Axe";

   else

      weaponName = "You're a lamer.";

      

   sprint(self, weaponName);

   sprint(self, "\n");

};


When adding to the QW source, I get this error:
Code: Select all
Source file: progs.src
outputfile: ../qwprogs.dat
compiling defs.qc
compiling subs.qc
compiling combat.qc
compiling items.qc
in function key_touch (line 1140),
items.qc:1151: warning: You may wish to add brackets after that ! operator
compiling weapons.qc
in function WeaponName (line 1013),
weapons.qc:1021: error: type mismatch on parm 2 - (string should be float)
defs.qc:625:    sprint  is defined here
in function CheatCommand (line 1110),
weapons.qc:1134: warning: CheatCommand: contains unreachable code

************ ERROR ************
Errors have occured

Error in weapons.qc on line 1368


Works fine with the NQ source.

I'm using FTEQCC (from SVN) since it's conveniently in the repos of my Linux distro. Should I try another compiler?

I'm not looking for a fix here. As this is entirely a learning experience for me. What I am interested in is knowing why this doesn't work in QuakeWorld.

Could someone explain this?

FYI, the line numbers in the compiler output are not at all the ones shown in the code. I think it's related to converting between Windows and Linux text formats. Regardless, it's not important right now.

Please forgive the ignorant noob flavour of this post.

Cheers, and thanks,
Mat
Fragasaurus
 
Posts: 2
Joined: Mon Jun 07, 2010 8:08 pm

Postby Spike » Tue Jun 08, 2010 12:19 am

look up the definition of sprint in both copies of defs.qc. it differs between NQ and QW.
They wouldn't need to use different progs files if the contents were not different!
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Fragasaurus » Tue Jun 08, 2010 4:00 am

Oh, cool. Guess I'm one RTFM closer to some kind of enlightenment. Does "level" just control if a message is filtered by the msg console variable?

Thanks, Spike. Timely and concise as ever.
Fragasaurus
 
Posts: 2
Joined: Mon Jun 07, 2010 8:08 pm

Postby Spike » Tue Jun 08, 2010 10:19 am

yup, just a filter
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest