Search found 69 matches

by Scotty
Sun Nov 09, 2014 1:40 pm
Forum: Mod Creation
Topic: Changing properties of dynamically created object
Replies: 4
Views: 3197

Changing properties of dynamically created object

I'm struggling to figure out how I can change the properties of an object created via script at runtime. Where the ID of the object isn't known beforehand. For example, spawning in a door, and then setting it's pullChain value to true. local ID_string = "door_" .. getUniqueID() spawn("...
by Scotty
Sat Nov 08, 2014 5:38 am
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

Oh nice, yours seems much more random in its layouts, actually designing the paths in real time. Here's a couple screens of what I've got http://i.imgur.com/ONRGWLD.png That's the floor layout in the top left. 2 -> 3 -> 4 -> 5 -> 6 -> 7 being the critical path, and 9's being offshoots. http://i.imgu...
by Scotty
Fri Nov 07, 2014 7:02 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

You are destroying the invisible walls for the paths you are using, for ones you don't you leave the walls there. Not quite, the map starts completely empty and builds up the walls from the script. Are you building the paths on game start or are you building them as the party moves thru the level? ...
by Scotty
Fri Nov 07, 2014 6:27 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

I'm using the dungeon_wall asset with invisible walls behind and pillars between the walls, I started with secret doors but found that they actually stick out a tiny bit more than dungeon walls, so some object don't look good on them. I've got it working pretty good thus far. I divide up the 32x32 m...
by Scotty
Fri Nov 07, 2014 4:20 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

Ah yep, that does work. I think I still had another bit of bad code floating around.

Thanks for the help, this'll work nicely.
by Scotty
Fri Nov 07, 2014 4:07 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

Oh wait, no this doesn't work in grimrock: test_array = {} test_array["test"] = 1 print (test_array["test"]) Global error. So here's what I'm trying to do. I'm working on a procedurally generated dungeon. I have a bunch of tables that store layout data for chunks of the dungeon. ...
by Scotty
Fri Nov 07, 2014 3:51 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

Oh I see, like this:

Code: Select all

table = {"varname"}
table["varname"] = 5
print (table["varname"])
So instead of using number indexes, using string indexes.

This should work for what I'm doing, thanks!
by Scotty
Fri Nov 07, 2014 3:37 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Re: Using array of strings to access variables

I'm very new to lua by the way.

So pairs and ipairs just steps through the table right? Doesn't gain access to the variables from the strings on its own.

Code: Select all

table = {"varname"}
varname = 5
print (table["varname"])
Is just giving me nil there
by Scotty
Fri Nov 07, 2014 3:07 pm
Forum: Mod Creation
Topic: Using array of strings to access variables
Replies: 18
Views: 11031

Using array of strings to access variables

If I run the following chunk of lua script in an online interpreter it works perfectly fine and prints out 5. table = {"varname"} varname = 5 print (_G[table[1]]) However, if I try and run it in my dungeon script, I get the error: "attempt to index global '_G' (a nil value)" Does...