ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: KilroyIsDead on May 03, 2009, 02:12:14 PM
-
I like TM's use of turning gosubs into calls; I think the hope is that eventually you just see scripts that have the master logic and not all the minutia(sp) of the subroutines.
However, when I use the call statement and step through the code the first time it encounters the call it just to the start of the script. That can't be expected. I will confess I'm using a path to hit the script. C:\uo\scripts\subs\somesublibrary.suo
Am I making some well known beginners mistake?
-
You're doing it just fine, but you are running into a bug with EUO itself.
There was a time when you could step through called scripts back in EUO v1.42. But when they pushed everyone over to the never finished 1.5, they introduced that bug.
So it makes debugging called scripts difficult. Actually, by using the called-interface, you can actually copy the subroutines into the main script, and debug everything en-mas. When you get it working, then you can replace your gosubs with calls without affecting your argument count or placement.
-
Thanks, and curse you Cheffe (j/k)
TM, I think you looked at my PG_Travel guy
Since that routine consumes libraries do you agree with this pattern
My PG_Travel_Init is really just setting constants and pulling them back to the namespace you determine
The PG_Travel_Magically requires PG_Travel_Init and the Generic Gump Open Close
When are character starts using the travel library I create a namespace attached to the char.
What I think I want to do so that I don't have to pass the path into all calls
is create another sub PG_Set_Paths and that would be in the same namespace as the PG_Travel subs.
That way the master script would look like
PG_Travl_Init (Not part of the actual travel namespace)
PG_Set_Paths (which would basically create the namespace and set the path)
PG_Travel_Method1 - This uses the same namespace but does not have to pass the path
PG_Travel_Method2 - This uses the same namespace but does not have to pass the path
-
It might be nice to keep the pertinent information about traveling within the namespace upon setup, so perhaps you can put that information in during your initialization call?
That's what I do anyhow when the rail engine so that all the necessary information needed to be used by the rail is encapsulated within that data structure.
Otherwise, I like the way you are thinking about organization.