Page 1 of 1

neep help

Posted: Wed Aug 13, 2008 8:10 pm
by Elric
I am trying to make multi-part deeded pianos to play music when d-clicked. I have some knowledge in pol scripting but have yet to write a full script from scratch. Any help to a good base start would be helpful.

We are running .095 on client 4.03d. Thanks

Posted: Wed Aug 13, 2008 11:48 pm
by Justae
Hello Elric,

You would of course ideally first need to define each piano piece in one of your itemdesc.cfg files. Take for example these two entries from an example itemdesc.cfg file in a package named 'music'.

Please check your OBJTYPES.TXT file in the root of your POL directory. Be sure that the item numbers you use are not already allocated by some other item in another itemdesc.cfg file. Ideally, look for numbers to use above the 0x4000 range.

Code: Select all

item 0x6100
{
	Name		pianokeys
	Desc		Piano Keys
	Graphic		0x50d
	Color		0x498
	Script		:music:playpiano
}

item 0x6101
{
	Name		pianotop
	Desc		a piano
	Graphic		0x50d
	Color		0x1
	Script		:music:playpiano
}

item 0x6102
{
	Name		pianoleg
	Desc		a piano leg
	Graphic		0x50c
	Color		0x1
	Script		:music:playpiano
}

Notice the 'Script' entry for each chess tile. They use the same program, 'playpiano' in the 'music' directory. In your case, you would put in the name of the directory and the name of the Script which plays music when any of the defined piano pieces are double-clicked. I have simply used arb. graphic and color numbers in the example itemdesc.cfg


Your 'playpiano.src' might start off like this :
(Obviously oversimplified!)

Code: Select all

use uo;
use os;

include "include/random";

program use_piano(who, piano)
	
	var pianosounds := { 1286, 1287, 1288 };
	PlaySoundEffect(piano, pianosounds[RandomInt(3)+1]);
	Sleepms(200);
	
endprogram


That's all an example, you would need to do your own thing in terms of the code, of course.

Hope that helps some.

Regards
Justae.

Posted: Thu Aug 14, 2008 11:01 am
by westrupp
Image

I have only this screenshot, can see to be have idea how are pianos, dont have the scripts, sorry...

Posted: Thu Aug 14, 2008 11:10 am
by Austin
Look at the 097 distro for pkg\utils\itemUtils\commands\seer\makeSet.src and there is a sets.cfg in that package's config folder.

It will give you an example of how to set a midpoint (where the cursor is clicked) and create items relative to where that is.

That should get you started towards what you want.



This other solution is to make the items into a multi - but requires a lot more work and a custom multi file for the client side.

Posted: Thu Aug 14, 2008 12:23 pm
by westrupp

Posted: Thu Aug 14, 2008 2:52 pm
by Elric
I thank you all for you quick replies. This is great help to get me started in the right direction.

Re: neep help

Posted: Sat Aug 23, 2008 4:02 am
by Yukiko
I assume you already have the script that places the piano parts. If not it is in the WoD scripts which can be downloaded from http://www.hopelives.us/Files/wod95.zip. Next step you need to do is set the use script member on each piano part or if you want to be accurate on the checkerboard (used for the keyboard) part to run your music player script. You'll want to do this at item creation inside the placedeed.src script because that script uses common items to build the piano. In your music player script you can use the PlayMidiMusic function which I believe exists in the packets.inc file to play the music. Keep in mind that UO no longer plays midis but rather plays the digital MP3 music.

You'll find the placedeed.src file in the \wodroot\pkg\items\decorations folder. I hope this is helpful to you.

Sorry I can't be more detailed but it's late, I am trying to read through as many posts as possible and I am tired.

*grins*

If you have any trouble just post your problem here and we'll try to help.