|
Prowler Productions
Dink Smallwood Forum Trying to get a random-number-order script to work |
Author | Topic: Trying to get a random-number-order script to work |
Tamtur |
posted 05-27- 04:07 PM CT (US)
Boy, this flashcard thing is harder than I thought! Maybe I should just write them out on paper :). Anyway, I have a script wrote out that is *supposed* to put out the numbers 1-12 in random order. Anyway, at least it's spitting out numbers now - and they're between 1 and 12 - but the last time I ran it 8 of the numbers were 6! It's pretty long (and confusing), but here it is if you have time. If you know of an easier way to do it, I'm all ears!! Info: &01word, &02word, etc are all global variables, as is &track and &myrnd void click ( void ) &rndword = random(12,1); &total = &01word; Loop: void track ( void ) I included it all in case anyone got ambitious and wanted to try it out. All you'd have to do is attach it to one of the buttons on the main dink screen (in start.c) and add a main proc that initted the variables and turned it into a button. Please, please, please help, I don't know what else to try to get the bugs worked out. Thank you |
FF4LIFE |
posted 05-28- 03:08 AM CT (US)
Eh, to tell you the truth, i have no clue. But on a somewhat related note, i'm trying to have a spell cast on all enemies on the screen, and i can get it to choose a random sprite of all the brains i want, but how do i choose ALL the sprites, because get_sprite just gets the same one each time, and get_random_sprite does random, so is there a way to say get_next_sprite or something clever like that? Also, not related at all, I'm having some math troubles...I have one global thats going to detect a lot of things, basicly, &items = 987654321 int &bomb = &items/10; so....&bomb should return as 3, right, 32/10 is about 3, and i heard somewhere it rounds down....maybe not....but then multiply the 3 * 10, so 30, and subtract from 32 and you get 2...right? WRONG!!! HELP!!! |
Drakeman |
posted 05-28- 11:56 PM CT (US)
Try int &potions = &items; That is split up the ne line into two commands. I don't think DinkC supports mutlitiple math commands on one line. |
redink1 |
posted 05-29- 06:46 PM CT (US)
For the flash-card thing, I did something similar for my D-Mod currently in production (for a year or two) You Don't Know Dink. This is what I did (all of the vars are global (unless int) and were loaded so &question was last, so a bug wouldn't happen): void main(void) And do something like if (&question == 2) and such for the rest of the parts, and of course you'll have to modify it for 12 items. It works, though. |
redink1 |
posted 05-29- 07:04 PM CT (US)
I suppose I should've read FF4Life's post before I dismissed it right away for not pertaining to Tamtur's :) Actually, I've been working on something similar to storing other variables in one SuperVar (my dubbing for it). Anyway, if you want to see how I got it to work, dowload it at http://www.3ddownloads.com/?file_id=147389 . Its only 390 bytes, so it should download fast :) Note 1, you do have to start from the left of the variable and go all the way down to the variable that you want. So, if &supervar is 987654321, and you want to find out what 3 is, you have to calculate at least the &carry for the 987654 part of it. Note 2, for reasons unknown, in my experimentation with SuperVars, they will generally output correct values the first time they are run (like in an item script). However, the second time they are run, the values are not correct. I think the problem is int local variables over and over, but I haven't found an exact solution so far. |
Drakeman |
posted 05-29- 09:58 PM CT (US)
Ummm make that second line... &potions -= &crap; I wish you could see the message you were replying to in this forum |
FF4LIFE |
posted 05-29- 11:05 PM CT (US)
Hey, thanks a bunch. Yeah if that doesn't work i'll take out the multiple commands, tho i thought those worked...myabe not..thanks. |
Tamtur |
posted 05-31- 12:05 PM CT (US)
Thanks Redink, I never did figure out what was wrong with my script, but it works now with your suggestions. Much appreciated |
redink1 |
posted 06-01- 07:53 PM CT (US)
Tamtur, I thought of a way to make my script much more streamlined. Hopefully, this will make the script a little bit less unruly (note that &question1 is set within the question part itself): void main(void) //Etc. |
Tamtur |
posted 06-03- 01:08 PM CT (US)
Hey thanks, redink, that does look a lot better. |
Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.