having troubles with skill scripts
Posted: Fri Jan 20, 2012 11:47 pm
ok so ive come to an error that i have no clue about.
the compiler error im getting is
and the section of that script is
i have found Left(str, count) in pol 95 basic.em, and im pretty sure that is what its error is, because it has been removed from the core and i cant find anything about it in the core changes 
the full script is:
i just cant seem to work this one out, does anyone have any idea if Left(str, count) has been replaced by something else or if its even relevant to this?
any help is much appreciated because all my crafting skill scripts have this
-mat
the compiler error im getting is
Code: Select all
Compiling: d:/shard2/Broken Blade/pkg/skills/craftingskills/tinkering/tinkering.src
Token '(' cannot follow token 'left'
Function left() is not defined.
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 227
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 226
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 226
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 225
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 225
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 224
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 224
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 219
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 219
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 214
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 214
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 175
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 175
Error in IF statement starting at File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 170
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 170
Error compiling statement at d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 169
Error in function 'BasicMakeSomething', File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 227
Error in function 'BasicMakeSomething'.
File: d:\shard2\Broken Blade\pkg\skills\craftingskills\tinkering\tinkering.src, Line 227Code: Select all
if ( retMasterpiece[retOk.keyID] )
if ( GFExtractData( retName.keyID, retMasterpiece ) )
if ( len(GFExtractData( retName.keyID, retMasterpiece )) > 40 )
created_item.name := left(GFExtractData( retName.keyID, retMasterpiece ), 40) + " [Masterpiece]";
else
created_item.name := GFExtractData( retName.keyID, retMasterpiece ) + " [Masterpiece]";
endif
else
created_item.name := AddArticle( item_name ) + " [Masterpiece]";
endif
else
created_item.name := AddArticle( item_name ) + " [Masterpiece]";
endifthe full script is:
Code: Select all
function BasicMakeSomething ( character, use_on, menu, skillsound)
var chosen_item := SelectWhatToMakeFromMenu (character, menu, tinker_cfg_file, GetAttribute (character, ATTRIBUTEID_TINKERING), use_on.amount, "Tinkering:");
if (!chosen_item)
SendSysmessage (character, "Canceled.");
return;
endif
//find the item in tinkering.cfg file
var selection := FindConfigElem (tinker_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 item_name := selection.name;
var item_stackable := selection.stackable;
var item_lockable := selection.lockable;
SendSysMessage(character, "(skill: " + item_skill + ", Ingots: " + material_needed + ")");
var loopit := YesNo(character,"Autoloop?");
var x := character.x;
var y := character.y;
SendSysMessage (character, "You begin tinkering...");
repeat
if ( use_on.amount >= material_needed )
for i := 1 to 3
PlaySoundEffect (character, skillsound);
sleep (2);
endfor
if (CheckSkill (character, SKILLID_TINKERING, item_skill, 0))
var created_item := 0;
if (chosen_item == UOBJ_OBSIDIAN or chosen_item == UOBJ_PORCELAIN or chosen_item == UOBJ_EMPTY_BOTTLE or chosen_item == UOBJ_LOCKPICKS)
var amount_to_create := CINT (use_on.amount/material_needed);
if (amount_to_create > 10)
amount_to_create := 10;
endif
created_item := CreateItemInBackpack (character, chosen_item, amount_to_create);
if (!created_item)
PrintTextAbovePrivate (character, "*Your backpack is full*", character);
return;
endif
SubtractAmount (use_on, material_needed*amount_to_create);
else
created_item := CreateItemInBackpack (character, chosen_item, 1);
if (!created_item)
PrintTextAbovePrivate (character, "*Your backpack is full*", character);
return;
endif
created_item.movable := 1;
if (!item_stackable)
created_item.name := item_name + " [crafted by " + character.name + "]";
endif
//metal chests get colored
if (created_item.objtype == 0xe40 or created_item.objtype == 0xe41)
created_item.color := use_on.color;
endif
SubtractAmount (use_on, material_needed);
endif
if (item_lockable and CheckSkill (character, SKILLID_TINKERING, 40, 0) )
PrintTextAbovePrivate (character, "Lockable!", character);
SetObjProperty(created_item, "lockable", "1");
var lockid := AllocLockId();
var thekey := CreateItemInContainer (created_item, UOBJ_COPPER_KEY, 1);
SetObjProperty (thekey, "lockid", lockid);
SetObjProperty (created_item, "lockid", lockid);
endif
if( !NoMasterPiece( character ) )
var msSkill := item_skill;
if( msSkill < 50 )
msSkill := 50;
endif
if ( (CInt( (item_skill * 1.5) ) == RandomInt( CInt( (item_skill * 1.5) ) + 1 ))
and (!IsStackableItem( created_item )))
PrepareMasterpieceGump();
SendSysMessage( character, "You made a masterpiece!" );
var retMasterpiece := GFSendGump( character );
if ( retMasterpiece[retOk.keyID] )
if ( GFExtractData( retName.keyID, retMasterpiece ) )
if ( len(GFExtractData( retName.keyID, retMasterpiece )) > 40 )
created_item.name := left(GFExtractData( retName.keyID, retMasterpiece ), 40) + " [Masterpiece]";
else
created_item.name := GFExtractData( retName.keyID, retMasterpiece ) + " [Masterpiece]";
endif
else
created_item.name := AddArticle( item_name ) + " [Masterpiece]";
endif
else
created_item.name := AddArticle( item_name ) + " [Masterpiece]";
endif
AddRandomMasterpieceEffect( created_item );
endif
endif
SendSysmessage (character, "You create the item and place it in your pack.");
else
SendSysMessage (character, "You fail, destroying some material.");
SubtractAmount (use_on, RandomInt (material_needed) );
endif
else
SendSysMessage (character, "You run out of material.");
return;
endif
if (!loopit)
return;
else
sleep (2);
endif
until (character.x != x or character.y != y);
SendSysMessage (character, "You stop tinkering...");
endfunctionany help is much appreciated because all my crafting skill scripts have this
-mat