Avenger Posted June 20, 2005 Share Posted June 20, 2005 What does the following area script do? (Coming from dltc's dl0112 area script) IF Global("spawn","locals",9999) THEN RESPONSE #100 CreateCreature("ERGGNM01",[303.348],3) // ~Gnome~ END 1. does nothing visible 2. creates an infinite number of gnomes (until reboot). 3. creates exactly one gnome Link to comment
jcompton Posted June 21, 2005 Share Posted June 21, 2005 I'm going to guess 1. (can LOCALS be used in an area script?) But there's obviously some sort of punchline here... Link to comment
Ghreyfain Posted June 21, 2005 Share Posted June 21, 2005 I've never tried it, but I don't think they do. The joke's probably that Sim was high while he coded it or something. Maybe I'll go check that out now (after having voted. Heh). Link to comment
devSin Posted June 21, 2005 Share Posted June 21, 2005 AREs cannot set, nor can they even check LOCALS variables (actually, I'm pretty sure that creatures are the *only* valid objects for LOCALS variables; they're the only objects with room for LOCALS in the super-ARE format, anyway). I chose "Nothing visible," simply for the fact that case-sensitive parsing means that "locals" is undefined. Whatever. Link to comment
Avenger Posted June 21, 2005 Author Share Posted June 21, 2005 Some not helpful hints: I doubt case is important here, the only place where case is important for variable context is the SaveLocationn (sic) action. I think locals (or LOCALS) could be used in areas, but as this poll shows, and as JC suspects, there are other circumstances Also, the original code looked like this: IF Global("Spawn","LOCALS",0) THEN RESPONSE #100 SetGlobal("Spawn","LOCALS",1) CreateCreature("ERGGNM01",[303.348],3) // ~Gnome~ END As a final hint, i might call it spoiler: it works the same way as my above example Link to comment
Ghreyfain Posted June 21, 2005 Share Posted June 21, 2005 I tried having AR0309.bcs do DisplayStringHead() on the PC when a LOCALS was set to 1. It never happened. Link to comment
Ghreyfain Posted June 21, 2005 Share Posted June 21, 2005 Unless you somehow have LOCALS in mastarea.2da? Heheh. Would that do anything, I wonder? Link to comment
Andyr Posted June 21, 2005 Share Posted June 21, 2005 Might it work in an area called LOCALS.ARE? Link to comment
Avenger Posted June 21, 2005 Author Share Posted June 21, 2005 Might it work in an area called LOCALS.ARE? <{POST_SNAPBACK}> The area's name is DL0112.are Link to comment
Echon Posted June 21, 2005 Share Posted June 21, 2005 Do we know whether "spawn" is set to 9999? -Echon Link to comment
Guest Guest Posted June 22, 2005 Share Posted June 22, 2005 Do we know whether "spawn" is set to 9999? -Echon <{POST_SNAPBACK}> Well, dunno if that helps you, or will lead you completely astray. Another spoiler: the variable doesn't exist prior to the script running Link to comment
devSin Posted June 22, 2005 Share Posted June 22, 2005 As stated, LOCALS don't work from ARE or trigger scripts. It could have any value and still wouldn't work. I doubt case is important hereHmm. I always thought the scope dec was case-sensitive. Oh well. Might it work in an area called LOCALS.ARESomebody could check, but I doubt it. The game probably only walks through creature effects when you use LOCALS (i.e., using LOCALS would only set and check creature variables, regardless of the area name; I imagine the same for GLOBAL). Link to comment
Avenger Posted June 22, 2005 Author Share Posted June 22, 2005 Ok, i think everyone who cares did vote and think about it. I wonder how many of you checked it. Because the answer is: 3. It seems the global trigger returns true regardless of value, if the variable doesn't exist but only once. Maybe during OnCreation. I'm now curious if this is tob specific, or all engines work the same. Link to comment
SimDing0 Posted June 22, 2005 Share Posted June 22, 2005 I tested it in the government district and it didn't seem to trigger. Link to comment
devSin Posted June 22, 2005 Share Posted June 22, 2005 I wonder how many of you checked it.The correct answer is Number 1. I don't even need to check it to Know.It seems the global trigger returns true regardless of value, if the variable doesn't exist but only once.This isn't right. Global doesn't do anything magical. Either a valid variable with the correct scope exists or doesn't. It doesn't return anything but 0 unless you did something right (as far as I can ever tell). You cannot check variables with LOCALS scope on anything but the creature object assigned the variable. You cannot check variables with MYAREA scope outside of the respective area (unless the master area is defined and loaded, I guess). Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.