19 Aug, 2013, mpvmud wrote in the 1st comment:
Votes: 0
if (ch->pcdata->warpoints < reqwps)
{
send_to_char ("You do not have the proper amount of warpoints to remort!\n\r", ch);
return;
}

if (ch->pcdata->killpoints < killpt)
{
send_to_char ("You do not have the proper amount of killpoints to remort!\n\r", ch);
return;
}


I want to change it to something like:

if (ch->pcdata->killpoints < killpt)
{
send_to_char ("You do not have the proper amount of killpoints to remort!\n\r", ch);
}
else (ch->pcdata->warpoints < reqwps)
{
send_to_char ("You do not have the proper amount of warpoints to remort!\n\r", ch);
return;
}


Or

if (ch->pcdata->killpoints < killpt)
else
(ch->pcdata->warpoints < reqwps)
{
send_to_char ("You either do not have the proper amount of killpoints or warpoints required to remort!\n\r", ch);
return;
}


Here is the full code as it is now:
DEFINE_COMMAND ("transform", do_alien, POSITION_STANDING, 1, LOG_ALWAYS, "This command is used to transform your character.  See help transform.")
if (IS_MOB (ch))
return;
if (LEVEL (ch) < 40)
return;
if (pow.max_remorts == 0)
{
send_to_char ("Huh?\n\r", ch);
return;
}
switch (ch->pcdata->remort_times) // Kenor '03
{
case 0:
reqlvl = 40;
reqwps = 0;
killpt = 0;
break;
case 1:
reqlvl = 45;
reqwps = 0;
killpt = 200;
break;
case 2:
reqlvl = 50;
reqwps = 0;
killpt = 600;
break;
case 3:
reqlvl = 55;
reqwps = 5;
killpt = 1200;
break;
case 4:
reqlvl = 60;
reqwps = 10;
killpt = 2400;
break;
case 5:
reqlvl = 65;
reqwps = 15;
killpt = 4800;
break;
case 6:
reqlvl = 70;
reqwps = 20;
killpt = 9600;
break;
case 7:
reqlvl = 75;
reqwps = 25;
killpt = 19200;
break;
case 8:
reqlvl = 80;
reqwps = 30;
killpt = 38400;
break;
case 9:
send_to_char ("You can not remort any futher!\n\r", ch);
return;
}

if (LEVEL (ch) < reqlvl)
{
send_to_char ("You do not have the proper level to remort!\n\r", ch);
return;
}

if (ch->pcdata->warpoints < reqwps)
{
send_to_char ("You do not have the proper amount of warpoints to remort!\n\r", ch);
return;
}

if (ch->pcdata->killpoints < killpt)
{
send_to_char ("You do not have the proper amount of killpoints to remort!\n\r", ch);
return;
}

if (pow.max_remorts == 1 && ch->pcdata->remort_times > 0)
{
send_to_char ("You have already transformed; you cannot do it again!\n\r", ch);
return;
}

if (ch->pcdata->remort_times >= pow.max_remorts)
{
send_to_char ("You have reached the max transformations possible.\n\r", ch);
return;
}


What I would like the code to do is check if they do or do not have the killpoints to remort to either allow them to remort OR move on and check to see if they have the required warpoints to either remort or not.

Am I even close in what I wrote above?
19 Aug, 2013, mpvmud wrote in the 2nd comment:
Votes: 0
Or am I looking more at doing it this way?

if (ch->pcdata->killpoints < killpt){
send_to_char ("You do not have the proper amount of killpoints required to remort!\n\r", ch);
return;
}
else if (ch->pcdata->warpoints < reqwps)
{
send_to_char ("You do not have the proper amount of warpoints required to remort!\n\r", ch);
return;
}
19 Aug, 2013, plamzi wrote in the 3rd comment:
Votes: 0
mpvmud said:
Or am I looking more at doing it this way?


Only your third suggestion was incorrect (logically, I do believe it will compile). The rest will all do what you intend.

The first suggestion is the leanest. If you are returning when a condition is met, and if you don't expect to want to process people with not enough war points for something else later on in the same function, then you don't need an "else".
19 Aug, 2013, mpvmud wrote in the 4th comment:
Votes: 0
What it is doing is checking to see if the player has enough killpoints to remort if they do not then to check if they have the required warpoints to remort, then if they do not they can not remort. If one of the two are positive then allow them to remort but I do not want it to check warpoints if they have enough killpoints.
19 Aug, 2013, mpvmud wrote in the 5th comment:
Votes: 0
plamzi said:
mpvmud said:
Or am I looking more at doing it this way?


Only your third suggestion was incorrect (logically, I do believe it will compile). The rest will all do what you intend.

The first suggestion is the leanest. If you are returning when a condition is met, and if you don't expect to want to process people with not enough war points for something else later on in the same function, then you don't need an "else".


So you are saying

if (ch->pcdata->killpoints < killpt)
{
send_to_char ("You do not have the proper amount of killpoints to remort!\n\r", ch);
}
(ch->pcdata->warpoints < reqwps)
{
send_to_char ("You do not have the proper amount of warpoints to remort!\n\r", ch);
return;
}
Should give me what I am looking for? Also yes this would be the last check on killpoints and warpoints in this function.
19 Aug, 2013, plamzi wrote in the 6th comment:
Votes: 0
mpvmud said:
What it is doing is checking to see if the player has enough killpoints to remort if they do not then to check if they have the required warpoints to remort, then if they do not they can not remort. If one of the two are positive then allow them to remort but I do not want it to check warpoints if they have enough killpoints.


Pseudo-code:
if (not enough killpoints) {
if (not enough warpoints) {
error message;
return;
}
/ * set a flag to know later that you\'re deducting warpoints, e. g.: */
enough_warpoints = 1;
}
else
enough_killpoints = 1;
19 Aug, 2013, mpvmud wrote in the 7th comment:
Votes: 0
So what it needs to check is, if they have the killpoints to remort it will skip checking for warpoints and allow them to remort but, if they do not have enough killpoints it will skip killpoints and check for their warpoints and if they have that it will allow them to remort. If they have neither enough of either it will report one of the messages?
20 Aug, 2013, plamzi wrote in the 8th comment:
Votes: 0
mpvmud said:
So what it needs to check is, if they have the killpoints to remort it will skip checking for warpoints and allow them to remort but, if they do not have enough killpoints it will skip killpoints and check for their warpoints and if they have that it will allow them to remort. If they have neither enough of either it will report one of the messages?


Yes. You have other checks, so the code is storing the check result in a flag until the time when you need to deduct points. At that time, you can show the player what is being deducted, killpoints or warpoints, and how many etc.
21 Aug, 2013, mpvmud wrote in the 9th comment:
Votes: 0
plamzi said:
mpvmud said:
So what it needs to check is, if they have the killpoints to remort it will skip checking for warpoints and allow them to remort but, if they do not have enough killpoints it will skip killpoints and check for their warpoints and if they have that it will allow them to remort. If they have neither enough of either it will report one of the messages?


Yes. You have other checks, so the code is storing the check result in a flag until the time when you need to deduct points. At that time, you can show the player what is being deducted, killpoints or warpoints, and how many etc.
What I ended up going with which gave me the desired result was:
if (ch->pcdata->killpoints < killpt){
if (ch->pcdata->warpoints < reqwps){
send_to_char ("You either do not have the proper amount of warpoints or killpoints required to remort!\n\r", ch);
return;
}
}
0.0/9