Basic scripting tutorial (WIP)
#46
Posted 04 December 2008 - 12:58 PM
#47
Posted 04 December 2008 - 01:11 PM
#48
Posted 04 December 2008 - 01:40 PM
I'm pretty sure you can.
#49
Posted 05 December 2008 - 12:52 PM
#50
Posted 13 January 2010 - 07:50 AM
I've seen this technique imployed in various scripts, one example being the Straffe Script; it's a script where Link can walk in all directions while facing one set direction the whole time as long as you hold the L Button. To achieve this, it writes to "Link->Dir", which is labeled "read-only" as you stated.
During all my latest scripting endeavors I've been desperately wanting to mess with some of these untouchable variables, and have been frustrated that they were off-limits. Then later I came across this Straffe Script, freaked out, looked this up for clarification, and now I want to cry.
Are you telling me that any of these read-only variables MIGHT be changeable but it's nothing but one big ridiculous gamble, in that it might change later or might not and there's no way to know?
...That's really unfair. I want to cry. I'm afraid to script now.
Edited by Schwa, 13 January 2010 - 07:53 AM.
#51
Posted 13 January 2010 - 08:04 AM
Setting Dir shouldn't really have that written after it in ZScript.txt in my opinion because it's something that everyone uses.
#52
Posted 13 January 2010 - 08:59 AM
#53
Posted 11 February 2010 - 07:20 AM
...where "FrameCount" is a variable that is incremented once per frame. The object is to halve the speed of Link's movement by disabling the four arrow keys every other frame (meaning I apply this to InputDown, Left and Right as well). I haven't tested it yet, as I'm setting up a couple different scripts at once, but do you guys think this will work? I don't think I ever used Bitwise AND or the Modulus operator once yet, and it's kinda hilarious that I'm now using both at the same time. It looks like it'd work though!
Keep in mind too that Link->InputUp is a boolean. Just reminding people.
#54
Posted 11 February 2010 - 07:32 AM
Thinking about it, that's a much better way than how I had been doing it previously. I shall update my code.
#55
Posted 17 February 2010 - 03:30 PM
#56
Posted 17 February 2011 - 02:20 AM
#57
Posted 09 April 2014 - 07:17 PM
Also, I am reading it over and over just so I can absorb all the material. I highly recommend this topic to anybody who knows how to add scripts to their quest but is not entirely sure what it is that they are adding.
#58
Posted 10 April 2014 - 10:11 AM
Good to hear your feeling less intimidated now, If there's anything you don't understand feel free too ask in this topic or my AMA topic. The link is in my signature.
#59
Posted 12 June 2014 - 12:29 PM
zscripting seems pretty cool, it's like a mix of C and Java. Is the run() function simialar to main()
Edited by GhostKnight22, 12 June 2014 - 12:32 PM.
#60
Posted 15 June 2014 - 08:45 AM
Here's how you would use this made-up function.
// All the function does is add two numbers, so it's equivalent to ordinary addition. // You assign the return value to a variable the same way as anything else. this->X = Add(5, 11); // Equivalent to this->X = 5 + 11; Link->HP = Add(48, -16); // Equivalent to Link->X = 48 + -16; Add(10, 25) = this->Y; // ERROR: You can't assign a value to a function Link->HP = Add(4, 12, 8); // ERROR: The function takes exactly two arguments; you can't use more or fewer, even if it seems logical
There's a small error in the functions section you might want to fix so that it won't confuse people. The function in question is Link->HP = Add(48,-16) but you describe it as "Equivalent to Link->X = 48 + -16"
EDIT: My bad, didn't see how old this was.
Edited by Rocks4Free, 15 June 2014 - 08:59 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users