Page 1 of 2
need alittle help please
Posted: Thu Jan 11, 2007 1:23 am
by Damo307
im trying to make a chromo robe and it wont compile for me :(
-------------------------------------------------------------------------------
use util;
program equip(who, robe)
var validcolors := { 1, 2, 10, 20, 30, 40, 60, 80 }; //Put all valid colors here separated by commas.
var rint := RandomInt(validcolors.size())+1;
var color := validcolors[rint];
robe.color := color;
return 1;
endprogram
-------------------------------------------------------------------------------
Armor 0xff03
{
Name Chromo Robe
Desc chromo robe
Graphic 0x1f03
AR 4
Color 1933
Coverage Body
Coverage Legs/feet
Coverage Arms
VendorSellsFor 68
VendorBuysFor 34
maxhp 20
equipscript equip
}
-------------------------------------------------------------------------------
thats all i got so far
Posted: Thu Jan 11, 2007 1:28 am
by MontuZ
It compiles fine for me. You will want to check your ecompile.cfg and make sure all the correct paths are set.
Posted: Thu Jan 11, 2007 1:33 am
by Damo307
##
## ecompile.cfg: must be in the same directory as ecompile.exe
##
#
# ModuleDirectory: Location of *.em files
#
ModuleDirectory D:\POL\scripts
#
# IncludeDirectory: Location of *.inc files, if not found relative
# or with a specified package
#
IncludeDirectory D:\POL\scripts
#
# PolScriptRoot: Location of "::file" includes
#
PolScriptRoot D:\POL\scripts
#
# PackageRoot: root directories where packages are stored
# This can be specified multiple times.
#
PackageRoot D:\POL\pkg
PackageRoot c:\pol\devpkg
#
# Default ecompile options
#
GenerateListing 1
GenerateDebugInfo 1
GenerateDebugTextInfo 0
DisplayWarnings 1
CompileAspPages 1
AutoCompileByDefault 1
UpdateOnlyOnAutoCompile 1
OnlyCompileUpdatedScripts 1
DisplaySummary 1
GenerateDependencyInfo 1
DisplayUpToDateScripts 0
------------------------------------------------------------
thats what mine says, i dunno how to check it
Posted: Thu Jan 11, 2007 1:55 am
by SMJ
It's all pretty self explanatory. Have you read the comments? If so, is D:\POL\scripts really the location of all the *.em files? Same goes for the rest of the items.
Posted: Thu Jan 11, 2007 1:58 am
by Damo307
got it to work, but now when i goto to do .create chromo robe , nothing happens
------------------------------------------------------------
Armor 0xff03
{
Name Chromo Robe
Graphic 0x1f03
AR 4
Coverage Body
Coverage Legs/feet
Coverage Arms
VendorSellsFor 68
VendorBuysFor 34
maxhp 20
equipscript equip
}
------------------------------------------------------------
thats my item.cfg file
also with my world chat im trying to put a timer on long till people can use it again but i always get an error where every i put 'sleep(120);'
--------------------------------------------------------------
use uo;
program textcmd_wc( who, text )
var ppl := EnumerateOnlineCharacters();
foreach x in ppl
if (x.cmdlevel > 0)
SendSysMessage(x, "World Chat From " + who.name + ": " + text, 3, 67);
endif
sleep(120);
endforeach
endprogram
Posted: Thu Jan 11, 2007 2:07 am
by Yukiko
I think the space between chromo and robe in the name is the problem. try making the following change to the itemdesc file.
Code: Select all
Armor 0xff03
{
Name chromorobe
Desc Chromo Robe
Graphic 0x1f03
AR 4
Coverage Body
Coverage Legs/feet
Coverage Arms
VendorSellsFor 68
VendorBuysFor 34
maxhp 20
equipscript equip
}
Try .create chromorobe after making the change.
See if that works.
Posted: Thu Jan 11, 2007 2:22 am
by Damo307
that didnt work either
would it be ok if i asked if someone could make the whole robe for? or cant i do that
Posted: Thu Jan 11, 2007 2:54 am
by MontuZ
Is the package that the itemdesc.cfg located in enabled?
Posted: Thu Jan 11, 2007 3:00 am
by Damo307
sorry but im not sure how to tell
Posted: Thu Jan 11, 2007 3:11 am
by MontuZ
well, if you're using the itemdesc.cfg in C:\POL\CONFIG\
then there is no package and there's another problem.
if it's in something like C:\POL\PKG\PackageName\
then in there there should be a file named pkg.cfg
open it and see if enabled is set to 1 if not, then change it to 1 and run pol and try again.
Posted: Thu Jan 11, 2007 3:15 am
by SMJ
Try using ".create 0xff03" instead, and see if that works. If not, then it's probably something in your packages. If your package is enabled, I've had problems putting core cfg files in the "/config" directory inside a package. Try moving it to the same level as "pkg.cfg" and use the command.
As for the text command:
Code: Select all
program textcmd_wc( who, text )
var ppl := EnumerateOnlineCharacters();
foreach x in ppl
if (x.cmdlevel > 0)
SendSysMessage(x, "World Chat From " + who.name + ": " + text, 3, 67);
endif
sleep(120);
endforeach
endprogram
I wouldn't put a sleep in the command itself. I would make it a reference variable; and all the sleep does at the moment is put a delay of 120 seconds in between when it sends a message to each character.
Code: Select all
use uo;
const CHAT_DELAY = 10;
const CHAT_COLOR = 67;
const MIN_CMD_LEVEL = 1;
/* This is a temporary variable to make sure it's not saved
on shut-down, interfering with chat ability on server restart. */
const OBJPROP_CHATDELAY = "#lastchat";
program textcmd_wc(who,text)
// Check the delay.
if( GetObjProperty(who,OBJPROP_CHATDELAY) > ReadGameClock() )
SendSysMessage(who,"You must wait "+CHAT_DELAY+" seconds before using this command." );
return 0;
endif
// Do they have anything to say?
if(!text)
SendSysMessage(who,"Proper usage is: .wc *chat text*");
return 0;
endif
// List all the online characters.
foreach character in EnumerateOnlineCharacters()
// Make sure the character has the appropriate commandlevel.
if( character.cmdlevel >= MIN_CMD_LEVEL )
// Send the message to the character.
SendSysMessage(character, "World Chat From "+character.name+": "+text,_DEFAULT_TEXT_FONT,CHAT_COLOR);
endif
endforeach
// Set the object property to the character.
SetObjProperty(character,OBJPROP_CHATDELAY,ReadGameClock()+CHAT_DELAY);
endprogram
I know it has a lot of constants, but it's the same concept as include files: easy to update or expand several things easily.
Posted: Thu Jan 11, 2007 3:36 am
by Damo307
yep that worked thanxs
just need alittle help with my .wc script, i wont to make it so poeple have to wait 120s before they can use it again
----------------------------------------------------
use uo;
program textcmd_wc( who, text )
var ppl := EnumerateOnlineCharacters();
foreach x in ppl
if (x.cmdlevel > 0)
SendSysMessage(x, "World Chat From " + who.name + ": " + text, 3, 67);
endif
sleep(120);
endforeach
endprogram
Posted: Thu Jan 11, 2007 3:45 am
by SMJ
Have you tried my suggestion yet?
Posted: Thu Jan 11, 2007 3:48 am
by Damo307
oh sorry never seen it there :O
Posted: Thu Jan 11, 2007 4:18 am
by Damo307
umm.. how would i make a chromo tile? i can get the tile but i dunno how to do the .src file
Posted: Thu Jan 11, 2007 4:45 am
by SMJ
What is a chromo tile?
Posted: Thu Jan 11, 2007 4:47 am
by Damo307
just like a chromo robe, but instead of equipit, you walk on it to make it change colours
Posted: Thu Jan 11, 2007 5:20 am
by SMJ
Okay, so quick walkthrough:
The first thing you're going to want to do is open the equipscript for reference.
Code: Select all
use util;
program equip(who, robe)
/** All valid colors here separated by commas. */
var validcolors := { 1, 2, 10, 20, 30, 40, 60, 80 };
var rint := RandomInt(validcolors.size())+1;
var color := validcolors[rint];
robe.color := color;
return 1;
endprogram
The tile will, of course, need the same headers as the equip script.
The next thing you'll want to do is see the basic structure of a "walkon" script. I looked into the scripts folder, and arbitrarily pulled up a script with the name "walkon" in it. I want the parameters, so I copy them to the new script:
Code: Select all
use util;
program walkon_ChromoTile(who, tile)
Then, it's basically a copy-paste of the code that you want to use.
Code: Select all
use util;
program walkon_ChromoTile(who, tile)
/** All valid colors here separated by commas. */
var validcolors := { 1, 2, 10, 20, 30, 40, 60, 80 };
var rint := RandomInt(validcolors.size())+1;
var color := validcolors[rint];
robe.color := color;
return 1;
endprogram
But wait! The script won't compile yet. Since we've done a copy-paste, the code isn't completely consistent with what we want. The script tries to reference a variable named "robe". Because this variable is named by the second parameter of our source script, and is supposed to reference the object passed as the second parameter of the destination script, the change is as simple as a name. So from here, we search the script for all references to "robe" and change it to "tile".
Code: Select all
use util;
program walkon_ChromoTile(who, tile)
/** All valid colors here separated by commas. */
var validcolors := { 1, 2, 10, 20, 30, 40, 60, 80 };
var rint := RandomInt(validcolors.size())+1;
var color := validcolors[rint];
tile.color := color;
return 1;
endprogram
You now have a functional walkon script, that performs the same action to a tile, as the equipscript does to the robe.
Posted: Thu Jan 11, 2007 5:34 am
by Damo307
thank you heaps, but i think i might of stuffed up on the itemdesc.cfg
------------------------------------------------------------
Item 0xff05
{
Name chromotile
Desc Chromo Tile
WalkOnScript ChangeColorTile
graphic 6173
color 1197
script WalkOnScript
movable 1
}
Posted: Thu Jan 11, 2007 5:52 am
by SMJ
Code: Select all
Item 0xff05
{
Name chromotile
Desc Chromo Tile
WalkOnScript ChangeColorTile
Graphic 6173
Color 1197
Script WalkOnScript
Movable 1
}
First thing to do is reference to
The CFG Documentation for Itemdesc.cfg.
The "Script" property refers to the double-click script. The "WalkOnScript" is a script that fires when you walk across the object.
It looks to me like you trued to reference "Script" to the value "WalkOnScript". Is this bad? No. It just means that you'll get an errorlog on the server every time someone doubleclicks the object, saying that there isn't a script named 'WalkOnScript'. You can probably get away with simply deleting that from the file altogether.
A good bit of advice: always include the package name in your itemdesc script references. This way, you're removing any kind of obscurity.
So, for "WalkOnScript", set the value to ":"+Package Name+":ChangeColorTile"
And for the script I posted, name it "ChangeColorTile.src". Compile it, and fire up your server to test it.
Posted: Thu Jan 11, 2007 6:12 am
by Damo307
arrgghh.. this keeps stuffing up, maybe if i post what i have you can tell me if i had put an error somewhere
.src file:
---------------
use util;
program walkon_ChromoTile(who, tile)
/** All valid colors here separated by commas. */
var validcolors := { 1191, 52, 1936, 1939, 1909, 1192, 60, 1193, 1967, 62, 30, 1194, 1187, 1192, 1966, 1975, 1186 };
var rint := RandomInt(validcolors.size())+1;
var color := validcolors[rint];
tile.color := color;
return 1;
endprogram
------------------------------------------------------------
.cfg file:
---------------
Item 0xff05
{
Name chromotile
Desc Chromo Tile
WalkOnScript ChromorTile:ChangeColorTile
graphic 6173
color 1197
script WalkOnScript
movable 1
}
------------------------------------------------------------
Posted: Thu Jan 11, 2007 6:20 am
by SMJ
Chante
WalkOnScript ChromorTile:ChangeColorTile
To
WalkOnScript :ChromorTile:ChangeColorTile
You need the ":" before the file package name to tell the server that you're looking for a package.
:Package:Script
Posted: Thu Jan 11, 2007 6:31 am
by Damo307
did what you said but didnt work still, are you able to make the .cfg for me? and i learn from that?
Posted: Thu Jan 11, 2007 6:37 am
by SMJ
Code: Select all
Item 0xff05
{
Name chromotile
Desc Chromo Tile
WalkOnScript :ChromorTile:ChangeColorTile
graphic 6173
color 1197
script WalkOnScript
movable 1
}
Other than that little bit, it looks fine to me. Is your package enabled? If not, enable it. Is ChangeColorTile.src in the package directory? If not, put it there. Is ChangeColorTile.src compiled? If not, compile it. Did you do all of this with the server online? If so, restart it.
Posted: Thu Jan 11, 2007 6:42 am
by Damo307
im using pol 95, would that have anything to do why it wont work?