PenUltima Online

It is currently Sat Sep 06, 2008 7:32 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 18 posts ] 
Author Message
 Post subject:
PostPosted: Wed Jul 16, 2008 12:15 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 317
Location: Myrtle Beach, South Carolina
Please do not just copy and paste. Go over it, see how it works and learn from it, like all of us are continuously doing =)

The Gumps package can be found in the 097 distro. I haven't found any bugs, so if you find any please do tell.

Bank check's;
Code:
use uo;

include ":Gumps:Include/yesno";

program Check(mobile, check)

   if ( !ReserveItem(check) )
      SendSysMessage(mobile, "That item is already being used.");
      return 0;
   endif

   if ( check.Container != mobile.Backpack )
      SendSysMessage(mobile, "That item must be in your backpack.");
      return 0;
   endif

   var check_amount := CInt(GetObjProperty(check, "CheckAmount"));

   if ( !check_amount )
      SendSysMessage(mobile, "This is a blank check.");
      SetName(check, "Blank Check");
      return 0;
   else
      if ( YesNo(mobile, "Are you sure you want to cash this "+(check_amount)+"gp check now?") )
         var result := CreateGoldInContainer(mobile.Backpack, check_amount);
         if ( result )
            SendSysMessage(mobile, "Your backpack is too full!");
            SendSysMessage(mobile, "Any remaining gold will be left on the check.");
            SetObjProperty(check, "CheckAmount", result);
            SetName(check, "Check for "+(result)+" Gold");
            return 0;
         elseif ( result == 0 )
            SendSysMessage(mobile, "Your check has been cashed.");
            SubtractAmount(check, 1);
            return 1;
         else
            SendSysMessage(mobile, "Seriously...");
            return 0;
         endif
      else
         SendSysMessage(mobile, "Aborted.");
         return 0;
      endif
   endif

   return 0;

endprogram

function CreateGoldInContainer(container, amount)

   if ( container )
      var current_amount := amount;
      var stacks := (amount / 60000);
      var recieved;
      for ( recieved := 1; recieved <= stacks; recieved += 1 )
         if ( CreateItemInContainer(container, 0x0EED, 60000) )
            current_amount -= 60000;
         else
            return (current_amount);
         endif
         SleepMS(2);
      endfor
      var left_over_amount := (amount - (stacks * 60000));
      if ( !CreateItemInContainer(container, 0x0EED, left_over_amount) )
         return (left_over_amount);
      else
         return 0;
      endif
   else
      return (-1);
   endif

endfunction


Withdraw function for bankers;
Code:
function WithdrawGoldFromBank(bank_box, backpack, amount)

   var current_amount := amount;
   var stacks := (amount / 60000);
   var recieved;
   for (recieved := 1; recieved <= stacks; recieved := recieved + 1 )
      if ( ConsumeSubstance(bank_box, 0x0EED, 60000) )
         if ( CreateItemInContainer(backpack, 0x0EED, 60000) )
            current_amount -= 60000;
         else
            return (current_amount);
         endif
      endif
      SleepMS(2);
   endfor

   var left_over_amount := (amount - (stacks * 60000));

   if ( ConsumeSubstance(bank_box, 0x0EED, left_over_amount) )
      if ( !CreateItemInContainer(backpack, 0x0EED, left_over_amount) )
         return (left_over_amount);
      endif
   endif

   return 0; // Successfully withdrew the gold.

endfunction


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 16, 2008 7:14 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Well, I looked over those and after the numerous errors fixed in ecompile, it doesn't work.

So, for future reference again(yes, I said this before) I'm on 96, not 97. Thanks.

If someone could simply show me how to write a PROPER property, with both GET and SET, that would be nice because I have a feeling that is where my problem lies.


MontuZ, thanks for trying to help but I would rather write a crappy script that is my own then use a good one that someone wrote for me :)

Any I probably sound rude right now, I'm not trying to be.

And again, 096.

_________________
Bittiez/Syp/Taz


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 16, 2008 1:40 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 317
Location: Myrtle Beach, South Carolina
http://docs.polserver.com/pol096/escriptguide.html

Search for CProp


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