Jump to content

Clarification


Daravon

Recommended Posts

Perhaps it is because I am such a neophyte to the world of programming, but it doesn't seem to be made clear whether or not one should type the words "void" and "short" as they are shown in the Documentation and Appendix. My first thought is "no" since they are not connected to the calls by underscores but, then again, they are shown with every single call and it is never explained outright whether they are needed (though it is explained what they mean).

Link to comment
Share on other sites

That's probably a good point, for those who aren't familiar with programming language conventions. smile No, you don't type them. They're only there to let you know what you can expect to get returned (if anything) from a function, when you call it.

 

IOW, if the call definition starts with 'short', for example, it means it 'returns' a value that you can assign to a variable. For example:

 

how_many = party_size();

spot_x = my_loc_x();

 

Calls that start with 'void' indicate that the call doesn't return any sort of value to you. It just "does its thing".

Link to comment
Share on other sites

That's very helpful, spyder. laugh

 

As a sort of a follow up question: what about a call with parentheses and a "short" within them, say.. *picks a random call in the appendix*

Code:
 void set_incidental_sound(short on_or_off) 
what is with the "shorts" on the interiors of many calls' parentheses? What do I do with them?

 

EDIT: coreyh, sadly I am a college student and am not able to do everything. Otherwise, I probably would read about C. cool

Link to comment
Share on other sites

Ah... I should have thought to mention that, as well. smile That means that the call expects you to supply a value to it. IOW, that particular call expects you to supply a short, on_or_off--in this case, either 0 or 1, TRUE or FALSE. In your script, it would look like:

 

set_incidental_sound(TRUE);

 

to turn on incidental sounds, or:

 

set_incidental_sound(FALSE);

 

to turn it off. Of course, 0 and 1 are the exact same things as TRUE and FALSE.

 

EDIT: Since my post doesn't make it entirely clear, 1 == TRUE and 0 == FALSE, by programming convention. smile

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...