Page 1 of 1

item.usescript

Posted: Fri Apr 27, 2007 6:42 pm
by mr bubbles
This doesn't seem to be working on 90% of the objects ive tried it on.

I've had a good look at itemdesc for items to see if there are any major differences in the items that DO report a usescript and those that DON"T.

Cant find anything though, its not particular to type (Container, item, weapon, etc) or how the Script is declared (ie, Script :pkgname:script).

Edit:

oh, read documentation... seems a bit weird only making it report the usescript for items that have had it set via script. Can i ask why this is?

Posted: Sat Apr 28, 2007 12:09 am
by FreeSoul
use just
script
not usescript
:)

Posted: Sat Apr 28, 2007 12:30 am
by mr bubbles
script is for the ai script on mobiles, usescript is the (doubleclick) script on items.

Posted: Sat Apr 28, 2007 2:55 am
by Pierce
You use the .usescript member to override an existing script or to set a script on an item which normally doesn't have one.

If you search an example you can take a look at the tinker traps or the secure containers which are normally in every script base.
If you place a trap on a container you set the usescript of the container to the script which handles what has to be done if someone double clicks that container. If the trap explodes or someone removes the trap you set the container.usescript := ""; and the container is handled normally again.

So that is not a bug, it's a feature :D

Posted: Tue May 01, 2007 8:57 pm
by Yukiko
Mr. Bubbles,

I am not sure exactly what you are referencing here. Are you referring to the entry in an itemdesc.cfg file for the 'use script'?

Posted: Wed May 02, 2007 3:56 am
by Tritan
mr bubbles wrote:script is for the ai script on mobiles, usescript is the (doubleclick) script on items.
In the itemdesc.cfg file you define the script, not the use script, for what script will run when double clicked. .usescript <scriptname> is a text command that will override the script entry in the configuration file for the targetted item only.