It is currently Wed Dec 03, 2008 4:01 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 18 posts ] 
Author Message
 Post subject: [Solved]Creating "text" commands?
PostPosted: Sun Apr 16, 2006 11:03 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Solved..


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

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 3:07 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1223
Location: Southern Central USA
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.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 3:34 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 5:02 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 5:15 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 10:49 pm 
Offline

Joined: Mon Feb 06, 2006 6:12 am
Posts: 93
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 4:52 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 8:38 am 
Offline

Joined: Mon Feb 06, 2006 6:12 am
Posts: 93
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 :) 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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 1:16 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 6:07 pm 
Offline

Joined: Mon Feb 06, 2006 6:12 am
Posts: 93
to answer that... yes
Code:
TargetCoordinates( who );


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 6:09 pm 
Offline

Joined: Mon Feb 06, 2006 6:12 am
Posts: 93
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 7:07 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 9:20 pm 
Offline

Joined: Mon Feb 06, 2006 6:12 am
Posts: 93
give the compile error and i can help


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 10:27 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1223
Location: Southern Central USA
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.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 18, 2006 1:12 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
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 1:43 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 18, 2006 1:15 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1223
Location: Southern Central USA
Please post the compiler error that is displayed.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 18, 2006 2:32 pm 
Offline
Certified POL Expert
User avatar

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 798
Location: Chicago, IL USA
junkitem := CreateItemAtLocation( what.x, what.y, what.z, 0x709s, 1 )

0x709s is invalid... maybe mean 0x709a? also put a ; at the end of that line.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 18, 2006 5:34 pm 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 147
Location: Illinois, USA
This is the dot command I use on my shard. It creates a "hand" at the targetted location.

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


This compiles in 95 and works very well. Hope it helps you out.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl