PDA

View Full Version : Pickup Message script



ColorPrinter
06-09-2007, 02:43 PM
Please don't insult me, I'm new at this. But can someone tell me what's wrong with this code? It won't compile.


import "std.zh"
item script SwordMessage
{

void run()
{
void Screen->Message(1)
}
}
I'm trying to make it display a string which will appear when the player picks up the sword. (I know where to assign it.)

Please help! I have no idea what I'm doing wrong!

ShadowTiger
06-09-2007, 03:28 PM
I know far less than you do, but since it certainly couldn't hurt, ... try removing the "void" from "void Screen->Message(1)" ?

DarkDragon
06-09-2007, 04:07 PM
Yes, that should do it. That first "void" in the documentation means that the function doesn't return anything, and so you can't assign the function to a variable.



int x = Screen->Message(1); //not allowed
ffc f = Screen->LoadFFC(1); //OK, since LoadFFC has return type ffc.

Questions
06-09-2007, 04:10 PM
I know nearly nothing about scripting in ZC but still this can be done with a single line of code in ZASM


(space)MASGSTRV #

Where it says (space) it's just one hit of the spacebar. # is the string ID.

ColorPrinter
06-09-2007, 06:13 PM
Thanks! I did that before, but it wasn't working because I mistakenly forgot to put a ; at the end.

Questions: wow, ZASM looks a little simpler. I kinda prefer ZScript, though, because it seems more familiar to me.

EDIT: Two things:

1. Link can still move around while the script is displaying. Any way to fix that?
2. The message stays on screen until you leave, but I think this can be solved by answering question 1.

DarkDragon
06-09-2007, 06:43 PM
There's a quest rule, "Messages Freeze All Action." That will freeze link in place. And yeah, pure ASM can be useful for very short scripts or when you want low-level control of the script, such as direct access to the stack.

Fire Wizzrobe
06-16-2007, 10:59 PM
You would assign the message script to an item's script slot, right?

_L_
06-16-2007, 11:53 PM
2. The message stays on screen until you leave, but I think this can be solved by answering question 1.

Quest rule: Messages Disappear.