ie: to turn on is "OnOff_On", to turn off is "OnOff_Off", and to just toggle between 1 or the other is "OnOff" Our example turns the light on, using the action "OnOff_On" that part is confusing i guess cuz how the names the action. but they are not all spelt the same (refer to the link below to see all the actions a block can use) Lastly, the "GetActionWithName" part looks for different commands the block can do, these are the same commands u can drag to ur toolbar in game, from the G menu. Then my "if" statement says, "if the variable returned from Open is true, then do the code inside the 's true or false, 1 or 0) to tell if the door is open. and the "Open" part is another part of code u cant see (specific to doors), that basicly returns a boolean variable (ie. "door1.Open" the first part is the name we defined it "door1" this can be anything u want as well, as long as the names match. ( refer to the link below to find the correct names for each block type) ( the name of the block can be changed in control panel, so make sure everything is names correctly) (also its case sensitive)Īnd the "as IMy." part defines that it is of that type. "GetBlockWithName" searchs ur control panel for a block that has the same name. "GridTerminalSystem" not really sure lol, but u need it "var" means to make a variable, "door1" was a name i made up, to define the door (this can be any name) The whole trick is learning the parts of the line of code. Heres the list of blocks and what type of input, and output they can give/recieve: Light1.GetActionWithName("OnOff_On").Apply(light1) //turn on light If (door1.Open = true) //if the door is open Var light1 = GridTerminalSystem.GetBlockWithName("Interior Light") as IMyInteriorLight Var door1 = GridTerminalSystem.GetBlockWithName("Door") as IMyDoorBlock
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |