Code: Select all
ini_MasterName:Set[$Ini[INI_FILENAME, MASTERLIST, Master, NOT_FOUND]}]
Thanks,
-Red
Moderator: MacroQuest Developers
Code: Select all
ini_MasterName:Set[$Ini[INI_FILENAME, MASTERLIST, Master, NOT_FOUND]}]
Code: Select all
declare ini_MasterName string global
declare ini_ChatInChan string global
declare ini_ChatOutChan string global
declare bv_DoFollow int global 0
Code: Select all
/echo ${Me.ID}
...is a correct number
/echo ${Spawn[MyToonName].ID}
...is a correct number
Code: Select all
/echo ${Me.ID}
...is a correct number
/echo ${Spawn[MyToonName].ID}
...is NULL
Code: Select all
AddTrigger bf_Chat "@Player@ tells you, '@Command@'"
....
function bf_Chat(string FullLine, string Player, string Command)
{
echo In chat trigger with ${FullLine} and ${Player} and ${Command}
if "${Player.Equal[${MasterName}]}"
{
echo ${Player} match for follow
if "${Command.Equal["follow"]}"
{
bv_DoFollow:Set[1]
call bf_Follow ${Player}
}
if "${Command.Equal["stay"]}"
{
bv_DoFollow:Set[0]
}
}
return
}
function bf_Follow(string Player)
{
if "${Spawn[${Player}].ID}"
{
${Spawn[${Player}]}:Target
}
else
{
echo Could not find spawn ${Player} to follow
return
}
do
{
echo In follow function, looking for ${Player}
ExecuteQueued
face
if "${Spawn[${Player}].Distance} > 20"
{
keypress forward
keypress forward hold
}
else
{
keypress back
}
}
while ${bv_DoFollow}
return
}
Code: Select all
In chat trigger with ToonName tells you, 'follow' and ToonName and follow
ToonName match for follow
Could not find spawn ToonName to follow
Code: Select all
${Player}:Set[Argo]
or
${Player}:Set["Argo"]
Code: Select all
noop ${Spawn[pc,${Player.Lower}]:Target
Code: Select all
//TO DO
Code: Select all
noop ${Spawn[pc,${Player.Lower}]:Face}
noop ${Spawn[pc,${Player.Lower}]:Face[fast]}
noop ${Spawn[pc,${Player.Lower}]:Target:Face}
noop ${Spawn[pc,${Player.Lower}]:Target:Face[fast]}
Code: Select all
Spawn[pc,${Player.Lower}]:Face
Code: Select all
case Face:
{
PSPAWNINFO pSpawn = (PSPAWNINFO)GetSpawnByID(pPtr->SpawnID);
if (pSpawn->SpawnID==((PSPAWNINFO)pCharSpawn)->SpawnID) // If it is ourself, don't do anything.
return true;
bool bfPredict=false;
bool bfAway=false;
bool bfNolook=false;
bool bfFast=false;
gFaceAngle = (
atan2(pSpawn->X - ((PSPAWNINFO)pCharSpawn)->X,
pSpawn->Y - ((PSPAWNINFO)pCharSpawn)->Y)
* 256.0f / PI);
while (argc--)
{
if (!stricmp(argv[argc],"predict"))
bfPredict=true;
else if (!stricmp(argv[argc],"nolook"))
bfNolook=true;
else if (!stricmp(argv[argc],"away"))
bfAway=true;
else if (!stricmp(argv[argc],"fast"))
bfFast=true;
}
if (bfPredict)
{
DOUBLE Distance;
Distance = DistanceToSpawn((PSPAWNINFO)pCharSpawn, pSpawn);
gFaceAngle = (
atan2((pSpawn->X + (pSpawn->SpeedX * Distance)) - ((PSPAWNINFO)pCharSpawn)->X,
(pSpawn->Y + (pSpawn->SpeedY * Distance)) - ((PSPAWNINFO)pCharSpawn)->Y)
* 256.0f / PI);
}
if (!bfNolook) {
DOUBLE Distance = DistanceToSpawn((PSPAWNINFO)pCharSpawn, pSpawn);
gLookAngle = (
atan2(pSpawn->Z + pSpawn->AvatarHeight*StateHeightMultiplier(pSpawn->StandState) - ((PSPAWNINFO)pCharSpawn)->Z -
((PSPAWNINFO)pCharSpawn)->AvatarHeight*StateHeightMultiplier(((PSPAWNINFO)pCharSpawn)->StandState),
(FLOAT)Distance)
* 256.0f / PI);
if (bfAway) gLookAngle = -gLookAngle;
if (bfFast) {
((PSPAWNINFO)pCharSpawn)->CameraAngle = (FLOAT)gLookAngle;
gLookAngle=10000.0f;
}
}
if (bfAway) {
gFaceAngle += 256.0f;
}
if (gFaceAngle>=512.0f) gFaceAngle -= 512.0f;
if (gFaceAngle<0.0f) gFaceAngle += 512.0f;
if (bfFast) {
((PSPAWNINFO)pCharSpawn)->Heading = (FLOAT)gFaceAngle;
gFaceAngle=10000.0f;
}
}
return true;
case LeftClick:
{
PSPAWNINFO pSpawn = (PSPAWNINFO)GetSpawnByID(pPtr->SpawnID);
pEverQuest->LeftClickedOnPlayer((EQPlayer *)pSpawn);
return true;
}
case RightClick:
{
PSPAWNINFO pSpawn = (PSPAWNINFO)GetSpawnByID(pPtr->SpawnID);
pEverQuest->RightClickedOnPlayer((EQPlayer *)pSpawn);
return true;
}
So does that also holds true for :Target and other methods in the data sequence (yay for me with new terms!)?No need to use noop in this situation, you can use methods directly as commands, like this:
Code: Select all
Spawn[pc,${Player.Lower}]:Face
etc. Note the lack of outer ${. The lower case thing is fixed in cvs
Code: Select all
Spawn[pc,${Player.Lower}]:Target
Spawn[pc,${Player.Lower}]:Target:Face
Spawn[pc,${Player.Lower}]:Target:Face[fast]
of course!RedOneDI wrote:So does that also holds true for :Target and other methods in the data sequence (yay for me with new terms!)?
It never would have returned a string object, just the text. And you're not doing a method on a member because you're not using a member, just methods in your post -- you do methods on objects, and you access members of objects. But other than the usage of terms, you're probably thinking correctly :)I guess I'm assuming that without the ${ for spawn that it is not returning string object, instead it is just doing the method on the member (am I using these terms right?) given the data type?