Page 1 of 1
Need some help with a really really basic script
Posted: Tue May 01, 2007 6:39 pm
by Crustspikes

ops:
Hi, I'm actually... pretty nw in POL Scripting. I just need some help with a basic script, so i can use it as a reference.
This idea consists in making any GM Tinkering capable to rename any kind of jewelry, with a command (.renamejewelry, for example) that checks if their skill is 100 and if the necklace, ring, etc. is in their backpack.
Thanks for your help, and sorry bout' the bad english.
Posted: Tue May 01, 2007 9:21 pm
by Yukiko
The following script should work under any scriptset running on POL 96 core.
Code: Select all
use os;
use uo;
// uncomment the following line if you are using POL 0.97 core.
// use attributes;
program textcmd_rename( speaker, newname )
if (GetAttribute(speaker, "Tinkering")<100); // Has to have an effective tinkering skill of 100
SendSysMessage(speaker, "Your skill is not high enough to name this item!");
return 0;
endif
var thetarg := Target(speaker);
// If the player hits the <ESC> key.
if(!thetarg)
SendSysMessage(speaker, "Cancelled.");
return 0;
endif
// If the player tries to rename a mobile
if(thetarg.IsA(POLCLASS_MOBILE))
SendSysMessage(speaker, "You can't rename that silly.");
return 0;
endif
// Check to see if we have the item in our backpack
if (thetarg.container == speaker.backpack)
SetName(thetarg, newname);
SendSysMessage(speaker, "You successfully renamed the item.");
return 1;
endif
endprogram
Posted: Wed May 02, 2007 10:44 am
by CWO
Gotta make sure to check the objtype of the targeted item too... the script as is right now will allow you to rename any item at all as long as its in the backpack.
Posted: Wed May 02, 2007 12:37 pm
by Crustspikes
Yeah, thanks; i've been working on it and i was able to add objtype checking succesfully

Posted: Thu May 03, 2007 12:28 am
by Yukiko
I would have coded it but wasn't sure what objtype numbers they might be using. I had intended to mention that warning too but forgot to. Thanks CWO.