so this is with various scripts but i will just give one as usual because its the same problem in all of them
im really baffled with this because i cant find anything like it in any modules in any core
ecompile error:
Code: Select all
Compiling: d:/shard2/Broken Blade/pkg/skills/craftingskills/blacksmithy/make_blacksmith_items.src
Non-identifier declared as a variable: 'max'
Token: Func(6,1): max
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\blacksmithy\make_blacksmith_items.src, Line 93
Error in function 'MakeBlacksmithyItems', File: d:\shard2\Broken Blade\pkg\skills\craftingskills\blacksmithy\make_blacksmith_items.src, Line 93
Error in function 'MakeBlacksmithyItems'.
File: d:\shard2\Broken Blade\pkg\skills\craftingskills\blacksmithy\make_blacksmith_items.src, Line 93Code: Select all
var characterx := character.x;
var charactery := character.y;
var max := CINT (material.amount/material_needed);
if (!max)
SendSysMessage (character, "You don't have enough material to make that!");
return;
elseif (max > 10)
max := 10;
endiffull function:
Code: Select all
function MakeBlacksmithyItems (byref character, byref hammer, byref material)
if (!SearchForAnvilInArea (character) )
SendSysmessage (character, "You must be near an anvil to make anything.");
return;
endif
if (!CheckSkillForDifferentMetals (character, material.objtype) )
SendSysmessage (character, "You have no chance to successfully work with that metal.");
return;
endif
//calls the SelectWhatToMakeFromMenu function found in makemenu.inc, in /scripts/include
var smith_cfg_file := ReadConfigFile ("blacksmithy");
var chosen_item := SelectWhatToMakeFromMenu (character, "mainmenu", smith_cfg_file, GetAttribute (character, ATTRIBUTEID_BLACKSMITHY), material.amount, "Blacksmithy:" );
if (!chosen_item)
SendSysmessage (character, "Canceled.");
return;
endif
//find the item in blacksmithy.cfg file
var selection := FindConfigElem (smith_cfg_file, chosen_item);
if (!selection)
SendSysMessage (character, "That was an invalid selection");
return;
endif
var material_needed := CINT (selection.material);
var item_skill := CINT (selection.skill);
var time_delay := CINT (selection.time);
var item_name := selection.name;
SendSysMessage(character, "(skill: " + item_skill + ", Ingots: " + material_needed + ")");
//save the character's position and ask them how many they want to make
var characterx := character.x;
var charactery := character.y;
var max := CINT (material.amount/material_needed);
if (!max)
SendSysMessage (character, "You don't have enough material to make that!");
return;
elseif (max > 10)
max := 10;
endif
var items_to_make := CINT (Sendtextentrygump (character, "How many do you want to make?:",
TE_CANCEL_DISABLE, TE_STYLE_NORMAL, 10, "(Max: " + max + ", 0 to cancel)"));
if (!items_to_make)
SendSysMessage (character, "Canceled.");
return;
endif
//save the character's position and ask them if they want to autoloop
var found_material, autoupgrade := 0;
if (selection.hasquality)
autoupgrade := 1;
SendSysmessage (character, "Target the ingots to use to upgrade:");
SendSysmessage (character, "(Press Esc. key to create item but not upgrade it)");
found_material := Target (character);
if (!found_material)
autoupgrade := 0;
else
if (!IsIngot (found_material.objtype) )
SendSysMessage (character, "That's not an ingot!");
return;
endif
if (!ReserveItem (found_material) )
SendSysMessage (character, "You cannot use that right now.");
return;
endif
if (!Accessible (character, found_material) )
SendSysMessage (character, "You can't reach that.");
return;
endif
if (found_material.amount < material_needed)
SendSysMessage (character, "You need " + material_needed + " ingots. That's only " + found_material.amount + "!");
return;
endif
endif
endif
var created_item;
repeat
created_item := 0;
for i := 1 to time_delay
PlaySoundEffect (character, SFX_ANVIL);
sleep (2);
endfor
PlaySoundEffect (character, SFX_ANVIL);
if (!CheckSkill (character, SKILLID_BLACKSMITHY, item_skill, 0))
var lossamount := RandomInt (CINT ( material_needed/3) )+1;
SubtractAmount (material, lossamount);
SendSysmessage (character, "You fail, destroying some ingots.");
else
created_item := CreateItemInBackpack (character, chosen_item, 1);
if (!created_item)
PrintTextAbovePrivate (character, "*Your backpack is full!*", character);
return;
endif
SendSysMessage (character, "You place the item in your backpack.");
//set the color
if (material.color)
created_item.color := material.color;
endif
SubtractAmount (material, material_needed);
created_item.buyprice := 0;
if (autoupgrade)
var upgrade_material := CINT (material_needed/2);
if (found_material.amount < upgrade_material)
SendSysMessage (character, "You don't have enough material to upgrade that item!");
return;
endif
var upgrade_skill := item_skill + 15;
if (upgrade_skill > 110)
upgrade_skill := 110;
endif
if (upgrade_skill >= GetAttribute (character, ATTRIBUTEID_BLACKSMITHY) + 20)
SendSysMessage (character, "Your skill is too low to upgrade that item.");
return;
endif
var upgrade_timedelay := time_delay - 1;
if (!upgrade_timedelay or upgrade_timedelay < 0)
upgrade_timedelay := 1;
endif
if (characterx != character.x or charactery != character.y)
SendSysMessage (character, "You stop smithing.");
return;
endif
PerformBlacksmithyItemUpgrade (character, created_item, found_material, upgrade_material,
SKILLID_BLACKSMITHY, upgrade_skill, upgrade_timedelay, item_name);
endif
endif
if (characterx != character.x or charactery != character.y)
SendSysMessage (character, "You stop smithing.");
return;
endif
// DR-03/18/02 Added check for enough material
if ( material.amount < material_needed )
SendSysMessage ( character, "You ran out of material." );
return;
endif
if (created_item)
items_to_make := items_to_make - 1;
endif
sleep (2);
until (!items_to_make);
SendSysMessage (character, "You stop smithing.");
endfunction