Author Topic: Ye olde "Global" vs. "Locals" variable  (Read 2876 times)

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Ye olde "Global" vs. "Locals" variable
« on: July 04, 2004, 05:10:24 PM »
(1) I hate to write a script heavily dependent on "GLOBALS".  But I find even if I set the "LOCALS" properly in game in the Bxxxx.d files or xxxxJ. files they don't seem to be recognized by the .baf/BCS when called even though they're reset in the bxxxx.d/xxxxj.d via a simple chain called by my NPC's script or the bxxxx.d/xxxxj.d.  Frustration City!  The only thing that prevents looping is if I reset the "LOCALS" to "GLOBALS" or add an additional GLOBAL check in the script.

(2) Has anyone found a way to check via the CLUAConsole for the value of LOCALS variables?  We can check for the GLOBALS I saw via the cheats but I didn't see anything for LOCALS

Thanks.

Offline cliffette

  • Timmins Tragic
  • Planewalker
  • *****
  • Posts: 547
  • Gender: Female
  • I still like Neighbours
Re: Ye olde "Global" vs. "Locals" variable
« Reply #1 on: July 04, 2004, 05:23:59 PM »
Be careful - it's "GLOBAL" and "LOCALS". It's easy to stick that extra S in there :).

(1) Possibly highly dodgy information alert! If the last speaker in your CHAIN is not the NPC in question, setting the locals won't work, as the last speaker gets all the scripting actions you put in a CHAIN, due to the way WeiDU interprets a CHAIN. In other words, you have set the locals, but it's just gone to the wrong character. :) Make sure the NPC you want the locals set to is the final speaker if you want this to work.

(2) Just make sure you have the pointer over the NPC in question when you hit 'enter'. :) But the command is the same [GetGlobal("TheLocalsYouWant","LOCALS") ].
« Last Edit: July 04, 2004, 05:35:47 PM by cliffette »

Offline cliffette

  • Timmins Tragic
  • Planewalker
  • *****
  • Posts: 547
  • Gender: Female
  • I still like Neighbours
Re: Ye olde "Global" vs. "Locals" variable
« Reply #2 on: July 04, 2004, 05:28:44 PM »
As an addendum to point (1) above, it is possible to set the locals if the last speaker is not your NPC - just use ActionOverride("YourNPCsDeathVariable",SetGlobal("SetThisLocal","LOCALS",1)).

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Ye olde "Global" vs. "Locals" variable
« Reply #3 on: July 04, 2004, 06:49:49 PM »
Thanks - some have already pointed out to me the "ActionOverride"but you're the first one who's really explained what is happening with the "LOCAL" variable in a Chain.

*Sigh* Just more stuff to keep in mind while coding.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: Ye olde "Global" vs. "Locals" variable
« Reply #4 on: July 05, 2004, 01:44:38 AM »
(1) I hate to write a script heavily dependent on "GLOBALS".

There's really nothing wrong with it.

Quote
(2) Has anyone found a way to check via the CLUAConsole for the value of LOCALS variables?  We can check for the GLOBALS I saw via the cheats but I didn't see anything for LOCALS

The pointer must highlight the object that owns the LOCALS when you press enter.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Sillara Tamar

  • Princess
  • Planewalker
  • *****
  • Posts: 83
  • Gender: Female
Re: Ye olde "Global" vs. "Locals" variable
« Reply #5 on: July 22, 2004, 11:28:05 PM »
I love GLOBAL!!!  LOCALS are not nearly so nice.

Sillara
_________________________________________
For I have sworn thee fair and thought thee bright,
Who are as black as hell, as dark as night.

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Ye olde "Global" vs. "Locals" variable
« Reply #6 on: August 16, 2004, 06:00:48 AM »
Sometimes you might want to set a LOCAL variable without ActionOverride (which isn't always safe, because the action is queued, and subject to premature removal).
In this case you might want to ApplySpell a special spl which has a local variable changer effect.

Offline Loriel

  • Planewalker
  • *****
  • Posts: 390
  • Gender: Male
    • Loriel's Downloads
Re: Ye olde "Global" vs. "Locals" variable
« Reply #7 on: August 16, 2004, 05:02:53 PM »
Sometimes you might want to set a LOCAL variable without ActionOverride (which isn't always safe, because the action is queued, and subject to premature removal).
In this case you might want to ApplySpell a special spl which has a local variable changer effect.

This only works for TOB - it will make SOA crash since the effect is TOB-only.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: