ok I know a bit of python and how to use it in blender, but right now I am stepping into terrirory I have never done before and could use some help. I’m trying to make my own exterior savefile like in the tutorial on blendenzo.com, however I would like to save things other than character location.
I’m talking Items ETC. (mind you this is in 2.49b)
so I did this (and I don’t know if it’s correct):
saveFile = open("Savefile.sav", "w") saveFile.write( property="item1" value=True +"\1")
intent of the code is: this is used on an item the player will collect; make a file called Savefile.sav and/or open it with write permissions, write: the property Item1 (set to bool) has a value of True, THIS IS LINE 1 NO EXCEPTIONS.
bassically I want to define lines in the save file each line deals with a different item or instance
loadFile = open("Savefile.sav", "r") get.property("item1") loadFile.readline(1) set.value()
this is the part I’m very iffy on, it’s intended to work like this:
open Savefile.sav with read permissions, get the property linked to this object named “item1”, Read only line 1 of Savefile.sav. set item1’s value to what ever is depicted in the save file.
Ok I reviewed some other codes I have and using the syntax presented there I came up with this:
saveFile = open("Savefile.sav", "w") saveFile.write(Value = "True" + "\1")
to be used on the acquired item in question. I am not sure “( Actuator = “item1” and Value = “True” + “\1”)” is correct can anyone enlighten me? especially on the topic of if this is the way to define which line is being written to?
or is this correct:
saveFile.write(1.Value = "True")
import blender as B loadFile = open("Savefile.sav", "r") CheckItem1 = B.getActuator("item1") loadFile.readline(1) B.CheckItem1.setValue()
I am almost positive this is correct, this is to recheck the save file for example when loading a saved game. so people will start with/without the item in question. if I am incorrect about putting B. and importing blender as B let me know.