I've been trying to get back into developing my GZDoom standalone game, and I wrote a line that looked something like the following in one of its scripts:
int flags =CheckInventory("EventFlags");
...only to find out it doesn't compile. This is a pretty common thing to do in every programming language I have ever used, so I was a bit surprised to find out it didn't work. I looked everywhere in the ZDoom wiki and couldn't find a solution. Is there some way to get the return value of a function and store it in a variable, or am I out of luck?
(EventFlags is a custom inventory item I have defined in ZScript. I'm essentially using the amount of that item that the player has in their inventory as a set of bitwise flags, so I only need one item to remember multiple things at once. I want to store that number in a variable so I only have to call CheckInventory once in any given script that checks for multiple flags, which makes the code easier to write, plus it should run faster.)
EDIT: I'm an idiot. It does work, I have no clue what the heck I was doing wrong. Disregard my stupidity.
Question
QuotePilgrim
I've been trying to get back into developing my GZDoom standalone game, and I wrote a line that looked something like the following in one of its scripts:
...only to find out it doesn't compile. This is a pretty common thing to do in every programming language I have ever used, so I was a bit surprised to find out it didn't work. I looked everywhere in the ZDoom wiki and couldn't find a solution. Is there some way to get the return value of a function and store it in a variable, or am I out of luck?
(EventFlags is a custom inventory item I have defined in ZScript. I'm essentially using the amount of that item that the player has in their inventory as a set of bitwise flags, so I only need one item to remember multiple things at once. I want to store that number in a variable so I only have to call CheckInventory once in any given script that checks for multiple flags, which makes the code easier to write, plus it should run faster.)
EDIT: I'm an idiot. It does work, I have no clue what the heck I was doing wrong. Disregard my stupidity.
Edited by QuotePilgrimi'm an idiot
Share this post
Link to post
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.