Need some help with a really really basic script

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Crustspikes
New User
Posts: 3
Joined: Tue May 01, 2007 6:30 pm

Need some help with a really really basic script

Post by Crustspikes »

:oops:

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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
Crustspikes
New User
Posts: 3
Joined: Tue May 01, 2007 6:30 pm

Post by Crustspikes »

Yeah, thanks; i've been working on it and i was able to add objtype checking succesfully :grin:
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Post Reply