Clarification

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Clarification
Warrior
Member # 720
Profile #0
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).

--------------------
-Daravon
Posts: 104 | Registered: Friday, March 8 2002 08:00
Shock Trooper
Member # 4180
Profile #1
That's probably a good point, for those who aren't familiar with programming language conventions. :) 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".

--------------------
-spyderbytes
Posts: 200 | Registered: Wednesday, March 31 2004 08:00
Apprentice
Member # 4118
Profile Homepage #2
Reading about the C language will help you learn the style of the scripting.
Posts: 27 | Registered: Thursday, March 18 2004 08:00
Warrior
Member # 720
Profile #3
That's very helpful, spyder. :D

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*
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:

[ Tuesday, April 27, 2004 16:06: Message edited by: Daravon ]

--------------------
-Daravon
Posts: 104 | Registered: Friday, March 8 2002 08:00
Shock Trooper
Member # 4180
Profile #4
Ah... I should have thought to mention that, as well. :) 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. :)

[ Tuesday, April 27, 2004 16:11: Message edited by: spyderbytes ]

--------------------
-spyderbytes
Posts: 200 | Registered: Wednesday, March 31 2004 08:00
Warrior
Member # 720
Profile #5
Thankyou!
quote:
Originally written by spyderbytes:

Of course, 0 and 1 are the exact same things as TRUE and FALSE.
Of course, that much I had figured out. :P :D

And now, back to writing town states..

--------------------
-Daravon
Posts: 104 | Registered: Friday, March 8 2002 08:00