SetScriptController() Detach() Attach()

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
User avatar
zandor70
Master Poster
Posts: 93
Joined: Fri Feb 10, 2006 10:06 am

SetScriptController() Detach() Attach()

Post by zandor70 »

I ma very hard, I know, but I have a question.

SetScriptController(): What does esactly this command?

It is similar to Attach()

And Detach()?

Someone can explain all these 3 commands (and other related or similar)?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

SetScriptController is used for the reputation system. The mobile you set as the controller will be held accountable for all helpful/harmful actions caused in that script.

Attach attaches a script to the character. There can never be more than 1 script attached to a character. Checking if a script can attach or not can be useful in making it so a player can't do more than one thing at a time.

Detach will take an attached script off of the character.
User avatar
zandor70
Master Poster
Posts: 93
Joined: Fri Feb 10, 2006 10:06 am

Post by zandor70 »

In past I used Detach() (but not using Attach() first) thinking that so if player logout script continue to run. I am wrong?

What happen to script if player logout?
- After an Attach() ?
- After a Detach() ?
- If I do not use Attach() or Detach() ?

There is a command to use to force script stop when player logout or to force script continue if player logout?
User avatar
zandor70
Master Poster
Posts: 93
Joined: Fri Feb 10, 2006 10:06 am

Post by zandor70 »

mmm none know reply?
mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Post by mr bubbles »

Just did some testing and came up with this.

-After attach and log off, the script stops running

-If not attached in first place and log off, the script continues running

-If attached and then detached BEFORE player logs off, then the script continues running.
User avatar
zandor70
Master Poster
Posts: 93
Joined: Fri Feb 10, 2006 10:06 am

Post by zandor70 »

Perfect... the last question.... there is some case in which pore itself Attach() script at startup?
mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Post by mr bubbles »

Cant think of any script that attaches by default at log on. I mean theres logon and oncreate but they are different in that they run to completion before the player can log off anyway.
User avatar
zandor70
Master Poster
Posts: 93
Joined: Fri Feb 10, 2006 10:06 am

Post by zandor70 »

Thx :-)
Post Reply