PDA

View Full Version : How can I use scripts?



Imprisoned
12-14-2007, 12:31 PM
Yeah I found this script I need for my quest but I havent gotten to the scripting thing so any help?



//
// Display a message when you pick up an item.
//
//
item script YouGotTheThing {
void run(int m) {
Screen->Message(m);
}
}

Joe123
12-14-2007, 12:45 PM
Open notepad.
On the first line of a new document, put: import 'std.zh' ,then copy in that script afterwards. So it'll read:

import "std.zh"
item script YouGotTheThing{
void run(int m){
Screen->Message(m);
}
}

Then save the file, go to the folder where you saved it and rename it from '#.txt' to '#.z'.

Now, open ZQuest. Go to 'Tools->Scripts->Compile ZScript...'
Click 'Import', and find your #.z file.
Press 'Compile'.
Go to the 'item' tab, and your script should be on the right. Put it on the first slot, and press 'OK'
And that's how you add a script into ZQuest.

As for this specific script:
Go to the item editor, and the item that you want to attach the script to.
In the 'Pickup' tab, put '1' (or the number you assigned that script to) in the box.
In the 'Arguments' tab, put the number of the string you want to play when you pick up the item in the 'D0' box.

And that's about it :)

Imprisoned
12-15-2007, 07:54 AM
Thanks a lot, but I can't find the arguments tab (I'm using 626)

Joe123
12-15-2007, 09:57 AM
Ah, you'll either have to hard-code each script and use a different one for every item, or download a newer build then.

Imprisoned
12-15-2007, 10:05 AM
Yeah, I just noticed that too. There is no arguments tab in 626... I guess I'll try the NeoFirst build I have now... This is going to take loads of work... Thanks.

Joe123
12-15-2007, 10:07 AM
Well, there's nothing to stop you hard-coding the script and just having duplicates of it if you want to?
Just rename the script to what item you want it to be (well, it doesn't matter what you call it so long as they all have different names) and change the 'm' in 'Screen->Message(m);' to be the number of the string you want to play.

Bit of a hassle though.

idontknow
12-15-2007, 05:18 PM
Cool, this really helps me out too! And i do have the latest version of ZC so I can put in the arguments, which is such a time-saver. However, i noticed that the string does not go away until you leave the screen. What do i need to add to the script (or is there any other way) to make the string last only, say, 10 seconds and then it disappears?

Joe123
12-15-2007, 05:43 PM
It's a Quest Rule, 'Messages Dissapear'.
I'm afraid you can't do it with the script, unless you make it warp Link to a duplicate screen, which isn't all too hard.