while (char_ok(i) == 0)

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: while (char_ok(i) == 0)
Warrior
Member # 2796
Profile #0
Hi,
Here is a piece of "for next" coding , Ops!, wrong language,
that I do not quite understand.

quote:

For example (i.e.) :

i = 0
while (char_ok(i) == 0)
{i = i + 1; }
...
append_char_name(i);
...

I guess my questions are : what character's name is appended?
and just how is it displayed to the player?


Thanks before hand for any help.
gcmaxxon :confused:

--------------------
quote:
" He loved maps, and in his hall there hung a large one of the
Country Round with all his favourite walks marked on it in red ink."
---The Hobbit
pg21

Posts: 97 | Registered: Wednesday, March 19 2003 08:00
Triad Mage
Member # 7
Profile Homepage #1
The name is appended to the buffer, which holds strings that you are appending. To get each character's name, the appending name line should go inside of the curly braces.

--------------------
"At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander
====
Drakefyre's Demesne - Happy Happy Joy Joy
Encyclopedia Ermariana - Trapped in the Closet
====
You can take my Mac when you pry my cold, dead fingers off the mouse!
Posts: 9436 | Registered: Wednesday, September 19 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #2
I'm guessing that he got that code out of one of my scenarios — the bracketing is distinctive.

The idea is that the while loop finds the first living character. It starts with 0, and if 0 is dead, it checks 1, and so on until it finds the party leader.

So i is the first living character, and that character's name is appended to the text buffer. That displays nothing. Notice a few lines later that there's this:

get_buffer_text(dlgstr);
message_dialog(dlgstr,"");
Or something along those lines. The get_buffer_text saves the text buffer to dlgstr, and then message_dialog pops up dlgstr.

This is the way to make a message box address the leading character by name.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Warrior
Member # 2796
Profile #3
Hi,
Yes, you are correct. It is coding from "Castle Pudideum". I thought this was one (maybe the only way) way of displaying one of the party's name.
Can I use your "dlgstr" coding?
Thanks for the help.

gcmaxxon

--------------------
quote:
" He loved maps, and in his hall there hung a large one of the
Country Round with all his favourite walks marked on it in red ink."
---The Hobbit
pg21

Posts: 97 | Registered: Wednesday, March 19 2003 08:00
Off With Their Heads
Member # 4045
Profile Homepage #4
Yes, you can use it.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00