View Full Version : Declaring a variable...
Nimono
01-14-2007, 09:03 PM
How exactly do I declare a variable without it referring to anything but a number? Do I use "int (variable name here)", or is there something else I need to do? My script I'm working on has a variable "remainder" that's the end result of the X-position of an FFC divided by 16. How do I declare remainder as a variable?
Note: Yes, I DID read the ZScript Technical FAQ AND the documentation, but there's nothing in them about declaring variables.
Fire Wizzrobe
01-14-2007, 09:14 PM
Yes. Like;
int variablename = value
for decimal numbers;
float variablename = value
Nimono
01-14-2007, 09:19 PM
I alway thought that int and float were used the exact same way... Oh well. I have no idea what number will turn up, so I'll just use float, just to be on the safe side. Thank you!
Edit: Great... I need to place a Push flag on the FFC, but... ComboF() isn't a function of my pointer.... I put Screen->ComboF(61), because I wanted my FFC to have Flag 61 on it so I could push it. What's going on? I even put the FFC's pointer and = !
Edit2: Well, this is stupid. Now it's saying that ffc->Flags() is an invalid function for an FFC pointer. Help?
Edit3: Yay! All I needed to do was change the parentheses to brackets. Now it compiled, so it's time to test! :D
Saffith
01-14-2007, 11:28 PM
Technically, int and float are the same in ZScript, but it's a good idea to use them differently so it's clear how the variables are intended to be used.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.