[Solved]Creating "text" commands?
[Solved]Creating "text" commands?
Solved..
Last edited by Poi on Wed Apr 19, 2006 4:42 am, edited 2 times in total.
Under POL 95 the general textcommands (those not specific to a particular package) are located in \pol\scripts\textcmd
If you look in there you will see the various directories "player", "coun"...etc that the commands are located in. So you would place the script in the appropriate directory depending on what command level you wish to have access to your script. Note that the access is progressive. In other words, players may only access scripts in the player directory, councillors those in both the player and coun directories, seers those in the seer, coun and player directory and so on.
Look at some of those for examples of how to write commands if you need to.
POL 96 handles commands as a package it seems.
If you look in there you will see the various directories "player", "coun"...etc that the commands are located in. So you would place the script in the appropriate directory depending on what command level you wish to have access to your script. Note that the access is progressive. In other words, players may only access scripts in the player directory, councillors those in both the player and coun directories, seers those in the seer, coun and player directory and so on.
Look at some of those for examples of how to write commands if you need to.
POL 96 handles commands as a package it seems.
Exactly how do you recomple a script, i ecompiled, restarted the server
Haha nevermind i got it, i just cant the the script to print the text :/
My point.src(new script:
Haha nevermind i got it, i just cant the the script to print the text :/
My point.src(new script:
Code: Select all
use os;
use uo;
program textcmd_point( who, text )
var what := Target( who );
if (what)
PrintTextAbove( what, "*", who.name,"points here*" );
PrintTextAbove( who, "*", who.name, "points at that spot*" );
endif
endprogramoh right i see the problem...
REF: UO.EM
youve used printtextabove but with the printtextaboveprivate params
change it to say
you may also want to add spaces between the beginning of the second text and the word points so rather than saying *joepoints here* it will say *joe points here*...
p.s. + are used to attach to trings not , so thats why you were having trouble
REF: UO.EM
Code: Select all
PrintTextAbove( above_object, text, font := _DEFAULT_TEXT_FONT, color := _DEFAULT_TEXT_COLOR );
PrintTextAbovePrivate( above_object, text, character, font := _DEFAULT_TEXT_FONT, color := _DEFAULT_TEXT_COLOR );Code: Select all
PrintTextAbove( what, "*"+who.name+"points here*" );
PrintTextAbove( who, "*"+ who.name+ "points at that spot*" ); p.s. + are used to attach to trings not , so thats why you were having trouble
Thanks your the best!
Just wondering though, it works, but you can only point at actual items or players, is there a way to make(i know there is) it so you can point anywhere?
Heres my new code, it will not ecompile, is there an error?
Just wondering though, it works, but you can only point at actual items or players, is there a way to make(i know there is) it so you can point anywhere?
Heres my new code, it will not ecompile, is there an error?
Code: Select all
use os;
use uo;
program textcmd_point( who )
var what := Target( who );
if (what)
PrintTextAbove( what, "*"+who.name+" points here*", font := _DEFAULT_TEXT_FONT, color := 0x33 );
PrintTextAbove( who, "*"+who.name+ " points at "+what.name+"*", font := _DEFAULT_TEXT_FONT, color := 0x33 );
PerformAction( who, ACTION_SALUTE );
endif
endprogramto answer that... yes
Code: Select all
TargetCoordinates( who );im guessing just by looking at it, it will be saying something about the variable font not existing... rather than
just have a simple
and that should work for you 
Code: Select all
font := _DEFAULT_TEXT_FONT, color := 0x33Code: Select all
PrintTextAbove( what, "*"+who.name+" points here*", _DEFAULT_TEXT_FONT, 0x33 );It still does not ecompile
Code: Select all
use os;
use uo;
program textcmd_point( who )
var what := TargetCoordinates( who );
if (what)
PrintTextAbove( what, "*"+who.name+" points here*", _DEFAULT_TEXT_FONT, 0x33 );
PrintTextAbove( who, "*"+who.name+ " points at "+what.name+"*", _DEFAULT_TEXT_FONT, 0x33 );
PerformAction( who, SALUTE );
endif
endprogramPrintTextAbove is looking for an object reference and your "what" is a structure containing coordinates. So first create something invisible at the targetted coordinates using something like this:
Please note I don't know any invisible objtype to insert in that createitem function call so maybe someone else can suggest something. Perhaps a rescob would do.
Code: Select all
use os;
use uo;
program textcmd_point( who )
var what := TargetCoordinates( who );
if (what)
junkitemm := CreateItemAtLocation( what.x, what.y, what.z, <objtype of an invisible item>, 1 )
PrintTextAbove( junkitem, "*"+who.name+" points here*", _DEFAULT_TEXT_FONT, 0x33 );
DestroyItem(junkitem);
PrintTextAbove( who, "*"+who.name+ " points at "+what.name+"*", _DEFAULT_TEXT_FONT, 0x33 );
PerformAction( who, SALUTE );
endif
endprogram
Ok i did that, created (my own) invisible object, and placed the code in there, it still doesn ecompile
Error:
Error compiling statement at E:\pol\scripts\point.src, Line 8
Error in IF statement starting at File: E:\pol\scripts\point.src, Line 7
Error compiling statement at E:\pol\scripts\point.src, Line 7
Error detected in program body.
Error occurred at E:\pol\scripts\point.src, Line 8
Execution aborted due to: Error compiling file
Scipt:
Error:
Error compiling statement at E:\pol\scripts\point.src, Line 8
Error in IF statement starting at File: E:\pol\scripts\point.src, Line 7
Error compiling statement at E:\pol\scripts\point.src, Line 7
Error detected in program body.
Error occurred at E:\pol\scripts\point.src, Line 8
Execution aborted due to: Error compiling file
Scipt:
Code: Select all
use os;
use uo;
program textcmd_point( who )
var what := TargetCoordinates( who );
if (what)
junkitem := CreateItemAtLocation( what.x, what.y, what.z, 0x709s, 1 )
PrintTextAbove( junkitem, "*"+who.name+" points here*", _DEFAULT_TEXT_FONT, 0x33 );
DestroyItem(junkitem);
PrintTextAbove( who, "*"+who.name+ " points at "+what.name+"*", _DEFAULT_TEXT_FONT, 0x33 );
PerformAction( who, SALUTE );
endif
endprogram
Last edited by Poi on Tue Apr 18, 2006 1:43 pm, edited 1 time in total.
This is the dot command I use on my shard. It creates a "hand" at the targetted location.
This compiles in 95 and works very well. Hope it helps you out.
Code: Select all
use uo;
use os;
// These should be in your client.inc file. If not you can add them there and use the include "client"; call instead.
const FONT_NORMAL := 0x03; // Normal (default).
const ANIM_SALUTE := 0x0021; // Salute.
program point (who)
SendSysMessage( who, "Point at what?" );
var it := TargetCoordinates ( who );
var itdesc;
if ( it.item.name )
itdesc := it.item.name;
it := it.item;
elseif ( it.item.desc )
itdesc := it.item.desc;
it := it.item;
elseif ( it.mobile )
itdesc := it.mobile.name;
it := it.mobile;
else
it := CreateItemAtLocation( it.x, it.y, it.z, 0x706c, 1 );
it.name := who.name;
it.graphic := 0x206e;
it.movable := 0;
itdesc := "that spot";
SetObjProperty (it, "destroyme", 1);
endif
if ( it.hidden )
SendSysMessage( who, "Canceled" );
return;
endif
PerformAction ( who, ANIM_SALUTE );
PrintTextAbove ( who, "*points at " + itdesc + "*", FONT_NORMAL, 55);
sleepms (500);
PrintTextAbove ( it, "*" + who.name + " points here*", FONT_NORMAL, 55);
sleep (2);
if ( it.objtype == 0x706c )
if (GetObjProperty (it, "destroyme"))
DestroyItem( it );
endif
endif
endprogram