Welcome to the Builder Academy

Question Quest -1 on characters from beginning

More
06 Jun 2013 19:44 #2917 by JTP
When a player creates a char, the code puts them on a quest from beginning, so they have to leave quest, and join the quest they wanna do.

Is this the part of the code that sets players to -1 ?
Code:
do_score if (GET_QUEST(ch) == NOTHING) send_to_char(ch, "and you are not on a quest at the moment.\r\n"); else send_to_char(ch, "and your current quest is %d.\r\n", GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch));
.

Code sets -1 for current quest, shouldnt it just be: GET_QUEST(ch); ?

and not: GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch));

Please Log in or Create an account to join the conversation.

More
07 Jun 2013 14:41 #2925 by Vatiken
This is a bug. If you look in db.c you'll find that it sets GET_QUEST() to -1 when it should be set to NOTHING.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
08 Jun 2013 14:45 - 08 Jun 2013 14:45 #2955 by Rumble
Updated on Github

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com
Last edit: 08 Jun 2013 14:45 by Rumble.

Please Log in or Create an account to join the conversation.

More
10 Jun 2013 01:49 #3003 by Fizban

JTP wrote: Code sets -1 for current quest, shouldnt it just be: GET_QUEST(ch); ?

and not: GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch));


No.

The line that reads:
Code:
send_to_char(ch, "and your current quest is %d.\r\n", GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch));

does the same thing as:
Code:
if (GET_QUEST(ch) == NOTHING) send_to_char(ch, "and your current quest is -1.\r\n"); else send_to_char(ch, "and your current quest is %d.\r\n", GET_QUEST(ch));

The ? is a ternary operator.

It works like so:

Statement ? Value_If_True : Value_If_False

GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch)

makes it display -1 as %d instead of the value held by GET_QUEST(ch) when GET_QUEST(ch) is equal to NOTHING.

Please Log in or Create an account to join the conversation.

Time to create page: 0.193 seconds