1
Modification Help / Re: Homing Script
« on: January 23, 2012, 08:01:33 PM »Code: [Select]while(1)
{
%search=containerSearchNext();
if(%prj.client==%search.client)
{
continue;
}
%mg=%prj.client.minigame;
%mc=%search.client.minigame;
%mgo=isObject(%mg);
%mco=isObject(%mco);
if(%mgo == %mco == 1)
{
if(%mg!$=%mc)
{
continue;
}
}
if(isObject(%search))
{
%obj=%search;
}
break;
}
Looks excessively complicated, though it could have grown that way due to subtle unexpected engine behaviour. I highly doubt it, so would suggest the alternative:
Code: [Select]
while((%found = containerSearchNext()))
{
if(%prj.client.minigame == %found.client.minigame)
{
%obj = %found;
break;
}
}
"%mco=isObject(%mco);" is clearly a typo, intended to be "%mco=isObject(%mc);"
"%mgo == %mco == 1" is likely the same as "(%mgo == %mco) == 1", which is redundant. At first I thought it may have been an attempt to imitate a logical XOR through awkward syntax, but "%mg!$=%mc" clearly expects them to both either be objects or not objects.
Ah, but the layout of that makes me think that there was a problem with minigames that no longer existed, and the solution used seems to be overly complex. So...
Code: [Select]
while((%found = containerSearchNext()))
{
%mg = %prj.client.minigame;
%mc = %found.client.minigame;
if((!isObject(%mc) && !isObject(%mg)) || %mc == %mg)
{
%obj = %found;
break;
}
}
Edit: Oops, missed the part about not targeting self, so it would be
Code: [Select]
while((%search = containerSearchNext()))
{
if(%prj.client == %search.client)
{
continue;
}
%mg = %prj.client.minigame;
%mc = %search.client.minigame;
if((!isObject(%mc) && !isObject(%mg)) || %mc == %mg)
{
%obj = %search;
break;
}
}