Oasis Olc oedit_disp_val5 problem
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Dec 23, 2008 1:16 am
Last edited Dec 23, 2008 1:35 am by 6Dragons
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008
Greetings, I am having problems with Oasis snippet.
It is completely installed, but with the oedit command when I edit a weapon type object's values.
It always kicks me out of editor at value4 instead of going to value5. I get booted from the
val5 and taken to oedit_disp_menu instead of going to oedit_disp_val6_menu(d) where it is called in the bottom
of the second function It does not even let you give a value for 4, just exits after displaying
the options you can chose for 4, and displaying the generic oedit_disp_menu again.
[code]
/* object value 4 */
void oedit_disp_val5_menu( DESCRIPTOR_DATA *d )
{
OBJ_DATA *obj = ( OBJ_DATA * ) d->character->pcdata->dest_buf;
OLC_MODE(d) = OEDIT_VALUE_5;
CHAR_DATA *ch = d->character;
int counter, col = 0;
switch ( obj->item_type )
{
case ITEM_SALVE:
oedit_disp_spells_menu(d);
break;
case ITEM_FOOD:
send_to_char( "Food value: ", d->character );
break;
case ITEM_WEAPON:
{
for ( counter = 0; counter < WEP_MAX; counter++ )
{
ch_printf( d->character, "&c%2d&w) %-20.20s ", counter, weapon_skills[counter] );
if( ++col % 2 == 0 )
send_to_char( "\n\r", d->character );
}
send_to_char("\n\rEnter Weapon Type: ", d->character);
break;
}
case ITEM_MISSILE_WEAPON:
send_to_char( "Range: ", d->character );
break;
default:
oedit_disp_menu(d);
}
}
case OEDIT_VALUE_5:
number = atoi(arg);
switch( obj->item_type )
{
case ITEM_SALVE:
if ( !is_number( arg ) )
number = skill_lookup(arg);
min_val = -1;
max_val = top_sn-1;
break;
case ITEM_FOOD:
min_val = 0;
max_val = 32000;
break;
case ITEM_WEAPON:
min_val = 0;
max_val = 15;
if ( number < min_val || number > max_val )
{
oedit_disp_val5_menu(d);
return;
}
break;
default:
min_val = -32000;
max_val = 32000;
break;
}
obj->value[4] = URANGE( min_val, number, max_val );
olc_log( d, "Changed v4 to %d", obj->value[4] );
if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE) )
obj->pIndexData->value[4] = obj->value[4];
oedit_disp_val6_menu(d); // this should take it to val6 display but doesn't it goes to main menu instead
It is completely installed, but with the oedit command when I edit a weapon type object's values.
It always kicks me out of editor at value4 instead of going to value5. I get booted from the
val5 and taken to oedit_disp_menu instead of going to oedit_disp_val6_menu(d) where it is called in the bottom
of the second function It does not even let you give a value for 4, just exits after displaying
the options you can chose for 4, and displaying the generic oedit_disp_menu again.
[code]
/* object value 4 */
void oedit_disp_val5_menu( DESCRIPTOR_DATA *d )
{
OBJ_DATA *obj = ( OBJ_DATA * ) d->character->pcdata->dest_buf;
OLC_MODE(d) = OEDIT_VALUE_5;
CHAR_DATA *ch = d->character;
int counter, col = 0;
switch ( obj->item_type )
{
case ITEM_SALVE:
oedit_disp_spells_menu(d);
break;
case ITEM_FOOD:
send_to_char( "Food value: ", d->character );
break;
case ITEM_WEAPON:
{
for ( counter = 0; counter < WEP_MAX; counter++ )
{
ch_printf( d->character, "&c%2d&w) %-20.20s ", counter, weapon_skills[counter] );
if( ++col % 2 == 0 )
send_to_char( "\n\r", d->character );
}
send_to_char("\n\rEnter Weapon Type: ", d->character);
break;
}
case ITEM_MISSILE_WEAPON:
send_to_char( "Range: ", d->character );
break;
default:
oedit_disp_menu(d);
}
}
case OEDIT_VALUE_5:
number = atoi(arg);
switch( obj->item_type )
{
case ITEM_SALVE:
if ( !is_number( arg ) )
number = skill_lookup(arg);
min_val = -1;
max_val = top_sn-1;
break;
case ITEM_FOOD:
min_val = 0;
max_val = 32000;
break;
case ITEM_WEAPON:
min_val = 0;
max_val = 15;
if ( number < min_val || number > max_val )
{
oedit_disp_val5_menu(d);
return;
}
break;
default:
min_val = -32000;
max_val = 32000;
break;
}
obj->value[4] = URANGE( min_val, number, max_val );
olc_log( d, "Changed v4 to %d", obj->value[4] );
if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE) )
obj->pIndexData->value[4] = obj->value[4];
oedit_disp_val6_menu(d); // this should take it to val6 display but doesn't it goes to main menu instead
#2 Dec 23, 2008 1:32 am
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008
Example of it in action
[quote]
6 Dragons Oasis OLC menu
-- Item number : [18616]
1) Name : staff
2) S-Desc : a stout oak staff
3) L-Desc :-
A stout oak staff has been left here.
4) A-Desc :-
5) Type : Weapon
6) Extra flags :
7) Wear flags : take wield
8) Weight : 5
9) Cost : 48
A) Color : 2
B) Timer : 0
C) Level : 100
D) Layers : 0
E) Val0 : [12] F) Val1 : [0] G) Val2 : [0] H) Val3 : [3]
I) Val4 : [11] J) Val5 : [30] K) Val6 : [0]
L) Affect menu
M) Extra descriptions menu
Q) Quit
Enter choice : e
Condition : 12
Number of damage dice : 34
Size of damage dice : 34
0) hit 1) slash
2) stab 3) hack
4) crush 5) lash
6) pierce 7) thrust
Enter Damage Type: 4
0) 2h Long Swords 1) 1h Long Blades
2) 1h Short Blades 3) Whips
4) 2h Bludgeons 5) 1h Bludgeons
6) Archery 7) Blowguns
8) 2h Axes 9) 1h Axes
10) Spear 11) Staff
12) Lance 13) Flail
14) Talon 15) Polearm
Enter Weapon Type:
6 Dragons Oasis OLC menu
-- Item number : [18616]
1) Name : staff
2) S-Desc : a stout oak staff
3) L-Desc :-
A stout oak staff has been left here.
4) A-Desc :-
5) Type : Weapon
6) Extra flags :
7) Wear flags : take wield
8) Weight : 5
9) Cost : 48
A) Color : 2
B) Timer : 0
C) Level : 100
D) Layers : 0
E) Val0 : [12] F) Val1 : [34] G) Val2 : [34] H) Val3 : [4]
I) Val4 : [11] J) Val5 : [30] K) Val6 : [0]
L) Affect menu
M) Extra descriptions menu
Q) Quit
Enter choice : q
And boom I'm at main menu display without being able to edit val4 val5 or val6
Now if I pick option I J or K I can edit them seperately, but it should work by
going from one to another too.
[quote]
6 Dragons Oasis OLC menu
-- Item number : [18616]
1) Name : staff
2) S-Desc : a stout oak staff
3) L-Desc :-
A stout oak staff has been left here.
4) A-Desc :-
5) Type : Weapon
6) Extra flags :
7) Wear flags : take wield
8) Weight : 5
9) Cost : 48
A) Color : 2
B) Timer : 0
C) Level : 100
D) Layers : 0
E) Val0 : [12] F) Val1 : [0] G) Val2 : [0] H) Val3 : [3]
I) Val4 : [11] J) Val5 : [30] K) Val6 : [0]
L) Affect menu
M) Extra descriptions menu
Q) Quit
Enter choice : e
Condition : 12
Number of damage dice : 34
Size of damage dice : 34
0) hit 1) slash
2) stab 3) hack
4) crush 5) lash
6) pierce 7) thrust
Enter Damage Type: 4
0) 2h Long Swords 1) 1h Long Blades
2) 1h Short Blades 3) Whips
4) 2h Bludgeons 5) 1h Bludgeons
6) Archery 7) Blowguns
8) 2h Axes 9) 1h Axes
10) Spear 11) Staff
12) Lance 13) Flail
14) Talon 15) Polearm
Enter Weapon Type:
6 Dragons Oasis OLC menu
-- Item number : [18616]
1) Name : staff
2) S-Desc : a stout oak staff
3) L-Desc :-
A stout oak staff has been left here.
4) A-Desc :-
5) Type : Weapon
6) Extra flags :
7) Wear flags : take wield
8) Weight : 5
9) Cost : 48
A) Color : 2
B) Timer : 0
C) Level : 100
D) Layers : 0
E) Val0 : [12] F) Val1 : [34] G) Val2 : [34] H) Val3 : [4]
I) Val4 : [11] J) Val5 : [30] K) Val6 : [0]
L) Affect menu
M) Extra descriptions menu
Q) Quit
Enter choice : q
And boom I'm at main menu display without being able to edit val4 val5 or val6
Now if I pick option I J or K I can edit them seperately, but it should work by
going from one to another too.
#3 Dec 23, 2008 1:38 am
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008
Here is val6 code, I don't see anything that would cause it to go to main menu instead
of what is supposed too.
[code]
/* object value 5 */
void oedit_disp_val6_menu( DESCRIPTOR_DATA *d )
{
OBJ_DATA *obj = ( OBJ_DATA * ) d->character->pcdata->dest_buf;
OLC_MODE(d) = OEDIT_VALUE_6;
CHAR_DATA *ch = d->character;
switch ( obj->item_type )
{
case ITEM_SALVE:
oedit_disp_spells_menu(d);
break;
case ITEM_WEAPON:
send_to_char("Enter Reset Level: ", d->character );
break;
default:
oedit_disp_menu(d);
}
}
case OEDIT_VALUE_6:
number = atoi(arg);
switch( obj->item_type )
{
case ITEM_SALVE:
if ( !is_number( arg ) )
number = skill_lookup(arg);
min_val = -1;
max_val = top_sn-1;
break;
case ITEM_WEAPON:
min_val = 0;
max_val = 108;
if ( number < min_val || number > max_val )
{
oedit_disp_val6_menu(d);
return;
}
break;
default:
min_val = -32000;
max_val = 32000;
break;
}
obj->value[5] = URANGE( min_val, number, max_val );
olc_log( d, "Changed v5 to %d", obj->value[5] );
if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE) )
obj->pIndexData->value[5] = obj->value[5];
oedit_disp_val7_menu(d);
break;
of what is supposed too.
[code]
/* object value 5 */
void oedit_disp_val6_menu( DESCRIPTOR_DATA *d )
{
OBJ_DATA *obj = ( OBJ_DATA * ) d->character->pcdata->dest_buf;
OLC_MODE(d) = OEDIT_VALUE_6;
CHAR_DATA *ch = d->character;
switch ( obj->item_type )
{
case ITEM_SALVE:
oedit_disp_spells_menu(d);
break;
case ITEM_WEAPON:
send_to_char("Enter Reset Level: ", d->character );
break;
default:
oedit_disp_menu(d);
}
}
case OEDIT_VALUE_6:
number = atoi(arg);
switch( obj->item_type )
{
case ITEM_SALVE:
if ( !is_number( arg ) )
number = skill_lookup(arg);
min_val = -1;
max_val = top_sn-1;
break;
case ITEM_WEAPON:
min_val = 0;
max_val = 108;
if ( number < min_val || number > max_val )
{
oedit_disp_val6_menu(d);
return;
}
break;
default:
min_val = -32000;
max_val = 32000;
break;
}
obj->value[5] = URANGE( min_val, number, max_val );
olc_log( d, "Changed v5 to %d", obj->value[5] );
if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE) )
obj->pIndexData->value[5] = obj->value[5];
oedit_disp_val7_menu(d);
break;
#4 Dec 23, 2008 1:52 am
Fledgling
GroupMembers
Posts4
JoinedMar 2, 2008
http://www.mudbytes.net/index.php?a=topic&t=862
Seems like it may be the same problem you're having. Hope this helps.
Seems like it may be the same problem you're having. Hope this helps.
#5 Dec 23, 2008 2:13 am
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008
Davion,
Thanks man you saved me a huge headache.
Vladaar
Thanks man you saved me a huge headache.
Vladaar
#6 Dec 23, 2008 2:20 am
Black Hand
GroupAdministrators
Posts3,706
JoinedJan 1, 2002
The solution for the OEDIT_VALUE_* menus on MudBytes seems to work, but apparently changing the breaks to returns wasn't necessary for this code when it got ported to AFKMud. I'm not entirely sure why.
The Oasis code is really nice, but it's an ass to maintain. I really wish there was a better way.
The Oasis code is really nice, but it's an ass to maintain. I really wish there was a better way.
#7 Dec 23, 2008 10:10 am
Sorcerer
GroupMembers
Posts902
JoinedJan 29, 2007
A large part of making it easier to maintain would be having a description language (not necessarily an actual programming language, of course, but some kind of convenient representation even in C++) of some sorts that lets you easily describe what kinds of attributes objects have, what the attributes' types are, and what allowable values are. Now, when you want to maintain the OLC code, you have to do all this repetitive code for every thing you want to be editable. In the new world, you'd only have to make note of the field's existence, and everything else would be taken care of for you.
#8 Aug 16, 2011 1:15 am
Magician
GroupMembers
Posts189
JoinedSep 5, 2010
As Vlad said, thanks for the link Davion! Used it to track down why an option wasn't being processed--it was outside the bounds within the case. heh Fixed now.
Pages:<< prev 1 next >>