| www.ClassicTW.com http://www.classictw.com/ |
|
| RANDOM AND ARRAY (Final JAM) http://www.classictw.com/viewtopic.php?f=15&t=21706 |
Page 1 of 1 |
| Author: | Yop_Solo [ Sun Mar 22, 2009 9:48 am ] |
| Post subject: | RANDOM AND ARRAY (Final JAM) |
Hi, Finaly I made it. My random can now randomize and redo the random if a certain of numbers are repeated too much. My last bug, is again the way to put an "*" if some values in TEDIT had the same number of digits... TEDIT example In Planet Editor, if the max number is 20000, when you put more than 9999, you do not need to do "*" . So now my problem is that in my script my max number isn't always the same, it's depending of the Planet Class. Someone got an idea... to do it shortly, cause I thought about a manner to do it, but it will add a lot of lines to my script and I believe that an advanced scripter or an expert scripter will be able to do it with lesser than my idea. |
|
| Author: | Thrawn [ Sun Mar 22, 2009 11:02 am ] |
| Post subject: | Re: RANDOM AND ARRAY (Final JAM) |
Not too sure if I am understanding correctly, but you are talking about the number of characters and when the enter key is needed or not, correct? If so, I encountered a similar issue and Promethius was kind enough to teach me about this. I can show you an example from my OCSBot Patrol script. Code: readtoarray $SentryFile $SentryCount setVar $i 2 while ($i <= $SentryCount) send "s" WaitFor "Sector number (0=" send $SentryCount[$i] getLength $sentryCount[$i] $len if ($len < 5) send "*" I have the course from Sector 1 to StarDock going into a file called SentryList.txt which gets read into the $SentryCount var. I had to use the getLength command, then tell it if the length was less than 5 characters (ex: sector 10001), then send the enter key. |
|
| Author: | LoneStar [ Sun Mar 22, 2009 11:51 am ] |
| Post subject: | Re: RANDOM AND ARRAY (Final JAM) |
Code: if ($PLANET_NUMBER_IDX <= 9999) send $PLANET_NUMBER_IDX & "*" else send $PLANET_NUMBER_IDX end |
|
| Author: | Thrawn [ Sun Mar 22, 2009 1:06 pm ] |
| Post subject: | Re: RANDOM AND ARRAY (Final JAM) |
d'oh <slaps forehead> Figured I was not in the right area. |
|
| Author: | Promethius [ Sun Mar 22, 2009 1:50 pm ] |
| Post subject: | Re: RANDOM AND ARRAY (Final JAM) |
One thing to consider is if you are editing a game with 5,000 sectors max instead of 20,000. The length of the autocomplete will probably change. Three numbers entered on a 5k would be ok with a "*", but the 1,000 to 5,000 would probably hose up. I think in T-edit you can easily get the max sectors and use either a length based work around (length - 1, add *) or a value based. I used length based because I didn't want to test for values. |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|