I have a 25 by 25 array. I do a nested loop to roll a chance for a galaxy in each slot. This takes place under world.New() so that the galaxies are initialized at run time. They do not get displayed until a player logs in.
mob
Login()
..()
for(q=1, q<26, q++)
for(q1=1, q1<26, q1++)
if(galaxy_chance[q][q1] <= 6)
count1 += 1
x=q
y=q1
z=1
new/turf/galaxy1 (loc)
if (count1 == 1) new/area/galaxy1 (loc)
if (count1 == 2) new/area/galaxy2 (loc)
if (count1 == 3) new/area/galaxy3 (loc)
etc etc, and below that I have
area
galaxy1
Entered()
usr.loc = locate(1,1,2)
galaxy2
Entered()
usr.loc = locate(1,1,3)
galaxy3
Entered()
usr.loc = locate(1,1,4)
etc etc.
Is there any way to have the top code run on a loop or array in order to have the program create new unique instances of the galaxy# areas and new/area/galaxy# (loc) "portals" at run time rather than having to hard code them ahead of time?
ID:154838
Dec 3 2011, 9:47 pm
|
|
Dec 3 2011, 9:57 pm
|
|
In response to Zaoshi
|
|
I keep getting 160:error: text2path: undefined var
|
In response to Thaldor
|
|
Thaldor wrote:
I keep getting 160:error: text2path: undefined var I can not code, but the error is simply telling you line 160 "text2path" is an undefined variable, and needs to be defined prior to use. Do not hold my word that will fix your problem, but thats what the error message is telling you. |
var path = text2path("/area/galaxy[count1]") But from your code, I think you'd rather condense it like so: area/galaxy |