Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Kitai

#1
It seems that when a script's name contains a dot (like MyScript1.0) no menu shows with right-clicks. Therefore I can't rename/delete/export these scripts.

Has anyone ever experienced it?
#2
Hi,

I'm currently developing a word game and I need to randomly pick up a word from a long text file (one word per lign).
Here is the code I use to do so:
Code: ags
function noloopcheck NewWord() {
  int l = Random(900000), i;
  File* input = File.Open("input_file.txt",eFileRead);
  String line;
  while (i <= l) {
    line = input.ReadRawLineBack();
    i++;
  }
  input.Close();
  WordToFind = line;  
}


EDIT : Just tested it one more time. Now the returned value is each time around 6500. I don't know about the core mechanism of the Random function, but could it be that the returned value were calculated on the basis of the current time?

The "900000" is purely arbitrary, it's meant to correspond to the number of ligns in the file.
The problem is that if I pass a low value to Random, everything goes right (I end up with some of the first words of the file). But as soon as I set a too high value (don't ask me which exaclty, I just don't know), the variable l always gets around 14000 and I inevitably get a word beginning with D (you see why...).
I first wondered if the int type limitted the Random argument to some extreme value, but that's not the case and even if it was so, it would be non-sense to get a 14*** value each time.

I've been looking through the results for "Random problem/limit/too high" on the forums, but this problem doesn't seem to have been encountered.
Any idea?

Thanks.

PS: Sorry for language mistakes, french guy spotted.
SMF spam blocked by CleanTalk