News Box
WELCOME TO MLNO!!!
My LEGO Nexus Organization
August 27, 2026, 04:19:20 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to My Lego Nexus Organization! A LEGO Universe, LEGO and My LEGO Network Fan Site! The LEGO Company does not sponsor, authorize, or endorse this site.-- New? Check out the welcome forum and get started! Got questions? PM Blade, or one of the other active members of the staff.
 
  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 10919 times)
0 Members and 35 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.014 seconds with 12 queries.