PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
[Solved]Creating "text" commands?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095)
Display posts from previous:   

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Sun Apr 16, 2006 3:03 pm    Post subject: [Solved]Creating "text" commands? Reply with quote

Solved..

Last edited by Poi on Wed Apr 19, 2006 8:42 am; edited 2 times in total

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1094
Location: Southern Central USA

PostPosted: Sun Apr 16, 2006 7:07 pm    Post subject: Reply with quote

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.

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Sun Apr 16, 2006 7:34 pm    Post subject: Reply with quote

Well i sort of figured out that much myself, but cannot find a cmd that simply displays text at a targeted area.


Also, i made a sciprt that looks like it should work, but, when i type the .<cmd> it doesnt do anything after i restarted pol

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Sun Apr 16, 2006 9:02 pm    Post subject: Reply with quote

You have to recompile the script. When you've compiled it, there will be a .ecl file with the same name as your script in that directory.

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Sun Apr 16, 2006 9:15 pm    Post subject: Reply with quote

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:

Code:
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
endprogram

Author Message
DevGIB



Joined: 06 Feb 2006
Posts: 93

PostPosted: Mon Apr 17, 2006 2:49 am    Post subject: Reply with quote

what does it do when you type in your command? does it say that the command is unknown or does it just do nothing... also give a directory string of where you have put this file

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Mon Apr 17, 2006 8:52 am    Post subject: Reply with quote

Pol/scripts/textcmd/player and it brings up a target, i select something and it doesnt do anything, and i think i have it wrong.. the second printtext should be above the player..

Author Message
DevGIB



Joined: 06 Feb 2006
Posts: 93

PostPosted: Mon Apr 17, 2006 12:38 pm    Post subject: Reply with quote

oh right i see the problem...

REF: UO.EM
Code:

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 );


youve used printtextabove but with the printtextaboveprivate params Smile change it to say

Code:

PrintTextAbove( what, "*"+who.name+"points here*" );
PrintTextAbove( who, "*"+ who.name+ "points at that spot*" );

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

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Mon Apr 17, 2006 5:16 pm    Post subject: Reply with quote

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?


Code:
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
endprogram

Author Message
DevGIB



Joined: 06 Feb 2006
Posts: 93

PostPosted: Mon Apr 17, 2006 10:07 pm    Post subject: Reply with quote

to answer that... yes
Code:
TargetCoordinates( who );

Author Message
DevGIB



Joined: 06 Feb 2006
Posts: 93

PostPosted: Mon Apr 17, 2006 10:09 pm    Post subject: Reply with quote

im guessing just by looking at it, it will be saying something about the variable font not existing... rather than
Code:
font := _DEFAULT_TEXT_FONT, color := 0x33


just have a simple
Code:
PrintTextAbove( what, "*"+who.name+" points here*", _DEFAULT_TEXT_FONT, 0x33 );


and that should work for you Smile

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Mon Apr 17, 2006 11:07 pm    Post subject: Reply with quote

It still does not ecompile

Code:
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
endprogram

Author Message
DevGIB



Joined: 06 Feb 2006
Posts: 93

PostPosted: Tue Apr 18, 2006 1:20 am    Post subject: Reply with quote

give the compile error and i can help

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1094
Location: Southern Central USA

PostPosted: Tue Apr 18, 2006 2:27 am    Post subject: Reply with quote

PrintTextAbove 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:

Code:

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


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.

Author Message
Poi



Joined: 14 Apr 2006
Posts: 240

PostPosted: Tue Apr 18, 2006 5:12 pm    Post subject: Reply with quote

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:

Code:
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 5:43 pm; edited 1 time in total

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095) All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty