Author Topic: stange situation when I use call  (Read 2075 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
stange situation when I use call
« on: May 03, 2009, 02:12:14 PM »
0
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?
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: stange situation when I use call
« Reply #1 on: May 03, 2009, 02:19:09 PM »
0
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.
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: stange situation when I use call
« Reply #2 on: May 03, 2009, 02:34:15 PM »
0
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

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: stange situation when I use call
« Reply #3 on: May 03, 2009, 03:33:53 PM »
0
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. 
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: