Author Topic: who code broken after edit. help with compilation errors  (Read 2079 times)

Offline thecreator

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
who code broken after edit. help with compilation errors
« on: September 17, 2006, 06:25:24 PM »

Here is the code.

#include <lib.h>

#include <privs.h>

#include <config.h>

inherit LIB_DAEMON;

#define SEP repeat_string("--",39)+"\n";

int cmd(string args)

{

int p;

string x, tmp="", ret="";

object *obs;

p = 0;

obs=users();

for (int i=0; i<sizeof(users()); i++)

{

if(!obs || !environment(obs))

continue;

if(!obs->GetInvis())

{

if (sizeof(obs->GetShort()) < 50)

{

tmp+= obs->GetShort();

}

else

{

tmp+=" "+capitalize(obs->GetKeyName());

}

/*

                    if(obs->GetSleeping() > 0)

{

tmp+=" (%^YELLOW%^sleeping%^RESET%^) ";

}

*/

else if (obs->GetProperty("afk"))

{

tmp+=" (%^YELLOW%^[afk] idle for, "+ query_idle(obs)+ ".%^RESET%^)";

}

else if (query_idle(obs)>30 && obs->GetInCombat()!=1 && (!obs->GetProperty("afk")))

{

tmp+="(%^YELLOW%^[idle] "+ query_idle(obs)+ "%^RESET%^)";

}

/*

else if (in_edit(obs))

{

tmp+=" (%^RED%^edit%^RESET%^)";

}

*/

else if(obs->GetInCombat())

{

tmp+=" (%^RED%^[in combat]%^RESET%^)";

}

tmp+="\n";

p++;

}

ret+=center(mud_name());

ret+=SEP;

ret+=tmp;

ret+=SEP;  

x="There ";

(p==1) ? x+="is " : x+="are ";

x+=cardinal(p);

(p==1) ? x+=" member " : x+=" members ";

x+="of our reality.\n";

ret+=center(x);

this_player()->eventPrint(""+ret+"");

return 1;

}





And the errors.



/cmds/players/who.c line 33: syntax error



 



/cmds/players/who.c line 35: Illegal LHS



 



---



*Error in loading object '/cmds/players/who'



Object: /secure/sefun/sefun at /secure/sefun/load_object.c:14



 



'<function>' at /secure/save/creators/t/thecreator (<function>) at /:0



'cmdAll' at /secure/save/creators/t/thecreator (/lib/command.c) at line 93



'cmd' at /secure/cmds/creators/update at line 109



'eventUpdate' at /secure/cmds/creators/update at line 135



'load_object' at /secure/sefun/sefun at /secure/sefun/load_object.c:14



'CATCH' at /secure/sefun/sefun at /secure/sefun/load_object.c:14



Trace written to /log/catch



/cmds/players/who.c line 33: syntax error



 



/cmds/players/who.c line 35: Illegal LHS



 



---



*Error in loading object '/cmds/players/who'



Object: /secure/cmds/creators/update at line 148



 



'<function>' at /secure/save/creators/t/thecreator (<function>) at /:0



'cmdAll' at /secure/save/creators/t/thecreator (/lib/command.c) at line 93



'cmd' at /secure/cmds/creators/update at line 109



'eventUpdate' at /secure/cmds/creators/update at line 148



'CATCH' at /secure/cmds/creators/update at line 148



Trace written to /log/catch



/cmds/players/who: Error in update



*Error in loading object '/cmds/players/who'



 



>


~~TheCreator~~

Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
who code broken after edit. help with compilation errors
« Reply #1 on: September 17, 2006, 09:18:17 PM »
Looks like you need one more } at the end of the file.

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
who code broken after edit. help with compilation errors
« Reply #2 on: September 18, 2006, 05:18:36 PM »

Capo is correct. Also, ditch the "else" on line 33.

Have it say "if" not "else if"