Message Board
Message Board > Fenix / Bennu / Gemix / DIV > rand() always gives the same value :S |
April 16, 2006, 20:49 | |
yonni
None 420 posts |
Why would this code always return the value 17112728? numberofenemys=rand(1,4); when numberofenemys is simply an integer variable. IT MAKES NO SENSE! since when did random always give the same answer? and no I havent used rand_seed() at all. ____________ |
# |
April 16, 2006, 22:10 | |
Fiona
games are terrible -9616558 posts |
rand_seed(time()); Um, does that even work? lol. Yeah, try doing that at the start of your program. [Edited on April 16, 2006 by Fiona] ____________ laffo |
# |
April 16, 2006, 22:25 | |
PEader
お前はもう死んでいる 1486 posts |
Quoting yonni: Why would this code always return the value 17112728? numberofenemys=rand(1,4); when numberofenemys is simply an integer variable. IT MAKES NO SENSE! since when did random always give the same answer? and no I havent used rand_seed() at all. Becasue it is broken or you're referencing numberofenemies incorrectly or I'm in your system eating RAM, EATING IT! But wow that is seriously fucked. Noit much help though... ____________ I see 57,005 people. |
# |
April 16, 2006, 22:41 | |
Deadmaster
Where is Johnny? 458 posts |
If you're finding it out by writing the varible on the screen, make sure you're using write_int and not write, and you're using "offset" or "&" in front of the varible.
____________ My site still needs updating and redesigning. My last.fm page. GO TO TEXTUAL ANARCHY II YOU FISHDOG YOU |
# |
April 17, 2006, 00:06 | |
Rincewind
programmer 1545 posts |
I think you indeed forgot the offset, and otherwise you're altering the variable somewhere else constantly to that value. If Deadmaster's advice doesn't solve it, then could you perhaps post a bit more of the surrounding code?
____________ Personal website: http://www.loijson.com |
# |
April 17, 2006, 00:51 | |
Fiona
games are terrible -9616558 posts |
Ah of course, never occured to me how you might be finding out the variable. Remember when all else fails, you can use Fenix's shite debugger.
____________ laffo |
# |
April 17, 2006, 16:05 | |
Rhovanion
Exterminated 666 posts |
Fenix has a debugger, other than the rape(); command? I mean say(); command?
____________ |
# |
April 17, 2006, 22:12 | |
Fiona
games are terrible -9616558 posts |
Yeah, you have to use a command line parameter, and then hit something.... I bet Moogle knows... ____________ laffo |
# |
April 17, 2006, 22:31 | |
PEader
お前はもう死んでいる 1486 posts |
Quoting Ferret: Yeah, you have to use a command line parameter, and then hit something.... I bet Moogle knows... Moogle always knows what to hit! Ctrl+G ____________ I see 57,005 people. |
# |
April 24, 2006, 21:33 | |
Moogle
Enterprise Edition 239 posts |
*smart retort* Specify -g when compiling and hit Alt-P for the profiler and Alt-C for the improvised terminal(in which 'help' actually helps!). ____________ I am Moogle and I approve this message. Quoting (. )( .) in the Bugs topic: Everytime I login the threads with new posts are by Dennis.
|
# |
April 24, 2006, 22:52 | |
yonni
None 420 posts |
erm... and if i use a GUI like flaming bird?
____________ |
# |
April 25, 2006, 11:16 | |
Moogle
Enterprise Edition 239 posts |
Edit -> Preferences -> Compilation -> Compile in Debug mode
____________ I am Moogle and I approve this message. Quoting (. )( .) in the Bugs topic: Everytime I login the threads with new posts are by Dennis.
|
# |
April 26, 2006, 13:02 | |
Quiest
now with more happynes 142 posts |
How about posting some lines of code so we can help a little more?
____________ Roundhousekick to the face, baby! |
# |
April 26, 2006, 16:00 | |
Eckolin
Quite Whiskered 388 posts |
The possibilities that I am aware of: 1. The value of the variable is checked in a wrong way. 2. The value of the variable is changed by another statement elsewhere before it is checked. 3. The rand function is bugged. ____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
April 26, 2006, 17:35 | |
Sandman
F3n!x0r 1194 posts |
The rand() function works afaik in v0.84a.
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
May 6, 2006, 17:55 | |
Quiest
now with more happynes 142 posts |
I use rand very often and I am sure it is not bugged, atleast since 84a...
____________ Roundhousekick to the face, baby! |
# |
May 6, 2006, 19:50 | |
yonni
None 420 posts |
It now works fine. I can't remember exactly what the problem was, or even if i knew what it was. It may have been something wrong with the way i was getting it to write. Thanks for all the help
____________ |
# |
May 6, 2006, 21:12 | |
Eckolin
Quite Whiskered 388 posts |
Yes, you were most likely writing the address of the number, rather than the number itself. Eight hexadecimals support that theory.
____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
May 14, 2006, 12:45 | |
Quiest
now with more happynes 142 posts |
Pwned.
____________ Roundhousekick to the face, baby! |
# |
Message Board > Fenix / Bennu / Gemix / DIV > rand() always gives the same value :S