Extending the ${Task} TLO to include objective.

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Extending the ${Task} TLO to include objective.

Post by dewey2461 » Tue Nov 10, 2015 3:29 pm


Description: Extends the Task TLO with the TaskElementList's Objective[ ]

The TaskElementList is a row,column address where column 0 is the text, 1 is the status, etc.

Examples:

/echo ${Task.Objective} The first objective
/echo ${Task.Objective[0]} The first objective
/echo ${Task.Objective[0,1]} The first objective's status
/echo ${Task.Objective[0,2]} The first objective's zone
/echo ${Task.Objective[1]} The second objective

Hopefully this can get added to the core as its pretty straight forward. Including the whole Task class for reference.

-- Dewey.


Mq2DataTypes.h line 4367

Code: Select all

class MQ2TaskType : public MQ2Type
{
public:
	enum TaskTypeMembers
    {
		Address=1,
        Title=2,
        Timer=3,
        xMember=4,
        Members=5,
        Leader=6,
        List=7,
		Objective=8,
    };
    MQ2TaskType():MQ2Type("task")
    {
        TypeMember(Address);
        TypeMember(Title);
        TypeMember(Timer);
        AddMember(xMember,"Member");
        TypeMember(Members);
        TypeMember(Leader);
        TypeMember(List);
		TypeMember(Objective);
    }
    ~MQ2TaskType()
    {
    }
    bool GETMEMBER();
    bool ToString(MQ2VARPTR VarPtr, PCHAR Destination)
    {
		if(pTaskWnd) {
			if(CListWnd *clist = (CListWnd *)pTaskWnd->GetChildItem("TASK_TaskList")) {
				CXStr Str;
				clist->GetItemText(&Str, 0, 1);
				CHAR szOut[255] = {0};
				GetCXStr(Str.Ptr,szOut,254);
				if(szOut[0]!='\0') {
					strcpy(Destination,szOut);
					return true;
				}
			}
		}
        return false;
    }
    bool FromData(MQ2VARPTR &VarPtr, MQ2TYPEVAR &Source)
    {
        return false;
    }
    bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
    {
        return false;
    }
};

Mq2DataTypes.c line 9448

Code: Select all

bool MQ2TaskType::GETMEMBER()
{
    if(!VarPtr.Ptr)
        return false;
    PMQ2TYPEMEMBER pMember=MQ2TaskType::FindMember(Member);
    if(!pMember)
        return false;
    PTASKMEMBER pTaskmember=(PTASKMEMBER)VarPtr.Ptr;
    switch((TaskTypeMembers)pMember->ID)
    {
    case Address:
		Dest.DWord=(DWORD)VarPtr.Ptr;
		Dest.Type=pIntType;
		return true;
    case Leader:
	{
		for(int i=1;pTaskmember && i<7;pTaskmember=pTaskmember->pNext,i++) {
			if(pTaskmember->IsLeader) {
				strcpy_s(DataTypeTemp,pTaskmember->Name);
				Dest.Ptr=&DataTypeTemp[0];
				Dest.Type=pStringType;
				return true;
			}
		}
		return false;
	}
    case Title:
	{
		CListWnd *clist = (CListWnd *)pTaskWnd->GetChildItem("TASK_TaskList");
		if(clist) {
			CXStr Str;
			clist->GetItemText(&Str, 0, 1);
			CHAR szOut[255] = {0};
			GetCXStr(Str.Ptr,szOut,254);
			if(szOut[0]!='\0') {
				strcpy_s(DataTypeTemp, szOut);
	            Dest.Ptr=&DataTypeTemp[0];
				Dest.Type=pStringType;
				return true;
			}
		}
		return false;
	}
    case Timer:
	{
		pTaskWnd->UpdateTaskTimers(_time32(NULL));
		CListWnd *clist = (CListWnd *)pTaskWnd->GetChildItem("TASK_TaskList");
		if(clist) {
			CXStr Str;
			clist->GetItemText(&Str, 0, 2);
			CHAR szOut[255] = {0};
			GetCXStr(Str.Ptr,szOut,254);
			if(szOut[0]!='\0') {
				int hh, mm, ss;
				if(sscanf_s(szOut, "%d:%d:%d", &hh, &mm, &ss)) {
					Dest.UInt64 = ((hh*3600)+(mm*60)+ss)*1000;
					Dest.Type=pTimeStampType;
					return true;
				}
				return false;
			}
		}
		return false;
	}
	case xMember:
		if (!ISINDEX())
            return false;
        if (ISNUMBER())
        {
			for(int i=1;pTaskmember && i<7;pTaskmember=pTaskmember->pNext,i++) {
				if(i==GETNUMBER()) {
					Dest.Ptr = pTaskmember;
					Dest.Type=pTaskMemberType;
					return true;
				}
			}
        } else {
			for(;pTaskmember;pTaskmember=pTaskmember->pNext) {
				if(!_stricmp(pTaskmember->Name,GETFIRST())) {
					Dest.Ptr = pTaskmember;
					Dest.Type=pTaskMemberType;
					return true;
				}
			}
		}
		return false;
	case Members:
		pTaskmember=pTaskMember;
		Dest.DWord=0;
		for(;pTaskmember && Dest.DWord<6;pTaskmember=pTaskmember->pNext,Dest.DWord++) {
		}
		Dest.Type = pIntType;
		return true;
	case List:
	{
		int theindex = atoi(GETFIRST());
		CListWnd *clist = (CListWnd *)pTaskWnd->GetChildItem("TASK_TaskList");
		if(clist) {
			CXStr Str;
			clist->GetItemText(&Str, theindex, 1);
			CHAR szOut[255] = {0};
			GetCXStr(Str.Ptr,szOut,254);
			if(szOut[0]!='\0') {
				strcpy_s(DataTypeTemp, szOut);
	            Dest.Ptr=&DataTypeTemp[0];
				Dest.Type=pStringType;
				return true;
			}
		}
		return false;
	}
	case Objective:
	{
		int v,r,c;
		v = sscanf(Index,"%d,%d",&r,&c);
		if (v < 2) c = 0;
		if (v < 1) r = 0;
		//WriteChatf("List.Objective[%s] : r=%d C=%d v=%d", Index,r,c,v);
		CListWnd *clist = (CListWnd *)pTaskWnd->GetChildItem("TASK_TaskElementList");
		if(clist) {
			CXStr Str;
			clist->GetItemText(&Str, r, c);
			CHAR szOut[255] = {0};
			GetCXStr(Str.Ptr,szOut,254);
			if(szOut[0]!='\0') {
				strcpy_s(DataTypeTemp, szOut);
	            Dest.Ptr=&DataTypeTemp[0];
				Dest.Type=pStringType;
				return true;
			}
		}
		return false;
	}
    }
    return false;
}

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Re: Extending the ${Task} TLO to include objective.

Post by dewey2461 » Thu Nov 19, 2015 8:10 pm

Bump. Hope to get this change pushed into the source.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Re: Extending the ${Task} TLO to include objective.

Post by EqMule » Sat Jan 02, 2016 8:56 am

It's on my todo list
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Re: Extending the ${Task} TLO to include objective.

Post by EqMule » Mon Jan 04, 2016 11:09 am

added to next zip, thanks for the code :)
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

FrankJScott
a grimling bloodguard
a grimling bloodguard
Posts: 1568
Joined: Sun Feb 19, 2023 7:11 am

Cool Amino Acids Guide

Post by FrankJScott » Thu Apr 10, 2025 6:59 pm

For the person asking about phenolphthalein solution preparation, beta catenin inhibitor, dna repair assay, essential amino acid non essential amino acid, parp treatment, selegiline package insert, mtor inhibitor drugs, solution calculator molecular weight, thymol cas no, sodium butanoate formula, I highly recommend this click this link on amino acid info or cdk inhibitors examples, most common antibacterial drugs, thyroid formation, dhea steroid hormone, hdac cancer, mapkinase pathway, relugolix price, aspartic acid metabolism, dex panthenol, dimercaptosuccinic acid, which is worth considering with this my latest blog post on amino acid advice together with rho kinase inhibitor, anti biotic resistance, geldanamycin, h3 receptor agonist drugs, piperlongumine, dapt gamma secretase inhibitor, l type calcium channel blockers list, 3 main amino acids, potassium channel blockers drug, adenosine antagonist drugs, alongside all this new amino acid site which is also great. Also, have a look at this new amino acid site on top of define desmopressin, nadh in chemistry, atp synthase inhibitors examples, vitamin b2 metabolism, g protein coupled receptor drugs, low rox, ampk atp, betahistine drug, sodium glucose cotransporter 2 inhibitors examples, epigenetics discovery, bearing in mind this additional info on amino acid url together with gpcr inhibitor, amino acid human body, azelaic acid chemical structure, name some calcium channel blockers, dimetridazole, read this post here about together with desmopressin vasopressin difference, compound 3k, antibacterial resistant bacteria, selegiline hcl, diiodo l thyronine, for good measure. Check more @ Recommended Amino Acids Website e3c8dec