This is the spell I added.
Make appropriate spell define.
spell_parser.c
--------------
case SPELL_PORTAL: MANUAL_SPELL(spell_portal); break;
spello(SPELL_PORTAL, 150, 100, 5, POS_STANDING,
TAR_CHAR_WORLD | TAR_NOT_SELF, FALSE, MAG_MANUAL);
spells.c
--------
ASPELL(spell_portal)
{
/* create a magic portal */
struct obj_data *tmp_obj, *tmp_obj2;
struct extra_descr_data *ed;
struct room_data *rp, *nrp;
struct char_data *tmp_ch = (struct char_data *) victim;
char buf[512];
assert(ch);
assert((level >= 0) && (level <= LVL_IMPL));
/*
check target room for legality.
*/
rp = &world[ch->in_room];
tmp_obj = read_object(PORTAL, VIRTUAL);
if (!rp || !tmp_obj) {
send_to_char("The magic fails\n\r", ch);
extract_obj(tmp_obj);
return;
}
if (IS_SET(rp->room_flags, ROOM_TUNNEL)) {
send_to_char("There is no room in here to summon!\n\r", ch);
extract_obj(tmp_obj);
return;
}
if (!(nrp = &world[tmp_ch->in_room])) {
char str[180];
sprintf(str, "%s not in any room", GET_NAME(tmp_ch));
log(str);
send_to_char("The magic cannot locate the target\n", ch);
extract_obj(tmp_obj);
return;
}
if (ROOM_FLAGGED(tmp_ch->in_room, ROOM_NOMAGIC)) {
send_to_char("Your target is protected against your magic.\n\r",
ch);
extract_obj(tmp_obj);
return;
}
sprintf(buf, "Through the mists of the portal, you can faintly see
%s",nrp->name);
CREATE(ed , struct extra_descr_data, 1);
ed->next = tmp_obj->ex_description;
tmp_obj->ex_description = ed;
CREATE(ed->keyword, char, strlen(tmp_obj->name) + 1);
strcpy(ed->keyword, tmp_obj->name);
ed->description = str_dup(buf);
tmp_obj->obj_flags.value[0] = 1;
tmp_obj->obj_flags.value[1] = tmp_ch->in_room;
obj_to_room(tmp_obj,ch->in_room);
act("$p suddenly appears.",TRUE,ch,tmp_obj,0,TO_ROOM);
act("$p suddenly appears.",TRUE,ch,tmp_obj,0,TO_CHAR);
/* Portal at other side */
rp = &world[ch->in_room];
tmp_obj2 = read_object(PORTAL, VIRTUAL);
if (!rp || !tmp_obj2) {
send_to_char("The magic fails\n\r", ch);
extract_obj(tmp_obj2);
return;
}
sprintf(buf,"Through the mists of the portal, you can faintly see %s",
rp->name);
CREATE(ed , struct extra_descr_data, 1);
ed->next = tmp_obj2->ex_description;
tmp_obj2->ex_description = ed;
CREATE(ed->keyword, char, strlen(tmp_obj2->name) + 1);
strcpy(ed->keyword, tmp_obj2->name);
ed->description = str_dup(buf);
tmp_obj2->obj_flags.value[0] = 1;
tmp_obj2->obj_flags.value[1] = ch->in_room;
obj_to_room(tmp_obj2,tmp_ch->in_room);
act("$p suddenly appears.", TRUE, tmp_ch, tmp_obj2, 0, TO_ROOM);
act("$p suddenly appears.", TRUE, tmp_ch, tmp_obj2, 0, TO_CHAR);
}
The Error is,
spells.c (438) : error C2065 'portal' ; undeclared identifier.
Is there something I have to add other than whats on the snippet"?
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST