[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Adding more random messages.

Adding more random messages.

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Adding more random messages.

Postby glitchhunter96 » Wed Jul 17, 2013 12:03 pm

glitchhunter96
 
Posts: 4
Joined: Sat Oct 13, 2012 12:12 am

Re: Adding more random messages.

Postby glitchhunter96 » Wed Jul 17, 2013 12:04 pm

glitchhunter96
 
Posts: 4
Joined: Sat Oct 13, 2012 12:12 am

Re: Adding more random messages.

Postby Spike » Wed Jul 17, 2013 4:38 pm

you probably want to learn how to use the 'else' keyword.

if (a)
dosomething();
else if (b)
dosomethingelse();

the two are mutually exclusive. if a is true, it really doesn't care at all about b.

(technically, 'else if' is a combination of two separate constructs. that is, the second if is embedded within the else clause of the first if. thus you can just keep adding 'else if (foo)dosomeanotherthing();' on the end as many times as you want)
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Adding more random messages.

Postby r00k » Thu Jul 18, 2013 4:30 am

r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Adding more random messages.

Postby frag.machine » Thu Jul 18, 2013 5:44 am

As a rule of thumb, first write your code to just work, in the cleanest(i.e. more legible) way possible; later, if after *measuring* you decide your code needs a better performance, you may try to rewrite the hot spots to improve performance.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Re: Adding more random messages.

Postby Spike » Thu Jul 18, 2013 12:50 pm

if (foo)
fnar();
else
{
if (bar)
foobar();
else
smudge();
}

really doesn't matter whether that {} is there or not. makes absolutely no difference. same with the new line between the else and the if.
write it in whatever way is most readable. different people will naturally have different interpretations of 'most readable', but whatever.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Adding more random messages.

Postby glitchhunter96 » Thu Jul 18, 2013 11:55 pm

Source file: progs.src
outputfile: ../progs.dat
compiling defs.qc
compiling botit_th.qc
compiling func.qc
compiling floater.qc
compiling subs.qc
compiling fight.qc
compiling ai.qc
in function FindTarget (line 304),
ai.qc:316: warning: 'FindTarget' should return float
compiling combat.qc
compiling items.qc
in function PlaceItem (line 22),
items.qc:33: warning: droptofloor: Too few parameters
defs.qc:375: droptofloor is defined here
compiling rankings.qc
in function msgUpdateNameToPlayer (line 57),
rankings.qc:335: warning: msgUpdateNameToPlayer: contains unreachable code
in function msgUpdateColorsToPlayer (line 60),
rankings.qc:354: warning: msgUpdateColorsToPlayer: contains unreachable code
in function msgUpdateFragsToPlayer (line 63),
rankings.qc:373: warning: msgUpdateFragsToPlayer: contains unreachable code
compiling ccam.qc
compiling weapons.qc
compiling world.qc
compiling client.qc
in function FindIntermission (line 237),
client.qc:274: warning: FindIntermission: not all control paths return a value
in function ClientKill (line 54),
client.qc:517: error: Unknown value "else".
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: warning: Expected punctuation
client.qc:517: error: expected ;, found if
in function ClientObituary (line 6),
client.qc:1864: warning: zufall duplicate definition ignored
client.qc:1505: zufall is defined here
client.qc:1901: warning: zufall duplicate definition ignored
client.qc:1505: zufall is defined here

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

Error in client.qc on line 1919
Curious as to the reason why this keeps giving me a compile error.
Am i supposed to place Zufall in new brackets? :?:
glitchhunter96
 
Posts: 4
Joined: Sat Oct 13, 2012 12:12 am

Re: Adding more random messages.

Postby Spike » Fri Jul 19, 2013 10:56 am

if you have more than one statement between the if and the else, you'll need to add braces (aka: curly brackets) around them.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Adding more random messages.

Postby glitchhunter96 » Sat Jul 20, 2013 4:57 am

glitchhunter96
 
Posts: 4
Joined: Sat Oct 13, 2012 12:12 am

Re: Adding more random messages.

Postby Seven » Sat Jul 20, 2013 12:09 pm

Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest