aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/space_vlaze/random.vim
AgeCommit message (Collapse)Author
2015-10-06random.vim: Use :rubyTeddy Wing
Since `:python` didn't work out for me because of my system version mismatch (1307eac), use Ruby to generate random numbers instead. And w00t! this doesn't block the interface, rendering, and player movement!
2015-10-06random.vim: Use :pythonTeddy Wing
Ostensibly this should work and generate us a random number using Python without having to call `system`. My hope is that this call doesn't block rendering and execution of our game. The trouble is that I can't get it to work because I have Python 2.7.1 installed as my system Python (which Vim is linked against), and Python 2.7.9 installed via Homebrew. Vim is looking in the Homebrew path when it should be looking in the system path to Python and causing this error: Error detected while processing function space_vlaze#random#Random: line 7: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 47, in <module> from os import urandom as _urandom ImportError: cannot import name urandom More information: - https://github.com/klen/python-mode/issues/87 We could get around this by not having these 2 versions of Python installed on our system (the random implementation changed between 2.7.2 and 2.7.3) or by setting `$PYTHONHOME` in our vimrc. Could, but I'm sick of this shite. Would have liked to be able to use Python for this because in my opinion Python tends to be pretty fast as interpreted languages go, but frak it I'll just use Ruby.
2015-10-05Add random.vimTeddy Wing
Add a random number generator based on this Stack Exchange post from Carpetsmoker: http://vi.stackexchange.com/questions/807/how-to-generate-random-numbers/812#812 Since Vimscript doesn't have a random number generator, shell out to Python and get a random int between 0 and the max value passed in.