Author Topic: Code is All Screwed Up  (Read 316 times)

Code: [Select]
function player::NPCWhisper(%bot,%rep,%repvariation,%str,%client){
%time=strlen(%str)/6;
if(%bot.getCharRep(%bot,%client,%bot.faction,%rep,%repvariation)){
botMessage(%bot,%client,%str,%time);
}
}
function isInRange(%a, %b, %range){
return getMax(%a, %b) - getMin(%a, %b) <= %range;
}
function Player::getCharRep(%bot,%client,%faction,%reptarget,%repvariation){
//Fix their rep if it's 0
if($SubterraRep[%client.bl_id,%bot.name] $= ""){
$SubterraRep[%client.bl_id,%bot.name]=0;
}
if($SubterraRep[%client.bl_id,%faction] $= ""){
$SubterraRep[%client.bl_id,%faction]=0;
}
%rep=$SubterraRep[%client.bl_id,%faction]+$SubterraRep[%client.bl_id,%bot.name];
if(isInRange(%reptarget,%rep,%repvariation)){
return 1;
}
}

It's a code that makes a bot chat with people if they have a certain reputation with them. The botmessage function exists btw.

Tested it and got this. First line is what the first 2 args for the event were.

-Testing-
« Last Edit: March 29, 2010, 05:58:31 PM by Wizard »

convertToPositive will apparantly multiply the number by -1, and convertToNegative will apparantly multiply it by 3. isPositive and isNegative hold no use whatsoever.