PDA

View Full Version : Item>String script: What gives?



Dart Zaidyer
07-05-2008, 02:38 PM
I'm not ashamed to admit this is my first script. The idea is to display a string when Link is holding up an item, like most modern Zelda games. It compiles correctly with all my other scripts, except... nothing happens.


ffc script itemstring {
void run(int m){
Waitframes(5);
if (Link->Action == 4) {
Waitframes(5); Screen->Message(m); }
if (Link->Action == 5) {
Waitframes(5); Screen->Message(m); }
}
}

What am I doing wrong?

Joe123
07-05-2008, 04:55 PM
Preferred method:

item script message{
void run(int m){
Screen->Message(m);
}
}
Set as the pickup script for the item.

Yours doesn't work because there's no while loop.

Fix of your method:

ffc script itemstring{
void run(int m){
while(Link->Action != 4 && Link->Action != 5) Waitframe();
Waitframes(5);
Screen->Message(m);
}
}

Russ
07-05-2008, 06:20 PM
Just so you know, your main problem was using waitframe. Item scripts only last for one frame, so waitframe will do nothing, unless put in a while script, like Joe showed. Joe, you really should explain things better. :)

Joe123
07-05-2008, 06:27 PM
No, his main problem is that he doesn't have a while loop.
He's using an ffc script.
I explained well enough; if he's willing to read through what I put and see how it differs from his it should help him.
If he wants a more thorough explanation I'm sure he'll ask.

Russ, you should really read through things better. :)

Russ
07-05-2008, 08:46 PM
I have one thing to say: I feel like an idiot.

Joe123
07-06-2008, 06:39 AM
Heh, sorry :shrug:

ShadowTiger
07-06-2008, 09:38 AM
Damn you guys. :p No wonder scripting is so hard to learn. If it's not problem X interfering with problem Y that we never even heard of, it's that problem Y was situated in context A when context B needs to be related to whereas Context C is just sitting there on the shelf without any reference to the much needed solution to problem Z, which is currently sitting there without a while loop nobody knew to make.

If that didn't make any sense, then you know what's going on in the minds of those who are trying to script.

"Where the hell did that come from, and where can I find the book of stuff I need to know later that nobody is telling me now?"

This is the kind of stuff that "just doing it" doesn't really teach. :-/

Joe123
07-06-2008, 12:26 PM
I knew how to make the while loop =S

If someone wants me to go over things in detail then I'm willing to do so, I just didn't this time.
I do quite often, I could write a page worth of explanaition on that if you want?

ScaryBinary
07-06-2008, 07:05 PM
Maybe we should start a ZScript "Tips and Tricks" page in the Wiki (http://www.shardstorm.com/ZCwiki/Main_Page)?

If we can add this kind of stuff to a common place, its easier to find (versus reading through 100's of forum posts here) and we only have to type up the majority of it once....

Mega Link
07-09-2008, 12:23 PM
Damn you guys. :p No wonder scripting is so hard to learn. If it's not problem X interfering with problem Y that we never even heard of, it's that problem Y was situated in context A when context B needs to be related to whereas Context C is just sitting there on the shelf without any reference to the much needed solution to problem Z, which is currently sitting there without a while loop nobody knew to make.

If that didn't make any sense, then you know what's going on in the minds of those who are trying to script.

"Where the hell did that come from, and where can I find the book of stuff I need to know later that nobody is telling me now?"

This is the kind of stuff that "just doing it" doesn't really teach. :-/
You lost me when you said, "situated in context A". http://www.invision.smileyville.net/smilies/conf%20%2816%29.gif