Profile for Old MikeS

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Recent posts

Pages

AuthorRecent posts
Peculiar error? in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #2
Dang. Should've checked the bugs list before posting. Any work-arounds?
Also, is someone maintaining alint? When running against some scripts, it flags the following valid code:
string somevar = "some val"; In fact any 'constant' string defined this way used later it also flags as an inappropriate variable.

Mike
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Peculiar error? in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #2
Dang. Should've checked the bugs list before posting. Any work-arounds?
Also, is someone maintaining alint? When running against some scripts, it flags the following valid code:
string somevar = "some val"; In fact any 'constant' string defined this way used later it also flags as an inappropriate variable.

Mike
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Peculiar error? in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #0
Hi all,

Have the following creature script (it has debug lines in it):
// thief.txt
// - based off of basicnpc
// A very simple, naive text. Creature attacks anything it hates nearby.
// Once it has won, it returns to its home.
// In addition, will occasionally, based on level, will attempt to steal a
// random object from the character fighting. If successful, will then
// teleport away.
// Memory Cells:
// Cell 0 - How creature moves.
// 0 - If 0, wander randomly.
// 1 - Stands still until a target appears.
// 2 - Completely immobile, even if target appears.
// Cell 1,2 - Stuff done flag. If both 0, nothing. Otherwise when this
// is killed, set to 1. (Example: If cell 1 is 3 and cell 2 is 5, when
// creature is killed, sets SDF(3,5) to 1.)
// Cell 3 - Dialogue node to start with if talked to. if left at 0, this
// character doesn't talk.
// Cell 4,5 - Coordinates of chest/spot to place stolen items at. If both
// left at zero, thief keeps item.

begincreaturescript;

variables;

short i, itm, slt, st, x, y, fl, tr, target;

body;

beginstate INIT_STATE;
if (get_memory_cell(0) == 2)
set_mobility(ME, 0);
break;

beginstate DEAD_STATE;
// Set the appropriate stuff done flag for this character being dead
if ((get_memory_cell(1) != 0) || (get_memory_cell(2) != 0))
set_flag(get_memory_cell(1), get_memory_cell(2), 1);
break;

beginstate START_STATE;
// if I have a target for some reason, go attack it
if (target_ok()) {
if (dist_to_char(get_target()) <= 16)
set_state(3);
else set_target(ME, -1);
}

// Look for a target, attack it if visible
if (select_target(ME, 8, 0)) {
do_attack();
set_state(3);
}

// Have I been hit? Strike back!
if (who_hit_me() >= 0) {
set_target(ME, who_hit_me());
do_attack();
set_state(3);
}

// Otherwise, just peacefully move around. Go back to start, if I'm too far
// from where I started.
if ((my_dist_from_start() >= 6) || ((my_dist_from_start() > 0) && (get_memory_cell(0) > 0))) {
if (get_ran(1, 1, 100) < 40)
return_to_start(ME, 1);
}
else if (get_memory_cell(0) == 0) {
fidget(ME, 25);
}

// if we're in combat and the above didn't give me anything to do, just
// stop now. Otherwise, game will keep running script, and that eats up CPU time.
if (am_i_doing_action() == FALSE)
end_combat_turn();
break;

beginstate 3; // attacking
if (target_ok() == FALSE)
set_state(START_STATE);
// try to steal?
if ((get_ran(1, 0, 100) <= get_level(my_number())) && (is_town() == 1)) {
set_state_continue(10);
}
else {
do_attack();
}
break;

beginstate TALKING_STATE;
if (get_memory_cell(3) == 0) {
print_str("Talking: It doesn't respond.");
end();
}
begin_talk_mode(get_memory_cell(3));
break;

beginstate 10;
// steal something?
print_str("Start of steal.");
i = get_target();
print_big_str("Target = ", i, "");
if ((get_memory_cell(4) == 0) && (get_memory_cell(5) == 0)) {
st = 13;
}
else {
st = 0;
}
slt = get_ran(1, st, 39);
print_big_str("Slot = ", slt, "");
itm = item_type_in_slot(i, slt);
if (itm > 0) {
// steal it and go...
print_big_str("Good item = ", itm, "");
if (st > 0) {
print_str("Before take item.");
char_take_item(i, itm);
char_give_item(my_number(), itm);
}
else {
take_item_char_item(i, slt, get_memory_cell(4), get_memory_cell(5));
}
print_str("Getting ready to leave.");
set_state_continue(11);
}
else {
do_attack();
}
break;

beginstate 11;
// teleport away (get random location (not blocked) and go)
print_str_color("The thief takes an item and slips away.", 4);
i = current_town_size();
if (i == 0)
st = 63;
else if (i == 1)
st = 47;
else
st = 31;
i = 0;
while (i == 0) {
x = get_ran(1, 0, st);
y = get_ran(1, 0, st);
// check x and y
fl = get_floor(x, y);
tr = get_terrain(x, y);
if ((((fl >= 0) && (fl <= 22)) || ((fl >= 37) && (fl <= 56)) ||
((fl >= 72) && (fl <= 78)) || ((fl >= 81) && (fl <= 91)) ||
((fl >= 95) && (fl <= 123))) &&
(((tr >= 2) && (tr <= 121)) || ((tr >= 137) && (tr <= 146)) ||
((tr >= 155) && (tr <= 165))) &&
(is_blocked() == 0)) {
i = 1;
}
// slip to location
if (i == 1) {
relocate_character(my_number(), x, y);
}
}
break;
What seems to happen is that it gets to the line 'char_take_item()' and throws the following message: 'Peculiar Error: Undefined function called'. I've been banging on this code for two days and can't figure out why it's displaying that message. Does anyone know what it means? Have I forgotten something in the script?

Mike
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Peculiar error? in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #0
Hi all,

Have the following creature script (it has debug lines in it):
// thief.txt
// - based off of basicnpc
// A very simple, naive text. Creature attacks anything it hates nearby.
// Once it has won, it returns to its home.
// In addition, will occasionally, based on level, will attempt to steal a
// random object from the character fighting. If successful, will then
// teleport away.
// Memory Cells:
// Cell 0 - How creature moves.
// 0 - If 0, wander randomly.
// 1 - Stands still until a target appears.
// 2 - Completely immobile, even if target appears.
// Cell 1,2 - Stuff done flag. If both 0, nothing. Otherwise when this
// is killed, set to 1. (Example: If cell 1 is 3 and cell 2 is 5, when
// creature is killed, sets SDF(3,5) to 1.)
// Cell 3 - Dialogue node to start with if talked to. if left at 0, this
// character doesn't talk.
// Cell 4,5 - Coordinates of chest/spot to place stolen items at. If both
// left at zero, thief keeps item.

begincreaturescript;

variables;

short i, itm, slt, st, x, y, fl, tr, target;

body;

beginstate INIT_STATE;
if (get_memory_cell(0) == 2)
set_mobility(ME, 0);
break;

beginstate DEAD_STATE;
// Set the appropriate stuff done flag for this character being dead
if ((get_memory_cell(1) != 0) || (get_memory_cell(2) != 0))
set_flag(get_memory_cell(1), get_memory_cell(2), 1);
break;

beginstate START_STATE;
// if I have a target for some reason, go attack it
if (target_ok()) {
if (dist_to_char(get_target()) <= 16)
set_state(3);
else set_target(ME, -1);
}

// Look for a target, attack it if visible
if (select_target(ME, 8, 0)) {
do_attack();
set_state(3);
}

// Have I been hit? Strike back!
if (who_hit_me() >= 0) {
set_target(ME, who_hit_me());
do_attack();
set_state(3);
}

// Otherwise, just peacefully move around. Go back to start, if I'm too far
// from where I started.
if ((my_dist_from_start() >= 6) || ((my_dist_from_start() > 0) && (get_memory_cell(0) > 0))) {
if (get_ran(1, 1, 100) < 40)
return_to_start(ME, 1);
}
else if (get_memory_cell(0) == 0) {
fidget(ME, 25);
}

// if we're in combat and the above didn't give me anything to do, just
// stop now. Otherwise, game will keep running script, and that eats up CPU time.
if (am_i_doing_action() == FALSE)
end_combat_turn();
break;

beginstate 3; // attacking
if (target_ok() == FALSE)
set_state(START_STATE);
// try to steal?
if ((get_ran(1, 0, 100) <= get_level(my_number())) && (is_town() == 1)) {
set_state_continue(10);
}
else {
do_attack();
}
break;

beginstate TALKING_STATE;
if (get_memory_cell(3) == 0) {
print_str("Talking: It doesn't respond.");
end();
}
begin_talk_mode(get_memory_cell(3));
break;

beginstate 10;
// steal something?
print_str("Start of steal.");
i = get_target();
print_big_str("Target = ", i, "");
if ((get_memory_cell(4) == 0) && (get_memory_cell(5) == 0)) {
st = 13;
}
else {
st = 0;
}
slt = get_ran(1, st, 39);
print_big_str("Slot = ", slt, "");
itm = item_type_in_slot(i, slt);
if (itm > 0) {
// steal it and go...
print_big_str("Good item = ", itm, "");
if (st > 0) {
print_str("Before take item.");
char_take_item(i, itm);
char_give_item(my_number(), itm);
}
else {
take_item_char_item(i, slt, get_memory_cell(4), get_memory_cell(5));
}
print_str("Getting ready to leave.");
set_state_continue(11);
}
else {
do_attack();
}
break;

beginstate 11;
// teleport away (get random location (not blocked) and go)
print_str_color("The thief takes an item and slips away.", 4);
i = current_town_size();
if (i == 0)
st = 63;
else if (i == 1)
st = 47;
else
st = 31;
i = 0;
while (i == 0) {
x = get_ran(1, 0, st);
y = get_ran(1, 0, st);
// check x and y
fl = get_floor(x, y);
tr = get_terrain(x, y);
if ((((fl >= 0) && (fl <= 22)) || ((fl >= 37) && (fl <= 56)) ||
((fl >= 72) && (fl <= 78)) || ((fl >= 81) && (fl <= 91)) ||
((fl >= 95) && (fl <= 123))) &&
(((tr >= 2) && (tr <= 121)) || ((tr >= 137) && (tr <= 146)) ||
((tr >= 155) && (tr <= 165))) &&
(is_blocked() == 0)) {
i = 1;
}
// slip to location
if (i == 1) {
relocate_character(my_number(), x, y);
}
}
break;
What seems to happen is that it gets to the line 'char_take_item()' and throws the following message: 'Peculiar Error: Undefined function called'. I've been banging on this code for two days and can't figure out why it's displaying that message. Does anyone know what it means? Have I forgotten something in the script?

Mike
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #9
That's good to know, It'll save me the time to test out a darkness breather. I guess because of this line (in the boa exe)
'Your light is instantly snuffed out.' in the same area as the 'breathes darkness' text, I made the assumption that the darkness breath killed the light sources. Oh well.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #9
That's good to know, It'll save me the time to test out a darkness breather. I guess because of this line (in the boa exe)
'Your light is instantly snuffed out.' in the same area as the 'breathes darkness' text, I made the assumption that the darkness breath killed the light sources. Oh well.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #7
Just in case someone else needs a solution for this, what I ended up doing was set the dungeons to total dark, and add custom floor types importing the regular floor types, but adding the fl_light_radius=3 line to them. This isn't as slick as 'a puff of wind blows through and snuffs your torch out', but it allows me to have 'dark' areas and lighted areas without having to place terrain light sources.
Note, I tried with the status calls to see if there was an undocumented status, but up through about status = 400, no luck.
Also, it seems like you can create creatures that breath 'darkness'. It sure seems like that it would be easy enough to add a call to control the parties light source.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #7
Just in case someone else needs a solution for this, what I ended up doing was set the dungeons to total dark, and add custom floor types importing the regular floor types, but adding the fl_light_radius=3 line to them. This isn't as slick as 'a puff of wind blows through and snuffs your torch out', but it allows me to have 'dark' areas and lighted areas without having to place terrain light sources.
Note, I tried with the status calls to see if there was an undocumented status, but up through about status = 400, no luck.
Also, it seems like you can create creatures that breath 'darkness'. It sure seems like that it would be easy enough to add a call to control the parties light source.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #0
Hi all,

Does anyone know of a good technique to turn off a parties light source (torch, lamp, magic, etc.) and make it 'dark' again while in a dungeon? I couldn't find anything in the manual, but could've missed something that would work.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Turn off Light (in dungeon) in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #0
Hi all,

Does anyone know of a good technique to turn off a parties light source (torch, lamp, magic, etc.) and make it 'dark' again while in a dungeon? I couldn't find anything in the manual, but could've missed something that would work.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Split out characters and death in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #2
Thanks for the warning. Luckily this isn't intergal to the plot line, just trying to dot the i's, cross the t's - so to speak. I'll probably just put in a warning message about combat mode and let the player make the choice. As another thought, would placing a check after each 'doattack()' call within the creature scripts be a better place to see if the split off character is in trouble? :confused: I may try this one day when I get really motivated. :)
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Split out characters and death in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #2
Thanks for the warning. Luckily this isn't intergal to the plot line, just trying to dot the i's, cross the t's - so to speak. I'll probably just put in a warning message about combat mode and let the player make the choice. As another thought, would placing a check after each 'doattack()' call within the creature scripts be a better place to see if the split off character is in trouble? :confused: I may try this one day when I get really motivated. :)
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Wandering town monsters (turn off) in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #3
Thanks. I kinda knew that generation through scripting was the way to go, I was just getting lazy. :)
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Wandering town monsters (turn off) in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #3
Thanks. I kinda knew that generation through scripting was the way to go, I was just getting lazy. :)
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Split out characters and death in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #0
I have the following code in a town's start state:
if (get_flag(4, 13) > 0) {
plyr = get_selected_char();
// check if player in trouble in arena - loses automatically
if ((char_status(plyr) != 1) || (get_health(plyr) < 15)) {
// player has lost - rejoin party, then revive
ii = get_char_status(plyr, 4);
set_char_status(plyr, 4, -ii, 1, 0);
reunite_party();
restore_pc(plyr);
play_sound(27);
message_dialog("You have lost your fight and have been teleported back to your companions.", "The victor is still getting crowd acclamation within the arena");
kill_char(get_flag(4, 3), 2, 0);
set_flag(4, 3, 0);
set_flag(4, 13, 0);
}
}
Basically, it watches a 'split off' character and forces a heal/rejoin if the character is in trouble. It works great as long as the character does not go into combat mode. There it only works if the wounded check is met between combat rounds. Otherwise, the game ends in death. Is there another way to force a party rejoin if a split character dies while in combat that I may have missed? Or do I just pop up message letting the player know that combat may not be the best option while 'split'?
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Split out characters and death in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #0
I have the following code in a town's start state:
if (get_flag(4, 13) > 0) {
plyr = get_selected_char();
// check if player in trouble in arena - loses automatically
if ((char_status(plyr) != 1) || (get_health(plyr) < 15)) {
// player has lost - rejoin party, then revive
ii = get_char_status(plyr, 4);
set_char_status(plyr, 4, -ii, 1, 0);
reunite_party();
restore_pc(plyr);
play_sound(27);
message_dialog("You have lost your fight and have been teleported back to your companions.", "The victor is still getting crowd acclamation within the arena");
kill_char(get_flag(4, 3), 2, 0);
set_flag(4, 3, 0);
set_flag(4, 13, 0);
}
}
Basically, it watches a 'split off' character and forces a heal/rejoin if the character is in trouble. It works great as long as the character does not go into combat mode. There it only works if the wounded check is met between combat rounds. Otherwise, the game ends in death. Is there another way to force a party rejoin if a split character dies while in combat that I may have missed? Or do I just pop up message letting the player know that combat may not be the best option while 'split'?
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Wandering town monsters (turn off) in Blades of Avernum Editor
Apprentice
Member # 5294
Profile Homepage #0
Maybe it's just me and I haven't found it, but how do you turn off the wandering town monsters when you 'kill' a town? I would've assumed that by setting a town as dead, that the wandering monsters defined would stop, but they still seem to be generated. In outdoor regions, you have a sdf that can be used to turn off the encounters, but there doesn't seem to be something similar for wandering town monsters.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00
Wandering town monsters (turn off) in Blades of Avernum
Apprentice
Member # 5294
Profile Homepage #0
Maybe it's just me and I haven't found it, but how do you turn off the wandering town monsters when you 'kill' a town? I would've assumed that by setting a town as dead, that the wandering monsters defined would stop, but they still seem to be generated. In outdoor regions, you have a sdf that can be used to turn off the encounters, but there doesn't seem to be something similar for wandering town monsters.
Posts: 30 | Registered: Wednesday, December 15 2004 08:00

Pages