Jump to content
  • 0

Can I not store the return value of a function into a variable in ACS?


QuotePilgrim

Question

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.

Edited by QuotePilgrim
i'm an idiot

Share this post


Link to post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...