Page 1 of 1

Order/Honor Scripts

Posted: Thu Mar 09, 2006 12:26 am
by Mephisto
I'm using the sanctuary script files to begin with, and have fixed the common bugs thusfar, I'm still quite new to scripting, and am currently trying to create a dot comman for honor, such as the one for exp and virtue. Does anyone have any suggestions, I can't test anything I do at the moment, since my main computer with my test shard is out of service at the moment, But what I've tossed together in the last 10 mins is this....

Code: Select all

use uo;

include "../pkg/character/orders/orders";

program honor ( player, parms )

        var yourvirtue := abs ( GetVirtueAmount (you) );
	var yourhonor := GetObjProperty ( player, "honor" );

	if ( !yourhonor )
		yourhonor := {};
		yourhonor[1] := yourvirtue;
		yourhonor[2] := 0;
		yourhonor[3] := 0;

		SetObjProperty ( player, "honor[2]", 0 );
	endif

	SendSysMessage ( player, "You have " + CStr ( honor[2] ) + " honor." );
	
endprogram
Now I haven't finished thinking this script through, and i know as it stands right now, it won't work.... atleast I don't believe so, any tips, hints, etc...? Any help will be appreciated. Thanks

Posted: Thu Mar 09, 2006 7:07 am
by Mithril
You were actually quite close :)

Code: Select all

use uo; 

include "../pkg/character/orders/orders"; 

program honor ( player, parms ) 

        var yourvirtue := abs ( GetVirtueAmount (you) ); 
   var yourhonor := GetObjProperty ( player, "honor" ); 

   if ( !yourhonor ) 
      yourhonor := {}; 
      yourhonor[1] := yourvirtue; 
      yourhonor[2] := 0; 
      yourhonor[3] := 0; 

      SetObjProperty ( player, "honor", 0 ); 
   endif 

   SendSysMessage ( player, "You have " + CStr ( honor[2] ) + " honor." ); 
    
endprogram
That should do what you need I believe. Was just the seeting of the property to the array, not the 2nd element.

Posted: Thu Mar 09, 2006 7:47 am
by nevalon

Code: Select all

SetObjProperty ( player, "honor", yourhonor );
and:

Code: Select all

SendSysMessage ( player, "You have " + CStr ( yourhonor[2] ) + " honor." );

Posted: Thu Mar 09, 2006 8:06 am
by Mithril
Doh! I missed those other spots

*goes to find more coffee*

Posted: Thu Mar 09, 2006 8:21 am
by Mephisto
*smacks head*
:shock:

Can't believe I missed those heh. Thanks. Maybe I shouldn't try scripting at 2-3am again... hehe

Posted: Thu Mar 09, 2006 11:12 pm
by DevGIB
i dont think i script any other time :P

Posted: Fri Mar 10, 2006 1:02 am
by Mephisto
Well, I did get it functional for the most part. Thanks for everyone's help. Here is the code thusfar, I need to do some more tweaking to it...

Code: Select all

use uo;

include "../pkg/character/orders/orders";

program honor ( player, parms )

        var yourvirtue := GetObjProperty (player, "virtue" );
	var yourhonor := GetObjProperty ( player, "honor" );

	if ( !yourhonor )
		yourhonor := {};
		yourhonor[1] := yourvirtue;
		yourhonor[2] := 0;
		yourhonor[3] := 0;

		SetObjProperty ( player, "honor", yourhonor );
	endif

	SendSysMessage ( player, "You have " + CStr ( yourhonor[2] ) + " honor." );
	
endprogram
What it is doing, is if I use my GM chars to add honor to anyone, which is the only way I've tested it thusfar... When you use the command .honor it shows how much honor the character has, plus what it was given...

So If I give a character 3000 honor points, then give them another 500, what appears on screen is... "You have 3000 , 500 honor" and so forth... Any suggestions? I'm assuming I have my array a bit scewed perhaps? Maybe it's honor3 that is the total honor... and 2 is the amount that has been given. I'll have to run through my order scripts again to be certain... Thanks again!

Posted: Fri Mar 10, 2006 2:05 am
by XtehseA
mephisto whats your msn or email i wish to talk to you.

Posted: Fri Mar 10, 2006 6:06 am
by Mephisto
Can MSN me at skyhawc@hotmail.com