Author Topic: Running two scripts in one EasyUo instance [SOLVED]  (Read 2979 times)

0 Members and 1 Guest are viewing this topic.

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Running two scripts in one EasyUo instance [SOLVED]
« on: March 22, 2009, 01:54:26 PM »
0
I have my 'Main' world traveler script 99.9% done (will post shortly, need help with some wait's and gump timeouts and movements). For general testing and function, when I run the main, and a tabbed script also running, checking if certain actions happen, or menu buttons pressed, should those be namespace global variables? For instance, as my script moves the char, should I press the pause button, will the tabbed script see that it was pressed? If so, how will it pause my characters movement? I do plan on using TM's rail server, but before I do, I want to understand what's happening, and how to prevent my script from breaking and such.
« Last Edit: June 24, 2009, 11:25:37 AM by TrailMyx »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: Running two scripts in one EasyUo instance
« Reply #1 on: March 22, 2009, 02:17:50 PM »
0
Should definitely be namespace variables.  With my rail engine, I have "commands" that you send to the engine running in the tab to tell it to stop moving.  That's already built into the engine, but anytime you are letting one tab rely on another, you have to develop a way for the two scripts to communication between one another.

I can post some sample code from one of my scripts that use the server, so you can see the interaction.  But basically, you start the rail, then send a "stop" and "resume" command.  It's pretty simple really.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Running two scripts in one EasyUo instance
« Reply #2 on: March 22, 2009, 02:26:26 PM »
0
That'd be great TM, ty.  I did happen to remember a post of mine regarding the server rail engine and saying something like "I'll have to do other things first, then come back to this part..."  well, it's time.  Also, will there be any differences in the way SUO will handle calling scripts and multiple running scripts in a tabbed environment?  Just want to be prepared for when you release a running version.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: Running two scripts in one EasyUo instance
« Reply #3 on: March 22, 2009, 02:32:40 PM »
0
Lol, well I think aliens just might take over the Earth before I ever finish the run-mode of SUO.  But I will still adhere to the core of EasyUO since that's what everyone is used to.  If I do anything different it will become part of the superset.

Here's a few useful snippets (from my Unicorn Tamer):

Stopping a rail that's running in the rail engine:
Code: [Select]
; ---------------------------------------------------------------------------
sub StopCurrentRail
  call %railsubs TM_SetPresentServerCommand STOP
  repeat
    call %railsubs TM_GetStatus
  until #RESULT = IDLE || #RESULT = N/A
return

Starting a rail by name.
Code: [Select]
    call %railsubs TM_SelectRail %railname
    call %railsubs TM_DetermineRailWaypoints %railname
    set #RESULT #RESULT - 1
    call %railsubs TM_RunRail %railname 0 #RESULT BW  ; finish running this rail from the present position to the end

Continuing a rail that was interrupted:
Code: [Select]
sub ContinueCurrentRail
  call %railsubs TM_GotoClosestGlobalWaypoint
  repeat
    call %railsubs TM_GetStatus
  until #RESULT <> RUNNING
  call %railsubs TM_DetermineCurrentRailIndex
  call %railsubs TM_GetRailNameForIndex #RESULT
  call %railsubs TM_RunRail #RESULT PRESENT END %rail_direction
return

Monitoring a rail and doing something while you do:
Code: [Select]
; ---------------------------------------------------------------------------
sub MonitorRail
  call %railsubs TM_GetStatus
  if #RESULT = ERROR
  {
    display ok Fatal rail error occurred, stoping script.
    stop
  }
return #RESULT
; ---------------------------------------------------------------------------
sub Spirituality_MODE_SCAN_CONTINUE
  menu set EUOStatus Scanning for tames.
  gosub MonitorRail
  if #RESULT = IDLE
  {
    set !mode_request MODE_GATE
    set %change_rail #TRUE
  }
  else
  {
    gosub ScanForTame %tame_kind
    gosub CheckForEnemy
  }
  set !machine_sub_called #TRUE
return
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Running two scripts in one EasyUo instance
« Reply #4 on: March 22, 2009, 02:37:09 PM »
0
This look great   ! thanks !

Tags: