PenUltima Online

It is currently Tue Oct 07, 2008 7:22 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Request: simple script example
PostPosted: Fri Aug 11, 2006 4:50 am 
Offline

Joined: Thu Jul 13, 2006 10:44 pm
Posts: 4
Greetings!

Could it be possible to get a simple script example?
Im sure that many new scripters are in need of this.

How to do this?

By doubleclicking item A it asks for item B.
If item B is valid => Destroys item A and B => Creates item C in backpack.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 11, 2006 6:40 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 419
Location: San Diego, California
Item A needs a use script set in its itemdesc.cfg.

An example of that script..

Code:
use uo;

CONST B_OBJTYPE := 0x1234;
CONST C_OBJTYPE := 0xABCD;

program UseScript(mobile, item_a)
     SendSysMessage(mobile, "Target item B");
     var item_b := Target(mobile);
     if ( item_b.objtype != B_OBJTYPE )
          SendSysMessage(mobile, "Cancelled.");
          return 0;
     endif

     var item_c := CreateItemInBackPack(mobile, C_OBJTYPE, 1);
     if ( item_c.errortext )
          SendSysMessage(mobile, "Unable to create item_c ->"+item_c.errortext);
          return 0;
     endif
     
     DestroyItem(item_a);
     DestroyItem(item_b);

     return 1;
endprogram


_________________
-Austin


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] 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