Page 1 of 1

import math

Posted: Sat Aug 19, 2017 11:16 am
by Scribbles
Is there a place where the available python modules(?) that are already included in Renpy are listed?

specifically I was wondering if I could use import math to use the math functions?

I tried to google an answer but I couldn't find one that explained it in a way that I understood > < (i tried looking through the renpy directories but couldn't figure that out either)

Re: import math

Posted: Sat Aug 19, 2017 12:19 pm
by Alem
I think math is in the package from the start, try:

Code: Select all

init -1 python:
    import math
And then something that you want to test out in the main script.

Re: import math

Posted: Sat Aug 19, 2017 3:51 pm
by Remix
renpy-version}-source/renpy/bootstrap.py list the common included import'ables...

import datetime; datetime
import encodings.ascii; encodings.ascii
import encodings.utf_8; encodings.utf_8
import encodings.zlib_codec; encodings.zlib_codec
import encodings.unicode_escape; encodings.unicode_escape
import encodings.string_escape; encodings.string_escape
import encodings.raw_unicode_escape; encodings.raw_unicode_escape
import encodings.mbcs; encodings.mbcs
import encodings.utf_16; encodings.utf_16
import encodings.utf_16_be; encodings.utf_16_be
import encodings.utf_16_le; encodings.utf_16_le
import encodings.utf_32_be; encodings.utf_32_be
import encodings.latin_1; encodings.latin_1
import encodings.hex_codec; encodings.hex_codec
import encodings.base64_codec; encodings.base64_codec
import encodings.idna; encodings.idna
#
import math; math
#
import glob; glob
import pickle; pickle
import difflib; difflib
import shutil; shutil
import tarfile; tarfile
import bz2; bz2 # @UnresolvedImport
import webbrowser; webbrowser
import posixpath; posixpath
import ctypes; ctypes
import ctypes.wintypes; ctypes.wintypes
import argparse; argparse
import compiler; compiler
import textwrap; textwrap
import copy; copy
import urllib; urllib
import urllib2; urllib2
import codecs; codecs
import rsa; rsa
import decimal; decimal
import plistlib; plistlib
import _renpysteam; _renpysteam
import compileall; compileall

As Alem alludes though, you still need to import ones you want into any file that uses it

Re: import math

Posted: Sat Aug 19, 2017 4:05 pm
by Scribbles
thank you both!