News Box
WELCOME TO MLNO!!! ... ENJOY YOUR TIME HERE! ... WHILE YOU ARE HERE, CHECK OUT OUR RPGS!
My LEGO Nexus Organization
February 01, 2026, 12:33:19 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Guests: Please register and look around! Tell your friends. Registration is instant, but you'll have to wait for an active admin to get online to approve your account, which should take less than 24 hours.  If you do not receive your approval email, just try to login. We are having issues with the automated email system.
 
  Home   Forum   Help Arcade Gallery Rules Staff List Login Register Chat  

Blender

Pages: 1 2 3 [4] 5 6   Go Down
  Print  
Author Topic: Blender  (Read 6107 times)
0 Members and 12 Guests are viewing this topic.
KnightsFan
MLN Quester
Craftsman
*

MLNO Reputation 3
Offline Offline

Gender: Male
Awards:
Team: No Team
Posts: 1767




Badges: (View All)
Level 6 Tenth Year Anniversary Ninth Year Anniversary
« Reply #60 on: November 29, 2012, 04:23:20 pm »

There are things you can't really do with just logic bricks - AI, for example.

A basic profile would be something like this. Say you've got a txt document that looks like:
Code:
Name KnightsFan
Level 1
Weapons TheAwesomeSwordofDoom UselessPocketKnife
And you want to assign his unlocked weapons to "TheAwesomeSwordofDoom" and "UselssPocketKnife." You could do this:
Code:
        try:
            file = open('path/file.txt')      # The file path has to be relative to game
            for line in file:                       # Loop through the lines in the weapon's profile
                if "Weapons" in line:                 # Check if the word "Weapons" is in that line
                    list = line.split()            # Turn this line into a list -> ['Weapons', 'TheAwesomeSwordofDoom', 'UselssPocketKnife']
                    unlockedWeapons = list    # You will use this variable in the game
                    unlockedWeapons.pop(0)    # If you want, use this to remove the zero'th element of the list (which, in this case, is 'Weapons')
        except:
            print('Error reading the profile')  # If it can't open the file, this will be printed
        else:
            file.close()
Report Spam   Logged
Pages: 1 2 3 [4] 5 6   Go Up
  Print  
 
Jump to:  

LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize or endorse this site.
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.039 seconds with 13 queries.