Page 1 of 1

String to long ?

Posted: Fri Mar 15, 2013 4:46 am
by colguetti
Hi everyone, this time I´m trying to get a string from InputRequester() into RandomSeed(), but I can´t figure out how to convert complete ASCII string to ASCII values and feed that into RandomSeed()

Does anybody know a slick way of performing this task?

I guess also that the input requester should be parsed as unicode instead, just in case,

I thought of using PeekS and a pointer to a variable and PokeL and a pointer to that same variable, but I´m not sure to know how it works

Thanks in advance !!!

Re: String to long ?

Posted: Fri Mar 15, 2013 7:15 am
by flaith
Should use syntax "Asc"

Code: Select all

debug Asc("A") ;will give you ascii code 65
:?:
For a string, use this :

Code: Select all

String$ = "Your string to convert in Ascii !!!"

For i = 1 To Len(String$)
  Ascii = Asc(Mid(String$, i, 1))
  ; Put each value in a array for example
  Debug Ascii
  RandomSeed(Ascii)
  Debug Chr(Random(Ascii))
Next

Re: String to long ?

Posted: Fri Mar 15, 2013 7:38 am
by wilbert
colguetti wrote:Hi everyone, this time I´m trying to get a string from InputRequester() into RandomSeed()
If you want the string itself as a seed, I suggest you use the CRC32Fingerprint of the string as a seed for RandomSeed.

Re: String to long ?

Posted: Sun Mar 17, 2013 3:06 am
by colguetti
Thank you guys, I´ll try to write some code based on this approaches tomorrow, now I´m fighting with a BSP-tree like map generator,
whenever I get it to work as intended, I´ll need the seed stuff for it...

Thank you very much !!!