new character member

Archive of the older Feature Request Forum Posts

Moderator: POL Developer

Locked
Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

new character member

Post by Tomi » Sun Dec 21, 2008 8:18 am

I just coded some text commands with loops and targets in them, and I found out that while you have the loop and target still active you can use another text command at the same time.

That's why I'm suggesting a new character member as character.Command or character.textcmd or similar which return a boolean true/false if the character has a text command script active.

For now im fixing this problem with using an ObjProperty check in every single textcmd, but it should be alot more simple by having a member, because then you shouldn't have to Erase that property together with every return in the command.

I know this should be possible to do with a speech hook and checking if the first ASCII letter is 46 or the first letter is . but this is a suggestion.

User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Re: new character member

Post by ncrsn » Sun Dec 21, 2008 8:40 am

Code: Select all

    // This I check right after the program block.
    if (!CanUseCommand(who))
         return;
    endif
    // ....

Code: Select all

function CanUseCommand( who )
    
    if (GetProcess(who.GetProp("#UsingCommand")))
        return 0;
    endif
    
    who.SetProp("#UsingCommand", GetPid());
    return 1;

endfunction
- No need to erase cprop, it's enough that the textcommand process is dead.
- You can specify which command(s) are restricted (use the function only in those), you couldn't do that with .textcmd member.
- Once you have implemented this to your text commands, you can easily do other nasty stuff later on.
- You don't have to wait till tomorrow to begin using this, unlike you would have to if you wait for POL devs to implement this.

Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

Re: new character member

Post by Tomi » Sun Dec 21, 2008 9:24 am

thank you for the tip, I wasn't thinking that I could do that with the Process ID's of the scripts :P

MuadDib
Former Developer
Posts: 1090
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Re: new character member

Post by MuadDib » Sun Dec 21, 2008 4:43 pm

Let's not forget setting the script controller etc. Can't remember offhand the full effects, aside from it linking so that any ill effects (spells for example) let's the core know who to flag as aggressor and such

User avatar
CWO
POL Expert
Posts: 1148
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: new character member

Post by CWO » Mon Dec 22, 2008 4:16 am

who.cursor Boolean True if the client has an active target cursor r/o

Locked