Jump to content

What would this script do?


Avenger

Lets vote :)  

15 members have voted

You do not have permission to vote in this poll, or see the poll results. Please sign in or register to vote in this poll.

Recommended Posts

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 post

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 post

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 post

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 post
Guest Guest
Do we know whether "spawn" is set to 9999?

 

-Echon

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 post

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 here
Hmm. I always thought the scope dec was case-sensitive. Oh well.

 

Might it work in an area called LOCALS.ARE
Somebody 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 post

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 post
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 post

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...