Hello Joram,
This .setprop compiles just as easily under POL096, 097, 098
Copy the code below and paste it into a text editor and save it (as
setprop.src) into your commands directory you want to access (GM, Admin, Seer whichever one). Compile it and enjoy. Just remember that this will only allow you to set read/write props.
There are props which are readonly, for example,
mobile.acctl, the prop "
.acct" is readonly, you cannot modify that on the fly. There is a whole list of props to be found in the excellent eScript documentation, I urge you to go through the introduction to eScript as well, probably a good idea as a first-stop.
Let me know if you want a .setobjproperty script.
By the way, if you get involved with the conversion of scripts from one version of POL to another, your guide and Bible is the "
changelog.txt" you will find in the root directory of each POL server release.
Code: Select all
use uo;
use basic;
use os;
program textcmd_setprop( who, text )
var parms := SplitWords( text );
if( !len(parms) )
SendSysMessage( who , "Structure is : .setprop <prop_name> <prop_val>" );
return;
endif
var prop_name := parms[1];
var prop_val := parms[2];
if( !prop_name or (!prop_val and prop_val != 0))
SendSysMessage( who , "Structure is : .setprop <prop_name> <prop_val>" );
return;
endif
if ( CDbl(prop_val) or prop_val == 0 )
prop_val := CDbl(prop_val);
if ( CDbl(prop_val) == CInt(prop_val))
prop_val := CInt( prop_val );
endif
else
if (CInt(prop_val))
prop_val := CInt( prop_val );
else
prop_val := Cstr( text - (prop_name + " ") );
endif
endif
if( !prop_val or prop_val == 9999 )
prop_val := 0;
endif
SendSysMessage( who, "Select an object to set "+prop_name+" property on" );
var obj := Target( who );
if( obj )
var value;
var newvalue;
value := obj.get_member(prop_name);
case (prop_name)
"objtype":
"graphic":
"serial":
"color":
"truecolor":
"trueobjtype":
SendSysmessage( who , prop_name + " was: " + hex(value) ); break;
default:
SendSysmessage( who , prop_name + " was: " + value ); break;
endcase
var ismove := 0;
var x := obj.x;
var y := obj.y;
var z := obj.z;
case (prop_name)
"x": x := prop_val;
ismove := 1;
break;
"y": y := prop_val;
ismove := 1;
break;
"z": z := prop_val;
ismove := 1;
break;
endcase
var ret := 0;
if (ismove)
if (obj.IsA(POLCLASS_MOBILE))
MoveObjectToLocation( obj, x, y, z, obj.realm, 0 );
else
MoveObjectToLocation( obj, x, y, z, obj.realm, MOVEOBJECT_FORCELOCATION );
endif
ret := 1;
else
ret := obj.set_member(prop_name, prop_val);
endif
if (ret)
newvalue := obj.get_member(prop_name);
case (prop_name)
"objtype":
"graphic":
"serial":
"color":
"truecolor":
"trueobjtype":
newvalue := hex(newvalue);
endcase
if( newvalue == value )
SendSysmessage( who , "Property unchanged." );
elseif(newvalue)
SendSysmessage( who , prop_name + " now: " + newvalue );
else
SendSysmessage( who , "Error occured." );
endif
else
SendSysmessage( who , "Could not write to " + prop_name + "." );
endif
else
SendSysMessage(who, "Cancelled.");
endif
endprogram
Regards,
Justae