Author Topic: TrailMyx's Master Rail Engine/Developer  (Read 155373 times)

0 Members and 3 Guests are viewing this topic.

Offline TrailMyxTopic starter

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #90 on: November 11, 2009, 12:51:53 PM »
0
Just pause the script.. ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #91 on: November 11, 2009, 01:39:08 PM »
0
Just pause the script.. ;)

That's simple enough..  :D

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #92 on: November 11, 2009, 02:52:43 PM »
0
Ok.. I'm feeling retarded!

Can I (find/kill/ect.) if nothing to find, walk to next spot in rail, then (find/kill/ect.), and repeat.

Or do I have to use the callback feature?

Below is an example of what I'm trying to do.
I have the script working with normal rails, and it works perfectly.
I'm wanting to use your rail engine with it to learn ect, but I'm stuck.
It will run the rail for a while, and then it goes nuts! It says character
can't reach waypoint 35, when I'm at waypoint 10..

I hadn't tried to callback feature yet, because (find/kill/walk) is only a small part of the script.
Using callbacks for the rest would be alot of rewriting!

Code: [Select]
set %railsubs tool_railengine30l.txt
set %rail_label  dungeons
set %rail1 despise_L1.txt
set %rail2 shame_L1.txt
set %rails 2
gosub SetupRailServer

call %railsubs TM_SelectRail DespiseL1
set %direction FW
;===================================================================
Loop:
finditem G_8
if #findcnt = 0
{
   gosub walk
   goto loop  
}
if #finddist > 1
{
   event pathfind #findx #findy #findz
   goto loop
}
attack/kill/ect.
goto loop
;===================================================================
sub walk
call %railsubs TM_DetermineCurrentRailWaypoints
set %end #result
call %railsubs TM_GotoClosestWaypoint ;If I follow a group of mobs away from last waypoint
call %railsubs TM_DetermineCurrentWaypointIndex
set %spot #result
set %spot %spot + 2 ;If I use +1, it will not move.. +2 will move for a while..
call %railsubs TM_DetermineCurrentRailName
set %railname #result
call %railsubs TM_RunRail %railname Present %spot %direction
return
;===================================================================
sub SetupRailServer
call %railsubs TM_ServerInitialize
for %i 1 %rails
{
    call %railsubs TM_LoadRail %rail . %i
    if #RESULT = #TRUE
    {
       display ok Error loading , #SPC , %rail . %i
       stop
    }
}
call %railsubs TM_GetServerMode ; SERVER, SUBROUTINE, or *blank*
if #RESULT <> SERVER
{
   display ok Namespace is initialized, but server is not running. Please restart server.
   stop
}
return
« Last Edit: November 11, 2009, 02:56:16 PM by gen2000 »

Offline TrailMyxTopic starter

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #93 on: November 11, 2009, 03:35:15 PM »
0
You should definitely use the server mode.  I'm at work right now and can't really play too much.  I'll check out your snippet when I get home later on this evening.

Did you find the server mode sample code?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #94 on: November 11, 2009, 03:53:51 PM »
0
You should definitely use the server mode.  I'm at work right now and can't really play too much.  I'll check out your snippet when I get home later on this evening.

Did you find the server mode sample code?

I'm running in server mode.
I'm trying to implement your RE into my Halloween Quester, but I think I may have to just rebuild it from scratch using some callbacks.
or wait for another project, only a few days left!


Offline TrailMyxTopic starter

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #95 on: November 11, 2009, 04:02:28 PM »
0
I have some other sample code I can PM you.  Still at work however...

Callbacks might work as well, but can be hard to debug.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #96 on: November 11, 2009, 06:32:00 PM »
0
I have some other sample code I can PM you.  Still at work however...

Callbacks might work as well, but can be hard to debug.

some samples to look at should be a great help!

I finally realized when you call the rail, it will start the rail and return, so the script can monitor or do other things while the rail is running.
So I decided to try and use TM_SetPresentServerCommand Stop so the rail would stop when it found something along the rail I was looking for, but when I tried to restart the rail using TM_GotoClosestWaypoint and then present to end, it wouldn't stop anymore, and run to the end of the rail.


I'm totally lost..  :-[

Thanks for the help!

Scrripty

  • Guest
Re: TrailMyx's Master Rail Engine/Developer
« Reply #97 on: November 11, 2009, 06:53:10 PM »
0
I have some other sample code I can PM you.  Still at work however...

Callbacks might work as well, but can be hard to debug.

some samples to look at should be a great help!

I finally realized when you call the rail, it will start the rail and return, so the script can monitor or do other things while the rail is running.
So I decided to try and use TM_SetPresentServerCommand Stop so the rail would stop when it found something along the rail I was looking for, but when I tried to restart the rail using TM_GotoClosestWaypoint and then present to end, it wouldn't stop anymore, and run to the end of the rail.


I'm totally lost..  :-[

Thanks for the help!


Yea I've been wanting to use a powerfull rail engine too, but TM thinks his scripts are self explanatory! :)  hehe  I'd love to use this also...

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #98 on: November 11, 2009, 07:42:19 PM »
0
LOL! well this is basicly what my script does.. and works perfectly..

Code: [Select]
gosub rail
set %spot 1

loop:
finditem %enemyid g_8
if #findcnt = 0
{
   gosub walk
   goto loop
}
kill/loot/ect.
goto loop

sub walk
set %x %x . %spot
set %y %y . %spot
set %z %z . %spot
set %jindex #jIndex + 1
set %wait #SCNT + 2
event pathfind %x %y %z
wait 10
repeat
scanjournal %jindex
if get_there in #journal
{
   GOSUB FindClosestSpotInRailArray %endspot
   set %spot !result
   set %x %x . %spot
   set %y %y . %spot
   set %z %z . %spot
   move %x %y 3
   return
}
set %jindex %jindex + 1
if N/A in #journal
   set %jindex %jindex - 1
until #charposx = %x && #charposy = %y || %wait < #scnt
set %spot %spot + 1
if %spot => %endspot
{
   set %spot 1
}
return

SUB FindClosestSpotInRailArray
SET !result 1
FOR %i 1 %1
{
    SET !x % . x . %i ;updated
    SET !y % . y . %i ;updated
    SET !xd ABS ( #CHARPOSX - !x )
    SET !yd ABS ( #CHARPOSY - !y )
    SET !dist !yd
    IF !xd > !yd
       SET !dist !xd
    IF %i = 1
       SET !lowdist !dist
    IF !dist < !lowdist
    {
       SET !lowdist !dist
           SET !result %i
    }
}
RETURN !result

sub rail
;1st lvl despise
set %endspot 89
set %X1 5485
set %Y1 569
set %Z1 60
set %X2 5485
set %Y2 564
set %Z2 60
set %X3 5485
set %Y3 558
set %Z3 60
set %X4 5485
set %Y4 553
set %Z4 60
set %X5 5488
set %Y5 548
set %Z5 60
set %X6 5495
set %Y6 547
set %Z6 60
set %X7 5501
set %Y7 543
set %Z7 60
set %X8 5501
set %Y8 535
set %Z8 60
set %X9 5501
set %Y9 542
set %Z9 60
set %X10 5494
set %Y10 546
set %Z10 60
set %X11 5488
set %Y11 547
set %Z11 60
set %X12 5482
set %Y12 546
set %Z12 60
set %X13 5475
set %Y13 545
set %Z13 60
set %X14 5469
set %Y14 545
set %Z14 60
set %X15 5469
set %Y15 538
set %Z15 58
set %X16 5469
set %Y16 531
set %Z16 60
set %X17 5467
set %Y17 525
set %Z17 60
set %X18 5459
set %Y18 522
set %Z18 60
set %X19 5452
set %Y19 526
set %Z19 61
set %X20 5452
set %Y20 533
set %Z20 60
set %X21 5452
set %Y21 542
set %Z21 60
set %X22 5444
set %Y22 546
set %Z22 60
set %X23 5437
set %Y23 546
set %Z23 60
set %X24 5435
set %Y24 539
set %Z24 60
set %X25 5434
set %Y25 533
set %Z25 60
set %X26 5428
set %Y26 531
set %Z26 60
set %X27 5420
set %Y27 531
set %Z27 60
set %X28 5414
set %Y28 531
set %Z28 60
set %X29 5411
set %Y29 539
set %Z29 60
set %X30 5411
set %Y30 547
set %Z30 60
set %X31 5411
set %Y31 554
set %Z31 60
set %X32 5411
set %Y32 560
set %Z32 59
set %X33 5411
set %Y33 567
set %Z33 60
set %X34 5405
set %Y34 571
set %Z34 61
set %X35 5404
set %Y35 577
set %Z35 62
set %X36 5404
set %Y36 582
set %Z36 45
set %X37 5411
set %Y37 591
set %Z37 45
set %X38 5411
set %Y38 598
set %Z38 45
set %X39 5412
set %Y39 607
set %Z39 45
set %X40 5410
set %Y40 616
set %Z40 42
set %X41 5410
set %Y41 620
set %Z41 30
set %X42 5409
set %Y42 625
set %Z42 30
set %X43 5401
set %Y43 627
set %Z43 29
set %X44 5395
set %Y44 627
set %Z44 29
set %X45 5386
set %Y45 620
set %Z45 30
set %X46 5389
set %Y46 625
set %Z46 30
set %X47 5396
set %Y47 631
set %Z47 32
set %X48 5404
set %Y48 627
set %Z48 29
set %X49 5411
set %Y49 623
set %Z49 30
set %X50 5417
set %Y50 623
set %Z50 31
set %X51 5424
set %Y51 622
set %Z51 30
set %X52 5431
set %Y52 626
set %Z52 30
set %X53 5438
set %Y53 626
set %Z53 30
set %X54 5444
set %Y54 621
set %Z54 30
set %X55 5444
set %Y55 613
set %Z55 45
set %X56 5442
set %Y56 605
set %Z56 45
set %X57 5433
set %Y57 602
set %Z57 44
set %X58 5430
set %Y58 597
set %Z58 49
set %X59 5430
set %Y59 590
set %Z59 45
set %X60 5437
set %Y60 589
set %Z60 45
set %X61 5443
set %Y61 580
set %Z61 56
set %X62 5444
set %Y62 578
set %Z62 60
set %X63 5450
set %Y63 578
set %Z63 60
set %X64 5456
set %Y64 578
set %Z64 60
set %X65 5462
set %Y65 578
set %Z65 60
set %X66 5467
set %Y66 573
set %Z66 60
set %X67 5462
set %Y67 565
set %Z67 60
set %X68 5456
set %Y68 565
set %Z68 64
set %X69 5451
set %Y69 560
set %Z69 60
set %X70 5451
set %Y70 553
set %Z70 60
set %X71 5457
set %Y71 547
set %Z71 60
set %X72 5463
set %Y72 547
set %Z72 60
set %X73 5469
set %Y73 545
set %Z73 60
set %X74 5476
set %Y74 545
set %Z74 60
set %X75 5482
set %Y75 550
set %Z75 60
set %X76 5484
set %Y76 557
set %Z76 60
set %X77 5484
set %Y77 565
set %Z77 60
set %X78 5486
set %Y78 573
set %Z78 60
set %X79 5484
set %Y79 580
set %Z79 45
set %X80 5484
set %Y80 588
set %Z80 48
set %X81 5487
set %Y81 594
set %Z81 47
set %X82 5495
set %Y82 596
set %Z82 47
set %X83 5501
set %Y83 596
set %Z83 45
set %X84 5494
set %Y84 594
set %Z84 45
set %X85 5489
set %Y85 594
set %Z85 46
set %X86 5484
set %Y86 589
set %Z86 48
set %X87 5484
set %Y87 581
set %Z87 45
set %X88 5484
set %Y88 576
set %Z88 60
set %X89 5484
set %Y89 571
set %Z89 60
return

I hadn't figured out how to implement TM's RE, but I'm getting closer! I hope I can figure it out, I love it!!

Offline TrailMyxTopic starter

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #99 on: November 11, 2009, 09:41:29 PM »
0
Don't forget this little snippet to restart a rail that you stopped:

Code: [Select]
    call %railsubs TM_GotoClosestGlobalWaypoint
    repeat
      call %railsubs TM_GetStatus
    until #RESULT = IDLE
    wait 5
    call %railsubs TM_DetermineCurrentRailIndex
    call %railsubs TM_GetRailNameForIndex #RESULT
    set %temprail #RESULT
    call %railsubs TM_DetermineCurrentWaypointIndex
    set %temp #RESULT + 1
    call %railsubs TM_RunRail %temprail %temp END FW  ; finish running this rail from the present position to the end

You have to wait until the action is done before you restart and continue.

Still need to track down some sample code that doesn't give away too many secrets of the strange game-breaking things I have implemented.  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #100 on: November 11, 2009, 10:11:31 PM »
0
Don't forget this little snippet to restart a rail that you stopped:

Code: [Select]
    call %railsubs TM_GotoClosestGlobalWaypoint
    repeat
      call %railsubs TM_GetStatus
    until #RESULT = IDLE
    wait 5
    call %railsubs TM_DetermineCurrentRailIndex
    call %railsubs TM_GetRailNameForIndex #RESULT
    set %temprail #RESULT
    call %railsubs TM_DetermineCurrentWaypointIndex
    set %temp #RESULT + 1
    call %railsubs TM_RunRail %temprail %temp END FW  ; finish running this rail from the present position to the end

You have to wait until the action is done before you restart and continue.

Still need to track down some sample code that doesn't give away too many secrets of the strange game-breaking things I have implemented.  ;)

Give it away! ha! I've yet to find anything game-breaking, unless you mean overpowered.. and I've got a few scripts that I would put in that section..

I'll give that snipplet a try. thanks  ;)

Offline gen2000

  • Full Member
  • ***
  • Posts: 123
  • Activity:
    0%
  • Reputation Power: 0
  • gen2000 has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: TrailMyx's Master Rail Engine/Developer
« Reply #101 on: November 12, 2009, 12:10:50 AM »
0
Just pause the script.. ;)

I got it to stop and start recording the rail from the last waypoint by changing one line!!
You can even load a saved rail, walk to the end or anywhere, hit record and start recording more!

changed this..

Code: [Select]
mainloop1:
  if #MENUBUTTON = EUOButton1   ; start recording
  {
    set #MENUBUTTON N/A
    set %main_index 0

to this..

Code: [Select]
mainloop1:
  if #MENUBUTTON = EUOButton1   ; start recording
  {
    set #MENUBUTTON N/A
    set %main_index %main_index - 1
Made a world of difference for me! and that snipplet worked! Thanks for the help.  ;)


Offline TrailMyxTopic starter

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #102 on: November 12, 2009, 12:28:10 AM »
0
Oh yeh, the rail engine remembers the last waypoint it was at.  But since there's no real "continue", you have to query the last location and start from it or around close to the last location.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Superslayer

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #103 on: November 12, 2009, 05:53:13 PM »
0
For the parts where I break off my rails in my World Idoc Traveler script, I simply record where my character is and assign a variable to the xy location. Then go and do stuff, then just 'move' or 'pathfind' to the  recorded xy position and run the rail from there. Something along the lines of this:
Code: [Select]
sub DoOtherThingsOffRail
call %railsubs TM_SetPresentServerCommand STOP
set %returnX #charposX
set %returnY #charposY
; go do stuff
move %returnX %returnY 2 ; or pathfind
call %railsubs TM_RunRail railname present end direction
return

Not exactly like I have it in my WIT script, but you get the idea.  Before I decide on where I stop the rail, I use one of two methods on how I'll stop it. I'll either monitor the character xy position, or check the current waypoint the character is at.  I haven't implemented the 'Gotoclosestglobalwaypoint', but if you know where you are, and where you want to go to, there's really no need for it.

Using callback are tricky indeed as TrailMyx described, but to start out, I'd recommend using them in strict moderation. I use it atm only once while truly running a rail, and all I have it do is open a set of doors. It's still not as smooth as I'd like, but those plans for tightening all the rails in my WIT script are a little ways away yet.

Please, if anyone here needs any extra ideas or examples, give me a hollar !
And ty TrailMyx once again for this incredible tool, without it, my WIT script wouldn't exist.

Offline Superslayer

  • 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: TrailMyx's Master Rail Engine/Developer
« Reply #104 on: November 16, 2009, 04:13:02 PM »
0
Found a use for the Delay feature.  It's proven very helpful when crossing server-lines.  Seems that the RE will continue to fire when crossing a server line and confuse itself in thinking that the location was not met, resulting in an error. So at the moment, I use a 1 second delay both before and after one index movement of the line so that the RE can see that I did make it to the location.  Sometimes the server lines really lag out a player, especially if there's alot of stuff around.  I'm not sure yet what to do if the lag takes more than one second... :(