Author Topic: namespace question  (Read 2568 times)

0 Members and 1 Guest are viewing this topic.

Offline KilroyIsDeadTopic starter

  • Full Member
  • ***
  • Posts: 155
  • Activity:
    0%
  • Reputation Power: 2
  • KilroyIsDead has no influence.
  • Respect: +13
  • Referrals: 0
    • View Profile
namespace question
« on: April 29, 2009, 09:35:59 AM »
0
I think I understand the use of namespaces.

I am at work with no UO Client so I can't execute my theories, but can I get some validation on this?

I have a problem with my developers when they don't use the correct scope and i don't want to bloat the global namsespace so I try to write without using %VarName.  That said, here is my scenario...

I am in a sub
sub CoolTestNameOfSubToUseForPurposeOfExample
namespace push
namsespace local SomeRandomOrStaticString

  set !ReturnVariableName MyArray
  set ! . !ReturnVariableName . 1 Value1 ; <-- i'd use an index
  set ! . !ReturnVariableName . 2 Value2 ; <-- i'd use an index

Now I want to return this to a specific namespace (to me, more along the lines of returning from a function)

  set !NSType local
  set !NSName TargetNamespace
  namespace copy !ReturnVariableName , * To !NSType !NSName

Will this return the array of !MyArray1 and !MyArray2 to a namespace called local TargetNamespace?

**love the editor

Thanks,
Paul
Give a man a fire, he'll be warm the rest of the night;
Set a man afire, he'll be warm the rest of his life.

Offline KilroyIsDeadTopic starter

  • Full Member
  • ***
  • Posts: 155
  • Activity:
    0%
  • Reputation Power: 2
  • KilroyIsDead has no influence.
  • Respect: +13
  • Referrals: 0
    • View Profile
Re: namespace question
« Reply #1 on: April 29, 2009, 12:11:04 PM »
0
My particular example here is likely re-inventing the universe as there are about 4276 examples of parsing a string.

I wrote a Split routine, because that's what I'm used to but it shows an example of calling a subroutine and wanting to return more than a scalar value but not wanting to use global name spaces.

So it looks like we can return data dynamically to the namespace.




There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
PG.Utility.String.Split.txt
Give a man a fire, he'll be warm the rest of the night;
Set a man afire, he'll be warm the rest of his life.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: namespace question
« Reply #2 on: April 29, 2009, 10:31:28 PM »
0
That's pretty good looking code.  I think you've got it.  I see you had to modify your final code from your original untested start.  I actually had to run and single step it to make sure your dot and commas were doing what you intended, but with the var dump, you didn't have anything acting strange.  Great job!
« Last Edit: April 29, 2009, 10:43:22 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: namespace question
« Reply #3 on: April 29, 2009, 11:09:33 PM »
0
TM, this thread reminded me to ask/suggest this:

Is it possible for SUO to have a section that could show the current user/namespace/persistent variables in the script similar to how EUO gives the values of all the system variables. Mainly, I just want to make sure I get my comma's and dot's correct with scripts (since I believe I'm going to start using them more now), so it would be nice to see that  "set %test * , tapsoeri . sfdvoi , adfopij . #caoisjadr" is actually the value I want (if you can't tell, I made that variable up off the top of my head lol)
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: namespace question
« Reply #4 on: April 29, 2009, 11:12:48 PM »
0
Actually, it kinda does it now.  Try this....

1) Load your script and then do Tools/Syntax Error Check
2) Select the "Var" tab

What you'll see is the beginning of what I intend to show as placed in the memory.  Right now there's some parser issues so it won't be totally correct, but as SUO proceeds, you'll be able to refer here to all your variables. 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline KilroyIsDeadTopic starter

  • Full Member
  • ***
  • Posts: 155
  • Activity:
    0%
  • Reputation Power: 2
  • KilroyIsDead has no influence.
  • Respect: +13
  • Referrals: 0
    • View Profile
Re: namespace question
« Reply #5 on: April 30, 2009, 05:18:54 AM »
0
One my thread gets hijacked I can maintain the hijacking, yes?

When you get to the point of executing through your IDE, I'm excited about that.  Can you get us a tab that is a blend between the Watch and the Var.

It appears that the watch is merely the #vars, since we can't execute I don't know what your intentions are, but could we have something along the lines of a visual studio Add Watch so that we can cherry pick the vars we want to see.

So I may want to only see #CharPosX, #CharPosY, %ImportantVar, ~L-SourceNamespace~FoorLoopCounter

Give a man a fire, he'll be warm the rest of the night;
Set a man afire, he'll be warm the rest of his life.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: namespace question
« Reply #6 on: April 30, 2009, 07:41:35 AM »
0
The watch tab will be just like you say.  There are some pretty slow controls in .NET, and one of the worst is the TreeView.  It's nearly impossible to update this control at a reasonable speed.  However, I do have a replacement that I'll be weaving into the mix, so the watch tab will become live and you'll be able to manipulate variable contents in real time at at runtime.  The watch tab will be completely customizable, and you'll be able to associate a specific debugging set with a specific script.

Otherwise, it's your thread and if you find the hijacking comfy, then roll with it.  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: