ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Script development tools => Topic started by: TrailMyx on June 09, 2008, 12:09:26 PM

Title: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2008, 12:09:26 PM
Code: [Select]
;-----------------------------------------------------------
; Script Name: TrailMyx's Master Rail Developer
; Authors: TrailMyx
; Version: 0.55a
; Client Tested with: 6.0.3.1
; EUO version tested with: 1.5 127
; Shard: OSI, FS
; Revision Date:  10/1/2007
; Public Release: ...
; Global Variables Used: None
; Purpose: Records and plays back rails.  Saves them to files.
;-----------------------------------------------------------

Code: [Select]
;-----------------------------------------------------------
; Script Name: TrailMyx's Master Rail Engine Subs
; Authors: TrailMyx
; Version: 0.30k
; Client Tested with: 6.0.3.1
; EUO version tested with: 1.5 127
; Shard: OSI, FS(Alexandria[RunUO])
; Revision Date:  9/28/2007
; Public Release: ...
; Global Variables Used: None
; Purpose: Plays rails recorded by TrailMyx's Master Rail Generator.
;   Allows user to have multiple rails loaded into memory and includes many
;  support functions to help automate rail-enabled script development.
;-----------------------------------------------------------
;  Functions:
;  call %railsubs TM_Initialize ; Initializes rail engine namespace to SUBROUTINE mode
;  call %railsubs TM_Close ; clears namespaces use for rail engine.
;  call %railsubs TM_LoadRail c:\rail1.txt
;  call %railsubs TM_RunRail RAIL1 PRESENT END FW
;                            RAIL1 0 5 BW
;  call %railsubs TM_SelectRail RAIL1  ; can select by either rail NAME or rail INDEX
;  call %railsubs TM_RailsLoaded  ; returns number of rails presently in memory
;  call %railsubs TM_DetermineCurrentRail ; returns index of rail presently selected
;  call %railsubs TM_DetermineCurrentRailName  ; return rail NAME of presently selected rail
;  call %railsubs TM_DetermineCurrentWaypointIndex ; returns current waypoint index for present rail
;  call %railsubs TM_GetRailNameForIndex 0  ; return rail NAME of index 0.
;  call %railsubs TM_DetermineCurrentRailWaypoints ; returns number of waypoints for presently selected rail
;  call %railsubs TM_DetermineRailWaypoints 3 ; determines number of waypoints for rail index/name 3
;  call %railsubs TM_GotoClosestRailIndexedWaypoint ; proceeds to the closest waypoint of selectable rail
;  call %railsubs TM_GotoClosestWaypoint ; proceeds to the closest waypoint of present rail
;  call %railsubs TM_GotoClosestGlobalWaypoint ; searches all rails in memory to find the closest waypoint.
;  call %railsubs TM_Push  ; pushes present waypoint and rail onto stack
;  call %railsubs TM_Pop   ; recalls last pushed waypoint and rail, sets rail and present_index of waypoint
;  call %railsubs TM_ServerInitialize ; initializes global namespace and puts rail engine into SERVER mode.
;  call %railsubs TM_GetStatus ; returns rail engine server status --> IDLE, RUNNING, ERROR
;  call %railsubs TM_GetServerMode ; returns configured server mode --> SERVER, SUBROUTINE
;  call %railsubs TM_PingServer ; returns PING if server doesn't respond, PONG if server is available.
;  call %railsubs TM_GetPresentServerCommand ; this is the present command the server is processing
;  call %railsubs TM_SetPresentServerCommand ; Used to issue STOP command, halting rail
;  call %railsubs TM_PercentWaypointRun ; -1, defined by rail, 0- walk all the time, 100 - run all the time.
;  call %railsubs TM_ShowDebug
;  call %railsubs TM_HideDebug
;
; Do not re-produce these subroutines without the express permission from the author, TrailMyx.   email: trailmyx@yahoo.com
;


(http://img120.imageshack.us/img120/5039/raildeveloper1yy2.jpg) (http://imageshack.us)

Finally, I'm getting around to releasing this to you.  I've been busy using this system in a couple projects, so I've had some time to do some deep testing with it.  

This release comes in 4 parts:
1) Rail Developer/Creator
2) Rail Engine
3) Rail Converter (converts CEO and Roadkill formats to TM_RE)
4) PDF document  (very rough first-pass, will be amended as more time presents itself)

I may attach some more sample code as time goes on, or post more examples.

Here's a quick summary of the capabilities of this rail system:

           a)SERVER mode allows scripts to run in NON-BLOCKING mode so they don't have to wait while the engine completes a rail command.
           b)SUBROUTINE mode runs each of the rail subroutines directly, but script execution is blocked until the rail finishs/fails.
Getting started:

This couldn't be easier.  Start the rail developer, stand where you want to start end press "Start Record" button.  Then just walk.  When you want to end recording, press the "Stop Record".  Enter the filename you'd like to save to and a unique label; the engine uses this label to reference your rail in memory.  Then press "Save"  You're done!  Of course you can step through your rail or run it from the developer, it's your choice.

Now, if you'd like to have the rail engine test your script, enter your rail filename and label into the following simple code and run it.  Yes, it's that easy.

Code: [Select]
set %railsubs tool_railengine30f.txt
set %rail_filename railfile.txt
set %rail_label  RAIL_LABEL1

call %railsubs TM_Initialize  

call %railsubs TM_LoadRail %rail_filename

if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}
set #LPC 1000

call %railsubs TM_RunRail %rail_label 0 END FW  
if #RESULT = #TRUE
{
  display ok Rail error occurred.
}

call %railsubs TM_Close
stop



Notes:
Release History
Engine:
Version 0.30k - 4/14/2007 Current release

Developer/Creator:
Version 0.55a - 4/14/2007 Current release

Converter:
Un-versioned release - will begin version number with next release.  Will also include a header. 4/14/2007

PDF document
Revision 2 4/14/2007

Scripts using this Engine
PM me if you use this and would like me to add your script to this list!




Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 11, 2008, 06:05:31 PM
Can i only record from the points i am at or is it possible to type the cordinates in and save it that way?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 11, 2008, 06:08:23 PM
With this version, you can only update a waypoint where you might be standing.  I think somewhere I made a version of the rail editor that you could tweak the coordinates.  Not sure what I did with that version, however.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 11, 2008, 06:15:14 PM
Give version 55b a whirl.  There's a "Manual Update" button on that one so you can select a waypoint and then manually adjust the X/Y/Z coords.

I know what you are trying to do, but you are going to find that you will no longer be able to use the same rail going forward as you do going backward.  That's the nice thing about the quester is that you only need one rail to run into and out of heartwood. 
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 11, 2008, 06:18:21 PM
i made the rail work for going in.  but on the way back i can get it to enter the portal again
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 11, 2008, 06:35:01 PM
How did you make it work frontwards and backwards?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 11, 2008, 07:25:13 PM
Hmm, not sure I can explain it.

You'll notice there's a "Insert NamedKind" button.  This is to allow you to move toward something with a specific name.  If you get the information for the #FINDID of the "sparkle" for the gate, you'll notice it has a name associated with it (On OSI it does).  Since this name is the same on both sides of the portal, you can use this to move in and out of heartwood.

So you need to isolate the waypoint that transitions you into heartwood, make that function "Move to Named Type" and change the label of that waypoint to the text found in #PROPERTY of the sparkle (on OSI this is VQV_Portal).  If there is no text, then it'll be impossible the way the quester is currently written.  You'll have to re-write it so that you have a rail going into and then out of heartwood.  It's doable, perhaps something you can tackle.

Unfortunately, this was already covered back on uocoders; I had a nice tutorial about how to created heartwood rails.  Too bad that was some of the information that was lost; I just don't have the time to create something like that again.  I shouldn't even be messing with this for freeshards since we don't support it.  I do wish you luck figuring it out.

I did spend a lot of time putting together the PDF file that explains the engine and the creator, and some of this is covered in there, so you should probably read that closely.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 17, 2008, 03:34:57 PM
i made a new rail and it works great but when i tell it to save it says it does but it doesn't.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 17, 2008, 03:40:47 PM
check your path.  If you have "c:\railname.txt" then it'll be off your main c: since you are using XP.  If you tell it "railname.txt", then the rail will be in the same directory as your easyuo.exe file.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 17, 2008, 04:03:37 PM
i made a new rail (for Quester) renamed it hw_trinket and when it gets to the point of loading it it just tells me rail error
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 17, 2008, 04:07:25 PM
you need to be sure to name your file "hw_trinket.txt"  It doesn't automatically default to adding the extension.

Also, what was the label you gave your new rail?  You need to know this too.  If you want it to work correctly, you should copy this information from the old rail.  i.e. same filename and same label.

Please refer to page 4 of the HowTo PDF guide; it's all explained there.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: xxcaptainxx on August 17, 2008, 04:10:55 PM
ahh the label may be the problem let me give that a shot
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 17, 2008, 04:38:48 PM
ahh the label may be the problem let me give that a shot

Yeh, the label name is hard-wired into the script; it's how the script can manage more than one rail.  Heck, with my rail system, you can have 100s of rails in memory simultaneously.  Generally, the label defaults to "LABEL1".
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on December 04, 2008, 05:48:23 AM
Please leave any feedback regarding the rail engine and developer here.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on December 04, 2008, 06:45:44 AM
Hi TrailMyx. I just took about an hour or so to run through your rail engine and am finding it very cool, and as always, loaded with excellent options.  One question so far though, when I read the rail text that I saved, I'm presented with text that I don't have in WinXP and can only assume it's something I need loaded.  Here's the an example:

Code: [Select]
set %fileout0 Around_House31710127413070?0TrailMyxCB001112
7813070?0TrailMyxCB0012128213060?0TrailMyxCB0013128413020?0T
railMyxCB0014128512980?0TrailMyxCB00151285
12940?0TrailMyxCB0016128312900?0TrailMyxCB0017127912880?0T
railMyxCB0018127512880?0TrailMyxCB00191271
12880?0TrailMyxCB00110126712880?0TrailMyxCB00111126312880?0
TrailMyxCB00112126112920?0TrailMyxCB001131261
12960?0TrailMyxCB00114126213000?0TrailMyxCB00115126513040
?0TrailMyxCB00116127013060?0TrailMyxCB00117127313053?0TrailMyxCB00
 set %callbackfunctions c:\callbacks.txt

I copied and pasted from the file to here.  If you could shed a little light on what is needed to view this that'd be a great help.  Again, great rail engine here, and I will continue to work with this and reply with any info that'd be useful.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on December 04, 2008, 09:43:49 AM
Take a look at the PDF document.  Toward the end of the document is some sample code you can use to "play" the recorded script.  My code isn't just a rail generator, but a rail engine so it will also play the resulting rail.

Here's some example code (Will run rail forwards and backwards):

Code: [Select]
set %railsubs tool_railengine30k.txt
call %railsubs TM_Initialize

set %railfilename c:\railfilename.txt
set %railname RAIL1

call %railsubs TM_LoadRail %railfilename
if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}

set #LPC 100
loop1:
  call %railsubs TM_RunRail %railname 0 END FW  ; finish running this rail from the present position to the end
  if #RESULT = #TRUE
  {
    display ok Rail error occurred.
  }
  call %railsubs TM_RunRail %railname 0 END BW  ; finish running this rail from the present position to the end
  if #RESULT = #TRUE
  {
    display ok Rail error occurred.
  }
  goto loop1

call %railsubs TM_Close
stop

Judging from your railfile, it looks like you named your rail "Around_House3".
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on December 04, 2008, 12:07:20 PM
The example code works great, and I've read the PDF in whole, very helpful in understanding all the tools and buttons to the scripts, but perhaps I wasn't very clear.  When I use the TM_RD and save the filename and label, I like to look at the saved file in the default save location, c:\.  Then using either notepad or getdiz, have a look at what was written, what is being read, and what changes are applied when I save the same rail and group label but with a different option enabled/disabled, i.e. 'use event pathfind'.  I do have a reason to my madness  :o  , and it'd be helpful to be able to read for myself what was saved.  Easily enough though, I can read the X Y coordinates in the saved file, but the symbols pre and post those points are what's causing my dilemma.

Although I have been a little thick headed over things  :-\ in the past with things, am I way off base here as well and what you are saying is indeed what I'm looking for?  Or is it something probably not possible?  Thanks in advance TM, much appreciated.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on December 04, 2008, 12:19:10 PM
The example code works great, and I've read the PDF in whole, very helpful in understanding all the tools and buttons to the scripts, but perhaps I wasn't very clear.  When I use the TM_RD and save the filename and label, I like to look at the saved file in the default save location, c:\.  Then using either notepad or getdiz, have a look at what was written, what is being read, and what changes are applied when I save the same rail and group label but with a different option enabled/disabled, i.e. 'use event pathfind'.  I do have a reason to my madness  :o  , and it'd be helpful to be able to read for myself what was saved.  Easily enough though, I can read the X Y coordinates in the saved file, but the symbols pre and post those points are what's causing my dilemma.

Although I have been a little thick headed over things  :-\ in the past with things, am I way off base here as well and what you are saying is indeed what I'm looking for?  Or is it something probably not possible?  Thanks in advance TM, much appreciated.


I think what you are asking is not possible if I understand your request correctly.  The data file is "compressed" in the sense that lots of waypoints are put onto a single line so that it doesn't take FOREVER to save it.  I always meant for the user to use the rail developer to load the rail to tweak it, and not have someone tweak it with notepad, et. al. You might try a different editor; one that displays whitespace as a character.

It would be rather simple to write a sub to display all the waypoints, but if you want to save it in another format like CEO, or Roadkill you have to save line-by-line.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on December 04, 2008, 12:52:12 PM
I had tried that with ceo, and his movements were rather robotic and choppy.  The save took forever too, I had a rail to check the locations of arties in doom and so recorded a rail walking to about 10-12 of the locations...it took forever.  But just as I had thought, it'll either be a fun sub for me to learn and write, or just not possible the way you have it set up.  All in all, I'm infinitely thankful for all you do here, and very grateful for your quick responses.  This script of mine has so many elements, I'll have to come back to this part and do some other stuff.  Thanks again TM  ;D
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on December 04, 2008, 01:09:58 PM
I had tried that with ceo, and his movements were rather robotic and choppy.  The save took forever too, I had a rail to check the locations of arties in doom and so recorded a rail walking to about 10-12 of the locations...it took forever.  But just as I had thought, it'll either be a fun sub for me to learn and write, or just not possible the way you have it set up.  All in all, I'm infinitely thankful for all you do here, and very grateful for your quick responses.  This script of mine has so many elements, I'll have to come back to this part and do some other stuff.  Thanks again TM  ;D
Well you're welcome.  I love running this place and get jazzed when people use my stuff.  ;)

You might think about using the developer to "tweak" things instead of doing it by hand.  Since you can insert/delete waypoints, and actually "nudge" existing waypoints, you might find that using the developer might actually be easier than doing it by hand.  It's just a different way to do it.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: bliss on February 18, 2009, 09:44:52 PM
hey tm this rail engine works great i just have 1 problem when it comes to portals. when i run the rail forward it runs fine when it goes back is when i hit a snag it will stop befor it goes back through portal and says it cant find the next spot . i looked through your rail for heartwood and it looks identical at that point im not sure what im doing wrong but i just cant seem to get it to work
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 18, 2009, 09:56:34 PM
You must be talking about portals to heartwood.... :)

The problem with portals to hearwood is that the name for the portals is different when you are going into heartwood than when you are leaving.

The best I can tell you is to look at the first couple of waypoints in existing the heartwood quest rails.  Also, take a look at page 7 of the PDF since that page pretty much explains the way you need to format the Label of the heartwood portal.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: NObama on April 26, 2009, 06:52:45 AM
I'm trying desperately to understand how to make a rail and incorporate it into my own script.  However, I'm having some rookie problems:

1) When recording the rail, I am unable to find the file I've just created.  I've scanned my entire harddrive and it's just not there after I click save.  It should be noted that I can play the rail once, either forward or backward, inside the rail creator...ONCE.  Afterwards, if I try to play it again in either direction I get nothing.  For the record, I've tried saving to "C:\gatetocave.txt" and "gatetocave.txt".  I'm running vista.

2) When attempting to use the sample test code, I make the first three lines read thusly:

set %railsubs tool_railengine30f.txt
set %rail_filename gatetocave.txt
set %rail_label  TEST

When I play the test code, nada.

Any thoughts?  This is an incredibly powerful tool, but my kung fu is not strong.

Cheers!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Cerveza on April 26, 2009, 07:45:01 AM
I'm running vista.

Any thoughts?  This is an incredibly powerful tool, but my kung fu is not strong.

Cheers!
I think thats the problem right there. TM can tell you how to tame the Vista.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on April 26, 2009, 09:18:57 AM
With Vista you definitely don't want to save a script to c:\.

So if you just save the a file, it should save to the same directory as your EUOX.exe.  Also be sure to run EUOX.exe as administrator. 

Finally, I've found that if you try and run EUOX.exe from a network share drive in Vista/Win7, strange things can happen.

Honestly, I haven't run the rail developer yet under Vista, and I'm only using Win7 right now.  I might give it a whirl later tonight.  In the mean time, post up your modified test code so I can be sure that's ok.  I've posted some bogus test code in the past, so I want to be sure I have steered you in a strange direction.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: NObama on May 02, 2009, 08:04:57 PM
Code: [Select]
set %railsubs tool_railengine30f.txt
set %rail_filename gatetocave.txt
set %rail_label  TEST

call %railsubs TM_Initialize 

call %railsubs TM_LoadRail %rail_filename

if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}
set #LPC 1000

call %railsubs TM_RunRail %rail_label 0 END FW 
if #RESULT = #TRUE
{
  display ok Rail error occurred.
}

call %railsubs TM_Close
stop


This is what I'm using to test.

I appreciate all the help.  I'm sort of thinking it's a Vista thing...

Cheers-
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on May 02, 2009, 09:19:19 PM
So are you getting an error like "Rail not found" or "Rail error occurred"  Or is just nothing happening?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on May 03, 2009, 03:44:15 PM
One thing I notice quickly is that you are referencing a very old version of the rail engine (probably from the example).  You need to be sure you change the %railsubs variable to be tool_railengine30k.txt or match whatever engine version you have.

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: NObama on May 04, 2009, 06:46:04 AM
*smacks forehead*  Let me go check that...

EDIT: working now.  Made the requisite changes - damn, TM, this is a powerful tool.

In testing, more as events warrant.

=D

Post Merge: May 04, 2009, 02:09:47 PM
Working Beautifully.  Thanks much!

 :D
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on May 04, 2009, 06:19:18 PM
Glad you got it working.

Yeh, with all the other rail scripts out there, I figured it would be good to have something with some cool features and flawless performance.  If you look at all the subs I wrote for it, you'll see just how interesting you can make your scripts.

This debuted in the heartwood quester.  With these subs, the quester transformed into a nearly support-free script.  Before that, railing was an uber headache in timing, setup, etc.  I love when something comes together!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: KilroyIsDead on June 09, 2009, 01:35:06 PM
ok, I'm gonna use this rail engine for this

Basic algorithm
if follow path at each waypoint do the same call back
ScanForTameables

I'm not sure how to make that work though because whan I save teh file I don't see my callback procedure in the file.  They contain the TrailMixCB1 thru TrailMyxCBn

What am I missing?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 01:52:57 PM
Well, when you record the rail, be sure to record it and change the DefaultCB label to your scan function.  Also uncheck the index box (or else you get that indexed for each label).  The only problem I don't see, is to default to the "Move+Callback" for each waypoint.  That's an easy fix, and I'll post that today.

When I wrote this, I didn't envision the same callback being run each time.  However, that certain is a possibility.

Check back soon and I'll have the appropriate update.

Interested in seeing your script this is based off of, I haven't even written a project using this mode yet.  I just scripted it since it seemed like a good idea.

For my tamer, I use this rail engine, but in server mode.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 01:59:39 PM
Actually, the more I look at the code, the more I think I had intended this to default to what's on the display.  It's just a fixable bug.  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 02:08:44 PM
Ok, updated to 0.55c.  You should be able to select what function you want before you run the rail record.  It will note that selection for each waypoint.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: KilroyIsDead on June 09, 2009, 02:33:01 PM
I agree you didn't plan for me to call the same sub but I made a boneheaded error

I forgot to put the
;=================================================================
;--------------------  Call interface by TrailMyx  ---------------
;=================================================================
In my script so it was passing straight through.

My 250 point collector had a home grown path, but I figure I have to use this to make it more mobile

I think we're set; should have MGTimber wolves published shortly
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 02:35:36 PM
Well now at least you should be able to default to the same function for each waypoint instead of having to hand edit each waypoint.  Hope it works for ya.  It's been a while since I tested that mode of operation.  Hope it won't be too "jerky" due to the stopping/starting as the callback function runs.  If your #LPC is high enough, you should be OK.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: KilroyIsDead on June 09, 2009, 05:18:27 PM
Uncle!

Where does the callback file go?

I can't use the explicit location
c:\her\there\whereever
I tried same folder as easyuo.exe
I tried the same folder as the tm_rail server

I keep getting unable to load callback file

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 05:57:23 PM
Are you running Vista? XP?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: KilroyIsDead on June 09, 2009, 05:59:47 PM
XP
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 06:05:41 PM
Take a look at the rail file that's generated to see what the callback path is set to.  I can't look into it right now, but I'll have more time this evening.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 09, 2009, 06:16:25 PM
FYI Kilroy, be sure to not make your file names too long.  I use XP as well and have recently discovered that writing privileges are revoked when the file name is too long, not sure how many characters, but I had a hell of a time trying to figure out what was going wrong when I went to save a rail.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 06:46:27 PM
That's right, you had pathnames that were confusing XP at one point.  I forgot about that.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 09, 2009, 08:40:37 PM
Did you figure it out?  I was looking for my test code, but I'm not seeing it.  I have over 1K scripts in my script directory, so sometimes it's hard to find items, especially custom test code.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 11, 2009, 02:18:44 PM
Ok Kilroy, I remember why I put the Zaxis check in there.  Suppose you have a rail that runs around your keep/castle.  If you try to goto the closest waypoint without checking the zaxis, you might pick a waypoint that's one level above.  That's also why I leave the scaling alone too because the zaxis has a 10 times greater size as you go from level to level.  FYI
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 13, 2009, 07:25:05 PM
And just as on land as in a house, the Z-axis's can, and do, change from 3 to 6 to 12 rather quickly. It can only take one tile at times to hit an error. I found that my rail throughout all of Malas has loads of high and quick Z-axis changes that required me to use the pathfind. Good thing too is that the pathfind feature when turned on, will also be on when running the rail BW and/or FW.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 16, 2009, 11:15:59 AM
Posted version 0.30l

New to version 0.30l (Rail Engine):
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 16, 2009, 08:57:24 PM
First off, thank you for the cool update to the RE ver. 'L'.

Now then, before I get too involved with my next script update, I'm experimenting with error handling dealing with the RE. As you know, if a waypoint is too far away from the character (i.e. something blocking movement) the RE script displays the message " waypoint 666 in rail bla bla is far far away" ...or something like that. What I'd think would be a good option for the script writer using the RE is to have a call to disable error messages or at least pause the script until the error has been dealt with via the script making the call.

While I'm continuously debugging my script, every once in a while atm, I get that error display, and it's quite a bugger to load up the rail again after it stops, and get my character off again after testing the error handling part. As I have it set for the moment, I check if the #result = error, if it does, I make have my script deal accordingly with it, and seconds later, I'm off and running. However, if I'm afk, the error display generated by the RE is still present and can cause problems. (I hope I'm not too buzzed to where this post is not making sense  :P )

Personally, I suppose I could temporarily modify the RE to suit me, but I also think it'd be a worthwhile addition to the script itself.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 16, 2009, 09:18:06 PM
No that's a great suggestion.  In fact I have wanted to add that for a while.  Really you still get back a failure if you are looking at return values and status from the rail engine.  The display is really for someone running the rail engine in a called fashion.  That's part of why I didn't release version L because of that and another feature to be able to change the distance the rail engine tries to pathfind to.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 17, 2009, 12:57:35 PM
Quote
No that's a great suggestion.
I assume you mean 'Now'  ;) hehe

Getting the failure back in the result is certainly good. How far were you planning on extending the pathfinding distance? I personally would think 8-10 tiles would be good.  It's twice the distance of the default waypoint setting, and nearly half (I believe) of what the UO client is capable of 'seeing' internally...basically the game screen I think.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 17, 2009, 01:02:01 PM
]
How far were you planning on extending the pathfinding distance?

The idea is to make it configurable for the script author.  So you can just set the value.  The value is computed by:

%xdiff ^2 + %ydiff ^ 2 + %zdiff ^ 2.  This is arbitrarily set to 400.

Quote
No that's a great suggestion.
I assume you mean 'Now'  ;) hehe

Actually, it need a comma....

Quote
No, that's a great suggestion!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 17, 2009, 01:20:04 PM
ahh, the 'buzzed' comment, lol I get ya. This tool is turning out to be pretty awesome, now to get moving with using a callback function to open doors !
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 17, 2009, 01:25:45 PM
Well, that's how KilroyIsDead is using the engine, so he's tamed that particular beast.  :)

However, if you are running in server mode, you can open the doors in your main loop.  Might be a bit smoother with a callback because it will pause the rail within the rail code.  Mmmm, options!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 20, 2009, 05:56:53 PM
Here's something interesting. Often times, when I load up a few rails, say 6 of em, the sixth one won't be listed in the list box, but it still reports as having 6 rails loaded.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 20, 2009, 06:04:24 PM
If you put a small delay after you load the file. this should fix it.  Like wait 10 or something.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on June 21, 2009, 07:31:24 AM
I don't think I'm doing anything wrong. This is a sub in working. It only loads select rails according to user preference. Just for testing purposes I toggle the Malas and Tok values.

Code: [Select]
GoSub RailInit
set %malas #true
set %tok #false
GoSub SS_Load_Selected_Rails
stop

Sub RailInit
  set %railsubs tool_railengine30l.txt
  call %railsubs TM_GetServerMode ; SERVER, SUBROUTINE, or *blank*
  if #RESULT = SERVER
  {
    call %railsubs TM_PingServer
    if #RESULT = PONG ; server is alive, must reset it and were good to go.
    {
      call %railsubs TM_ServerInitialize ; still need to break a move if in progress....
    }
    else
    {
      display ok Namespace is initialized, but server is not running. Please restart server.
      call %railsubs TM_Close
      stop
    }
    goto skipsetupcheck
  }
  if #RESULT = SUBROUTINE
  {
    display ok You were running in Subroutine mode, please start a server.
    call %railsubs TM_Close
    stop
  }
  display ok No server was found, please start a server session.
  menu hide
  call %railsubs TM_Close
  stop
skipsetupcheck:
return

Sub SS_Load_Selected_Rails
set %railcnt 0
  If %Malas = #true
  {
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt Malas_Red_1
    set %railfile_ . %railcnt C:\Malas_Red_1.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt Malas_Umbra_Blue2
    set %railfile_ . %railcnt C:\Malas_Umbra_Blue2.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt BrknMtns_Blue2
    set %railfile_ . %railcnt C:\BrknMtns_Blue2.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt BrknMtns_Red2
    set %railfile_ . %railcnt C:\BrknMtns_Red2.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt Malas_Blue_1
    set %railfile_ . %railcnt C:\Malas_Blue_1.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt Malas_Umbra_Red
    set %railfile_ . %railcnt C:\Malas_Umbra_Red.txt
    pause
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
  }
  If %Tok = #true
  {
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt
    set %railfile_ . %railcnt C:\Tok_Makoto.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railcnt %railcnt + 1
    set %rail_label_ . %railcnt
    set %railfile_ . %railcnt C:\Tok_Homare.txt
    call %railsubs TM_LoadRail %railfile_ . %railcnt
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
  }
  if %MakeMSL = 1
  {

    set %railfile C:\Luna_MSL7.txt
    call %railsubs TM_LoadRail %railfile
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railfile C:\MSL8a.txt
    call %railsubs TM_LoadRail %railfile
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    set %railfile C:\MSL8b.txt
    call %railsubs TM_LoadRail %railfile
    if #RESULT = #TRUE
    {
      display ok Rail file not found
      stop
    }
    if %RR = N/A
    {
      set %railfile C:\MSL8c.txt
      call %railsubs TM_LoadRail %railfile
      if #RESULT = #TRUE
      {
        display ok Rail file not found
        stop
      }
    }
  }
wait %LLwait
if %railcnt = 0
{
 display ok You haven't selected any facet(s) to search in. Please select the facet(s) by going to the "User Config"$
 +at the top of this script, and change any facet you wish to seach in, to a "#True" statement.$Stopping Script.
 Stop
}
return

They all load just fine, except when it get to the last one
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 21, 2009, 10:56:55 AM
Well, like I said, put a small pause in between your rail loads.  After each:

Code: [Select]
call %railsubs TM_LoadRail %railfile_ . %railcnt

Just put a "wait 10".  You have to give the rail engine enough time for its state machine to process the last load and display it.  Sometimes it works, but sometimes it doesn't.  With the wait, it should work better.  The wait has to come from the calling script also to allow the rail engine to do it's thing.  It should make the display of the rails loaded more consistant.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: kreterplayer on July 16, 2009, 07:38:48 PM
i been at this for a good twenty minutes, trying to figure out how to download this, well.. now really now, but where to... can you point this out for me? im sure there is a link or something i just cannot see it for anything
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on July 16, 2009, 07:56:01 PM
Now that you are unrestricted, just look at the first post; it'll be attached to the bottom.  There's a few files, engine developer, and PDF help file.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: kreterplayer on July 16, 2009, 08:12:09 PM
(http://i233.photobucket.com/albums/ee208/Kreterplayer/troubles.jpg)

I dont see the developer, i got the engine and the help. BTW amazing job on the help pdf, never have i seen such detail in instructions
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on July 16, 2009, 08:31:48 PM
Thanks!  It's a bit out of date, but it'll get you started.

The rail developer is tool_rail55c.txt
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: kreterplayer on July 17, 2009, 03:03:38 AM
ahh, thanks much
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on August 13, 2009, 11:24:10 AM
As I continue with the many available options, I thought it'd be a great idea to add a command that returned the next waypoint xyz coord's.  Reason being, once in a while, the rail will get stuck, but if I know the xy position that the rail is attempting to get to, I can run, or 'live-update' the rail.  Here's what I mean. Character is at point A, moving to point B, but gets ultimately stuck. Now suppose the script notices that enough time has passed where the character should have arrived at B and yet is not there. At this point, I call the TM_RE and ask for the next waypoint xyz and have it return those coord in a format such as this: XXX_YYY_ZZZ. From here, my script (or another) could find out what the problem is, and handle it appropriately, thus moving the character to the next waypoint.  Perhaps via a tile seach, new object, or something unexpected occured, a waypoint could actually be inserted between A and B, thus making B=C.

Example code perhaps:

Code: [Select]
; rail is running

if result <> Idle
{
  gosub do stuff
  gosub do more stuff
  if result = error
  {
    call tm_setservercommand stop
    call tm_getnextwaypointXYZ
    gosub parse_result #result
    gosub movetonewposition
    call tm_runrail 1% 2% 3% 4%
  }
}
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 13, 2009, 11:33:03 AM
What makes more sense is to add a command that returns the coordinates and an index.  So you just query the current index, add one and the query that.  This way, if you want to summarize a complete rail for a display, you could do that.

I want to avoid any real specialized requests, but I don't mind the idea of adding generic function that has multiple uses.  I like multitaskers.  Does that make sense?

In any event, I'm no where near being able to do much coding with the rail engine.  So don't hold your breath for at least a week.  I have a work project I'm in the middle of, plus I'll be going to Vegas this weekend.  Just no time.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 13, 2009, 11:42:58 AM
Also remember you can use the Closest waypoint functions and let the engine to the work for you.

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

This is the method I use in my unicorn tamer quite successfully.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on August 13, 2009, 12:06:22 PM
Since it's the closest global waypoint and if my destination is B, and I'm closer to A, will it return A even though I'm trying to get to B?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 13, 2009, 12:16:26 PM
That all depends on your current location.

Another thing you can do is:

1) stop
2) note your waypoint index (%idex)
3) do your work
4) run rail from (%idex + 1) to end

I did this in my luna vender scanner and it works very well.

I think the functionality is in the rail engine to do exactly what you need to do, but you have to explore some of the other functions available.

I can't really think of a real good reason to ever need the coordinate numbers unless you want to report them to the outside world.  I dunno.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on August 13, 2009, 01:14:22 PM
Knowing that now, I see your point. I hadn't thought of adding to the result and then running the rail.

Phew ! Another save by TrailMyx!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 13, 2009, 01:53:07 PM
Heh, cool.

This rail engine kinda makes one have to think differently about things.  Most everyone is used to coordinates, but this one makes you shift to thinking about waypoint indexes instead.  Might as well let the rail engine do the work for you.  :)

Paradigm shifting FTW!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 07:55:39 AM
Hmm i was just wondering i and recording the rail then saving it then how do i use Trailmyx's Rail Converter?  I must be really dumb cus i am new to this whole scripting thing but i cant find the saved file anywhere so i can use the rail to modify a rail for heartwood so im not standing on like 10 people who everyone knows are afk lol
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: rana70 on August 14, 2009, 08:02:50 AM
Hi,

th rail dev script uses by default

C:\filename.txt

to save the file.

cu
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 08:22:01 AM
so how would i call upon that in the script to run that one instead of the one the heartwood one uses so im not standing on everyone lol
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 14, 2009, 08:27:31 AM
You should load the rail into the developer, and goto the last waypoint.  From there you can change it to something else and then test it.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 08:34:08 AM
im little dumb with the rail dev how do i load it? and once that and after i mod it how will the engine save the file?  im sorry im askin so many questions im totle newb to scripting and rails i really appreciate your time
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 14, 2009, 09:04:06 AM
Take the script that's attached to this (tool_rail55c.txt).  This is the rail developer.  From there, you can just look at the user interface and play with it.  There's load/save buttons, etc.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 09:08:42 AM
how do i open the rail that the script uses hw_bowcraft.txt?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 14, 2009, 09:10:51 AM
Just put in the path and filename of the rail you want to edit, and press load.  That's the easy part; editing the last point is something you'll have to play with.

Just try running tool_rail55c.txt
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 09:12:49 AM
ok so i put in the actual file location on my computer then the name of the rail? so hw_bowcraft.txt? like i said im completely new to this lol
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 14, 2009, 09:13:53 AM
Just try it..... Play!!!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 09:16:11 AM
haha guess so sorry to make ya mad
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on August 14, 2009, 09:20:01 AM
haha guess so sorry to make ya mad

Heh, definitely not mad.  :)  It's just easier to explain when you play a bit with it. I'm sure you'll find it's pretty easy once you fiddle with it a bit.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 09:42:16 AM
well i got the file to open and i hit insertwaypoint then i hit update position and moved then did the same then saved and overwrited lets hope i get a different ending position lol
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 10:30:46 AM
well i got the rail to run but now it doesnt want to execute the crafting portion lol it just goes there on the new rail and then it will get off the bug then open it get back on bug and then go back to the bank to try to restock?? could someone plz help me out here lol i didnt even mess with the script itself just added a couple new waypoints to the rail i must really suck at this to not be able to get it to work right
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Scrripty on August 14, 2009, 10:39:09 AM
I find it's always something VERY simple that's keeping it from working.  If you messed up your waypoints file tho... you never know.  Try going over the checklist again to make sure you're doing it all right... Or did it work before you chanced the waypoints?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 10:48:37 AM
it worked before it was the way points i guess idk how to make a new rail very good and it would just keep it looping so i just redownloaded it all and started over haha im just lookin for a new rail thats different from every other scripter out there cus everyone just sits right on top of each other could  you help me with new heartwood rails by chance haha
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Cerveza on August 14, 2009, 11:50:59 AM
Ok, I'm just gonna throw this one out there for ya.... clues only.

Find where the rail is called from in the quest script...

set %a #random % 8

That code will set a random number between 0 and 8.

There are 8 directions you can move in.

Event macro 5 0 ; moves you one step NW
Event macro 5 1 ; moves you one step N

I'll leave the rest to your imagination.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Scrripty on August 14, 2009, 07:46:39 PM
That's a good idea, but the gms are questioning EVERYONE during the day.  I've seen TONS of beetles around.  Not a good idea to do any unattended there atm. :)  Be really carefull.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Arch_Mage on August 14, 2009, 08:15:17 PM
nah i dont afk script haha i only have 1 acct lol
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 07:44:17 AM
I've been playing around with this, and it's AMAZING!!

Now to just figure out how to work it all..  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 11, 2009, 08:58:49 AM
Superslayer has turned into the resident rail engine expert, so there's a few people now that can help if you get stuck.

But yeh, this engine turned the heartwood quester into a nearly 100% stable script; normally railing in a script can be the chink in a scripts armor.  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 11:42:46 AM
I've got a question. I click record and start walking my rail. I need to stop for a few, so I click stop recording and when I come back to the last spot and click start recording, it resets the waypoints. Shouldn't this work like a pause instead of working like reset?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 11, 2009, 12:51:53 PM
Just pause the script.. ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 01:39:08 PM
Just pause the script.. ;)

That's simple enough..  :D
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 02:52:43 PM
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
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 11, 2009, 03:35:15 PM
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?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 03:53:51 PM
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!

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 11, 2009, 04:02:28 PM
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.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 06:32:00 PM
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!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Scrripty on November 11, 2009, 06:53:10 PM
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...
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 07:42:19 PM
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!!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 11, 2009, 09:41:29 PM
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.  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 11, 2009, 10:11:31 PM
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  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 12, 2009, 12:10:50 AM
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.  ;)

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 12, 2009, 12:28:10 AM
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.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on November 12, 2009, 05:53:13 PM
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.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on November 16, 2009, 04:13:02 PM
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... :(
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 16, 2009, 07:48:17 PM
Oh yeh, that's a use for it.  Unfortunately, that lag can be variable and long lasting.  MIght have to put in a retry when a rail fails.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on November 17, 2009, 02:28:45 PM
I think I may have found a way to resolve the server line issue. After the 'call %railsubs TM_GetStatus' results in an Idle #Result, I compare the current waypoint to the known start and end endpoints of the currently running rail. Knowing the character is at neither point, I call the TM_RunRail function with "Present" as the rail start, then back to the TM_GetStatus line.  All is good after that. 

I have come across an issue and I hope it's just me. Sporadically throughout any rail, the RE will return an IDLE status in the window, but the character is still running the rail. I can't pause the WIT script to find the error, as it seems the RE is in an infinate loop at line 84.  The lines reads:
Code: [Select]
  while #TRUE
  {
    set !TM_temp !TM_RailTotal + 1
    menu set EUOEdit1 !TM_temp
    menu set EUOEdit2 !TM_temp_rail
    menu set EUOEdit3 !TM_temp_index
    menu set EUOEdit5 !TM_ServerCommand
    menu set EUOEdit6 !TM_Status
    if !temp_rails <> !TM_RailTotal
    {
      wait 40
      menu delete EUOListBox1
      menu List Create EUOListBox1 208 4 141 141
      set !temp_rails !TM_RailTotal
      for !i 0 !TM_RailTotal
        menu list add EUOListBox1 !TM_RailName . !i
    }

    if !TM_ServerCommand = RUNRAIL
    {
      set #LPC 100
      gosub TM_DoRail NULL !TM_temp_rail !TM_temp_index !TM_temp_steps !TM_temp_direction
      set #LPC 10
      if #RESULT = #TRUE
      {
        set !TM_Status ERROR
      }
      else
      {
        set !TM_Status IDLE
      }
      set !TM_ServerCommand NONE
    }
    if !temp_ping = PING    ; ping handler.
    {
      set !temp_ping PONG
    }
    if !TM_menuvisible = #TRUE && !TM_menu_command = HIDE
    {
      set !TM_menuvisible #FALSE
      menu hide
    }
    if !TM_menuvisible = #FALSE && !TM_menu_command = SHOW
    {
      set !TM_menuvisible #TRUE
      menu show
    }
  }

When I do pause the WIT script, I tab over to the tool_railengine30l tab and see that I'm continuously going over this block of code.  I'm wondering if my SS_Globals script has anything to do with it, and further yet, if I should put TM_Close somewhere in my script that is really needed.  My SS_Globals script is running in a separate tab just as the RE, and too is using a global namespace to communicate with my WIT script, specifically scanning for gumps in a loop.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on November 17, 2009, 04:40:35 PM
I'm pretty sure I found the problem, or at least a major part of it and it is just me atm, heh. While the rail sub part of my script ran, there are other subs that did stuff, idoc scanning, specific action location check subs and whatnot. Specifically though, I have a scan character sub that checks for poison and low hp and stuff.  As it happens, when I had crossed the server line, my stats dropped and the script told the rail to stop (as planned). However as planned, this time was more like a false positive.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 17, 2009, 08:25:20 PM
Glad you may have tracked it down.  I've been pretty busy lately and haven't really had time to dig into this kinds of things for people.  That's ok, no dog food for me tonight!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 27, 2009, 11:32:47 AM
When I run a rail using Server mode the rail is perfectly smooth, but when I don't use the server and just load a rail in memory and run it in Subroutine mode the rail is choppy. The char will pause for a split sec after each waypoint.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 27, 2009, 11:53:39 AM
and something else I did.. I love playing around with this thing btw!  ;)

I'm using vista so I can't put all my rail files into a Rails folder. So I got all these rail files in my easyuo folder with all my script.
I hate cluter! So I modified the Rail Engine so I could have more than one rail in a Rails.txt file and use something like this..

call %railsubs TM_LoadRail c:\rails.txt railname

Code: [Select]
if %3 <> N/A                ;======================
  {
     set !filename %3       <----    Added this..
     set %filename %3
  }                             ;=======================
  else
  {
      set !filename %2
      set %filename %2
  }
  set !temp_LPC #LPC
  
  set !idx 0
  while !filename . !idx <> N/A
  {
    set !filename . !idx N/A
    set !idx !idx + 1
  }

  set #LPC 10000
  set %fileout0 N/A
  if %3 <> N/A           ;===============================
     call %2 %3            <---    and this...
  else                       ;===============================
     call !filename
  if %fileout0 = N/A

Now Instead of loading a bunch of different rails from different files I use one file

Cotton_Rails.txt
Code: [Select]
gosub %1
exit

sub Bank2Cotton
 set %fileout0 Bank2Cotton3710446611710?0NONE-1011446211680?0NONE-1012445811650?0NONE-1013445811600?0NONE-1014445811540?0NONE-1015445811480?0NONE-1016445811430?0NONE-1017445811370?0NONE-1018445811320?0NONE-101044581124000None0019445611240Teleporter_Gate40NONE-10110445111260?0NONE-10111445111300?0NONE-10112444611310?0NONE-10113444211310?0NONE-10114443711340?0NONE-10115443411390?0NONE-10116443911400?0NONE-10117444311400?0NONE-10118444311375?40NONE-10119449014780?0NONE-10120449414840?0NONE-10121450014860?0NONE-10122450514860?0NONE-10123451114860?0NONE-10124451714860?0NONE-10125452214860?0NONE-10126452814860?0NONE-10127453314860?0NONE-10128453814861?0NONE-10129454314900?0NONE-10130454814860?0NONE-10131455314850?0NONE-10132455814860?0NONE-10133456414860?0NONE-10134457014860?0NONE-10135457014820Cotton_Gate40NONE-10136457014770?0NONE-10
 set %callbackfunctions c:\easyuo\callbacks.txt
return

sub Cotton2Bank
 set %fileout0 Cotton2Bank3610457014770?0NONE-1011457014800?40NONE-1012457014850?0NONE-1013456514860?0NONE-1014456014860?0NONE-1015455414860?0NONE-1016455014860?0NONE-1017454614900?0NONE-1018454114930?0NONE-1019453614930?0NONE-10110452914930?0NONE-10111452414930?0NONE-10112451914930?0NONE-10113451414930?0NONE-10114450914880?0NONE-10115450514840?0NONE-10116450014840?0NONE-10117449614840?0NONE-10118449614803?0NONE-10119449614798?0NONE-101204496147511?40NONE-10123443911280?0NONE-10124444211320?0NONE-10125444711320?0NONE-10126445111300?0NONE-10127445411240?40NONE-10128445811240?0NONE-10129446111290?0NONE-10130446111340?0NONE-10131446111390?0NONE-10132446111430?0NONE-10133445611480?0NONE-10134445611530?0NONE-10135445611590?0NONE-10136445611640?0NONE-10137446111700?0NONE-10138446611720?0NONE-10
 set %callbackfunctions c:\easyuo\callbacks.txt
return

Now when I got to load my rails I just use this..

Code: [Select]
set %railsubs TM_RailEngine_Server.txt  ;Had to do some renaming.. Ha!
set %railfile Cotton_Rails.txt
set %rail1 Bank2Cotton
set %rail2 Cotton2Bank
set %rails 2
gosub SetupRailServer

;============================
code..
;============================

sub SetupRailServer
call %railsubs TM_GetServerMode ; SERVER, SUBROUTINE, or *blank*
if #RESULT = SERVER
{
   call %railsubs TM_PingServer
   if #RESULT = PONG ; server is alive, must reset it and were good to go.
   {
      call %railsubs TM_ServerInitialize ; still need to break a move if in progress....
   }
   else
   {
       display ok Namespace is initialized, but server is not running. Please restart server.
       call %railsubs TM_Close
       stop
   }
   goto skipsetupcheck
}
if #RESULT = SUBROUTINE
{
   display ok You were running in Subroutine mode, please start a server.
   call %railsubs TM_Close
   stop
}
display ok No server was found, please start a server session.
call %railsubs TM_Close
stop

skipsetupcheck:
for %i 1 %rails
{
    call %railsubs TM_LoadRail %railfile %rail . %i
    if #RESULT = #TRUE
    {
       display ok Error loading , #SPC , %rail . %i
       stop
    }
    wait 2s
}
return

I still have to copy and paste my rails into the Rails.txt file, but after that I can delete them and just have one Rails file per scipt.

EDIT:

I'm sure most people figure this out, but you can put your rails at the bottom of your script, and add this to the top. That way you don't even have to use a separate rail file. Just call the script it's self.. 

Code: [Select]
if %1 <> N/A
{
   gosub %1
   exit
}

;=========================
script...
;=========================

;=========================
; Rails
;=========================
sub Bank2Cotton
 set %fileout0 Bank2Cotton3710446611710?0NONE-1011446211680?0NONE-1012445811650?0NONE-1013445811600?0NONE-1014445811540?0NONE-1015445811480?0NONE-1016445811430?0NONE-1017445811370?0NONE-1018445811320?0NONE-101044581124000None0019445611240Teleporter_Gate40NONE-10110445111260?0NONE-10111445111300?0NONE-10112444611310?0NONE-10113444211310?0NONE-10114443711340?0NONE-10115443411390?0NONE-10116443911400?0NONE-10117444311400?0NONE-10118444311375?40NONE-10119449014780?0NONE-10120449414840?0NONE-10121450014860?0NONE-10122450514860?0NONE-10123451114860?0NONE-10124451714860?0NONE-10125452214860?0NONE-10126452814860?0NONE-10127453314860?0NONE-10128453814861?0NONE-10129454314900?0NONE-10130454814860?0NONE-10131455314850?0NONE-10132455814860?0NONE-10133456414860?0NONE-10134457014860?0NONE-10135457014820Cotton_Gate40NONE-10136457014770?0NONE-10
 set %callbackfunctions c:\easyuo\callbacks.txt
return

sub Cotton2Bank
 set %fileout0 Cotton2Bank3610457014770?0NONE-1011457014800?40NONE-1012457014850?0NONE-1013456514860?0NONE-1014456014860?0NONE-1015455414860?0NONE-1016455014860?0NONE-1017454614900?0NONE-1018454114930?0NONE-1019453614930?0NONE-10110452914930?0NONE-10111452414930?0NONE-10112451914930?0NONE-10113451414930?0NONE-10114450914880?0NONE-10115450514840?0NONE-10116450014840?0NONE-10117449614840?0NONE-10118449614803?0NONE-10119449614798?0NONE-101204496147511?40NONE-10123443911280?0NONE-10124444211320?0NONE-10125444711320?0NONE-10126445111300?0NONE-10127445411240?40NONE-10128445811240?0NONE-10129446111290?0NONE-10130446111340?0NONE-10131446111390?0NONE-10132446111430?0NONE-10133445611480?0NONE-10134445611530?0NONE-10135445611590?0NONE-10136445611640?0NONE-10137446111700?0NONE-10138446611720?0NONE-10
 set %callbackfunctions c:\easyuo\callbacks.txt
return
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 27, 2009, 03:48:35 PM
Good deal Gen2000.  I was going to add this type of feature to the next version of the engine.  I kinda figured that people might like to have small rails included in their code without having to have rail files.  I did it a bit differently, but the end effect is the same.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Endless Night on November 27, 2009, 04:48:50 PM
Good deal Gen2000.  I was going to add this type of feature to the next version of the engine.  I kinda figured that people might like to have small rails included in their code without having to have rail files.  I did it a bit differently, but the end effect is the same.

I rember us talking about this sort of thing way back on uoCoders TM... that is how my rail system works.. but super compressed..  A rail to walk around luna in my system is about 16characterslong.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 27, 2009, 07:20:06 PM
When I run a rail using Server mode the rail is perfectly smooth, but when I don't use the server and just load a rail in memory and run it in Subroutine mode the rail is choppy. The char will pause for a split sec after each waypoint.

During server mode, the rail engine will crank up the LPC a bit in order to keep the rail smooth.  If you are running in subroutine mode, you need to do this yourself.  So before you call the run rail function, put the #LPC up to something over 100.  That should smooth things out and make your subroutine calls as smooth as the server calls.

I'm glad to see others starting to use this rail engine.  It's really a very powerful tool.  There's just nothing else out there like it (or even close to it).  :)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 27, 2009, 07:28:27 PM
I rember us talking about this sort of thing way back on uoCoders TM... that is how my rail system works.. but super compressed..  A rail to walk around luna in my system is about 16characterslong.

EN, you should post your thoughts on this again.  I promise it won't disappear like the last conversation did.  ;)

Your rail stuff was singularly unique and compact to boot!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gen2000 on November 27, 2009, 09:11:45 PM
When I run a rail using Server mode the rail is perfectly smooth, but when I don't use the server and just load a rail in memory and run it in Subroutine mode the rail is choppy. The char will pause for a split sec after each waypoint.

During server mode, the rail engine will crank up the LPC a bit in order to keep the rail smooth.  If you are running in subroutine mode, you need to do this yourself.  So before you call the run rail function, put the #LPC up to something over 100.  That should smooth things out and make your subroutine calls as smooth as the server calls.

I'm glad to see others starting to use this rail engine.  It's really a very powerful tool.  There's just nothing else out there like it (or even close to it).  :)

Cool Thanks! I'll give that at try.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on December 18, 2009, 12:00:46 PM
Superslayer reminded me to add his script to the ones using this engine.  So if anyone else out there would like to have their script added to the list, please PM me.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on January 19, 2010, 03:20:48 PM
Question:

I'm comming around to using some of the other commands, in particular, the TM_Pop & TM_Push functions.  I'm obviously not doing it right, so I'm asking, could you post a small example or correction to what I'm doing?

What I'm doing:

1. Load rail1
2. Start running rail1 from 0 to End
3. Call TM_SetPresentServerCommand STOP midway through rail... waypoint 100 for example
4. Call TM_Push
5. Load rail2
6. Run rail2 from 0 to end, then backwards 100 to End.
7. Call TM_Pop
At this point, I'd half expect to see the TM_RE Info window to show that rail1 is now loaded with the last waypoint from where I pushed it from, rail1/waypoint 100. From the call tm_pop, there is no error.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: manwinc on January 19, 2010, 03:26:55 PM
I shall have to try this out. Just had to rape CEO's Script and make it write everything in chunks instead of one fricking line at a time(SCREAMS)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on January 19, 2010, 06:06:37 PM
I shall have to try this out. Just had to rape CEO's Script and make it write everything in chunks instead of one fricking line at a time(SCREAMS)

Lol, then you'll really like mine.  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on January 30, 2010, 08:03:33 AM
*shameless bump for my question 2 posts above*

Additionally, I have another question/suggestion. Is it possible to throw in another call that will return the direction that the current rail is running?  I'm working on a function that will allow users to stop the rail and the script all together and allow them to restart all together like they never missed anything. With my setup in the WIT, there are several rails that run in different directions depending on where they started, so knowing which way the rail was running is imperative to the restarting. Perhaps something like "Call %railsubs TM_GetCurrentRailDirection"
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on January 30, 2010, 10:56:29 AM
I have that in the latest version but a silly bug is preventing any testing.  I may have to revert a little bit to absorb the bug.  Was cleaning up some stupid code and broke something.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on January 30, 2010, 11:05:36 AM
ROFL, sounds like me with my many changes to my scripts!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on January 30, 2010, 11:06:59 AM
ROFL, sounds like me with my many changes to my scripts!

Ya, I broke something silly.  Problem is it's kinda hard to debug a script that's running in "server" mode when it's the server!  I do have a namespace debugger I wrote a little while ago now that I'm going to have to dust off I think.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Scrripty on January 30, 2010, 12:38:48 PM
ROFL, sounds like me with my many changes to my scripts!

Ya, I broke something silly.  Problem is it's kinda hard to debug a script that's running in "server" mode when it's the server!  I do have a namespace debugger I wrote a little while ago now that I'm going to have to dust off I think.

I just found out you could add vars to EUO for watching... so um... yea... :)  You guys should be giving out these little tidbits to people... heh  What seems easy to you guys might be a valuable lesson to us scrubs. :)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on January 30, 2010, 12:44:26 PM
Read thoroughly the PDF that's on the first page. Admittedly I think it needs some extra examples and some more info on the functions, but other than that, it's a great read for beginners and just like any other callable script, any var can be 'watched' throughout the script, which makes it SO incredibly powerful.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on February 08, 2010, 01:54:27 PM
Sub to consider adding to the Rail Engine?

Code: [Select]
Sub SetCursPos
  set %ClickX #clixres / 2
  set %ClickY ( ( #cliyres / 2 ) + 70 )
Return
; ---------------------

I use this sub in the WIT for really only one purpose, should the character decide to walk to the pathfinding destination. Then why am I bringing it up? Surprisingly, I noticed that while my game screen sized is lessened because of my Razor use and recent UO Client patch, there's also the possibility that others play in the smaller size.  When I tested this out recently while stealthing, the pathfinding forced my character to run, thus revealing himself, something others may not want especially if they want to walk continuously.

The '+70' places the cursor at the feet of the character and not directly on them.

Just for consideration.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 08, 2010, 03:26:34 PM
Ah yes, that's something I've been meaning to do with the rail engine.  I have other scripts that do screen-relative centering, but that just never made it into the engine.  I have a TODO list somewhere for the engine that already has your request. heh
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Superslayer on February 09, 2010, 03:24:59 PM
Question:

I'm comming around to using some of the other commands, in particular, the TM_Pop & TM_Push functions.  I'm obviously not doing it right, so I'm asking, could you post a small example or correction to what I'm doing?

What I'm doing:

1. Load rail1
2. Start running rail1 from 0 to End
3. Call TM_SetPresentServerCommand STOP midway through rail... waypoint 100 for example
4. Call TM_Push
5. Load rail2
6. Run rail2 from 0 to end, then backwards 100 to End.
7. Call TM_Pop
At this point, I'd half expect to see the TM_RE Info window to show that rail1 is now loaded with the last waypoint from where I pushed it from, rail1/waypoint 100. From the call tm_pop, there is no error.

I'm still a little baffled with this one,
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: JackCiaran on April 07, 2010, 05:42:09 AM
So this script is insane and my understanding of scripting isn't that great =( but I'm definitely learning from everyones posts and scripting codes they submitted but currently I'm TRYING to write a stealth script and curious after reading everything in here and the pdf if its possible to find something and then walk to it using this rail engine? ( I assume it would be possible but I'm afraid I may have just misunderstood a few things )
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on April 07, 2010, 07:43:22 AM
So are you going to be railing around until you find something.  Then stop the rail and walk to the found object.  All stealthed? 
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: JackCiaran on April 07, 2010, 10:50:34 AM
yes thats correct and i figured out how to do it =)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on April 07, 2010, 11:45:27 AM
It's pretty easy to stop/start a rail with this rail engine. Superslayer has some pretty detailed code.
Title: TM_MaxDistance
Post by: Superslayer on September 27, 2010, 04:54:53 AM
Here's a nice tid-bit of info for people using the rail creator and engine. When using the "TM_MaxDistance" function, the highest value for when using #true is 576, this is the square-root of 24.  If you choose not to pass any arguments, it defaults to 450.

So what does this mean? It means that if you are 'x' tiles away from destination x, 'y' tiles away from destination y and 'z' tiles away from destination z, these are added together and multiplied by it self. If the addition is equal to or lower than 24, you'll most likely arrive at your destination.

Example: my destination "X" tile is 1500, "Y" tile is 2000 and "Z" tile is 5.  This is the waypoint tile, so the railengine is going to try to get you there.  Lets say my current position is 1483, 1996 and 3 (x, y and z respectively). Subtracting the differences results in this set of results: 17, 4 and 2 (relative coordinates  ;) ).  The sum of this set is 23 and is likely to get you to your destination when you pass #true 576 to the TM_MaxDistance function.  If you had left it blank, default to 450, the rail would error out.

Hope someone finds this useful :)

BTW TrailMyx, plopping in a square-root for 450 is 21.213203..hehe.

This is why sometime rail errors occur even when you are 9-10 tiles of both your x and y destination tiles, it's the 'z' tile that's putting you over the 24 threshold of erring out. Hilly area's are best left to pathfind  :)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Noobie on July 24, 2011, 01:04:06 PM
Well I am having trouble with this. I read the userguide and still am not sure if i am on the right track. Can anyone give me some guidance?

1. I have downloaded both the rail engines 30I and 30k "just in case this was the issue"
2. I have developed a rail with the development tool.--- Rail File Name "noobiesrail" Label "Lablell1"
3. Tried to run the rail using the code below in its own saved tab

I am running windows 7




Code: [Select]
set %railsubs tool_railengine30k.txt
set %rail_filename c:\noobiesrail.txt
set %rail_label  LABEL1

call %railsubs TM_Initialize 

call %railsubs TM_LoadRail %rail_filename

if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}
set #LPC 1000

call %railsubs TM_RunRail %rail_label 0 END FW 
if #RESULT = #TRUE
{
  display ok Rail error occurred.
}

call %railsubs TM_Close
stop
 
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gimlet on July 24, 2011, 02:05:53 PM
This looks like a win 7 problem- did you check in the root of the C drive?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Noobie on July 24, 2011, 02:22:46 PM
No, I did not check the root of my drive, but can you explain how to do that as well?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: gimlet on July 24, 2011, 04:01:25 PM
No, I did not check the root of my drive, but can you explain how to do that as well?

look at this from your code above

set %rail_filename c:\noobiesrail.txt

I have no clue how to use this program but this either saves or reads a file in the root directory of your C drive.

so

right click on windows start button (lower left hand corner of your taskbar)
select open windows explorer

go down on left to         local disk (c:)
click on on right should be all the files  and folders in root directory of C drive
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Noobie on October 25, 2011, 03:28:30 PM
Well I am having trouble with this. I read the userguide and still am not sure if i am on the right track. Can anyone give me some guidance?

1. I have downloaded both the rail engines 30I and 30k "just in case this was the issue"
2. I have developed a rail with the development tool.--- Rail File Name "noobiesrail" Label "Lablell1"
3. Tried to run the rail using the code below in its own saved tab

I am running windows 7




Code: [Select]
set %railsubs tool_railengine30k.txt
set %rail_filename c:\noobiesrail.txt
set %rail_label  LABEL1

call %railsubs TM_Initialize 

call %railsubs TM_LoadRail %rail_filename

if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}
set #LPC 1000

call %railsubs TM_RunRail %rail_label 0 END FW 
if #RESULT = #TRUE
{
  display ok Rail error occurred.
}

call %railsubs TM_Close
stop
 

Anyway I could get some help with this? I still have not been able to get this to work. I can get my rails to run in the dev tool, but not using the example code.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Noobie on October 26, 2011, 09:16:53 PM
Determination = Success  ;)
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on October 30, 2011, 08:00:43 AM
Sorry, Noobie, was on vacation
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Noobie on October 30, 2011, 01:59:07 PM
No big deal it made me grind it out until I got it, but I must say NICE WORK with this after I figured it you (path problem) I was able to do some really sweat rails server option is sweet!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on October 30, 2011, 06:31:08 PM
Yes, whenever I do any serious railing, I use the server mode also
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: freddy on November 28, 2011, 12:13:43 PM
is there a super secret private version of this script where running a rail backwards works?

I looked trough the PDF and even used the test code you provided a few potst back and can't get it to run backwards. Halp!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 28, 2011, 12:30:21 PM
It works out of the box.  Check out the heartwood quester; all rails in there work forwards/backwards.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: freddy on November 28, 2011, 01:14:18 PM
edit: I'm retarded
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 28, 2011, 03:03:44 PM
edit: I'm retarded

ROFL!  You're brilliantly retarded.  heh
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: UoLugnutz on June 12, 2012, 01:29:08 PM
Uncle!

Where does the callback file go?

I can't use the explicit location
c:\her\there\whereever
I tried same folder as easyuo.exe
I tried the same folder as the tm_rail server

I keep getting unable to load callback file



I just started playing around with this and seem to be having the same issue above. Reading through the thread I never did see a reply or solution posted. I'm currently trying on XP as my Vista desk top cooked the power supply and do not have UO on my laptop with Window7. If by some slim chance you may remember from back then or any suggestions would be appreciated. I'm sure with time Ill figure it out but cant hurt to poke for a few ideas in the right direction.

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 12, 2012, 04:24:24 PM
Hmm, still works.  I just tested it.  Ran everything out of my EUOX.exe directory.  Take a look at the snapshot of the creator UI attached to see how it's set up.

I'll also attach test code that calls the same callback function each time and shows a popup.

I'll also attach the test code:

callback_funct.txt = contains the call back functions referenced in the rail file
rail_forward_reverse_tester.txt = test script to test for call back functionality
test_callback_script.txt = poorly named rail file.

Go and stand in front of the W. Britain Bank doors and load "rail_forward_reverse_tester.txt".   Remember to put all these things in the directory with your EUOX.exe and your script.

Tested on EUO 214, OSI and Win7 Ultimate

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: freddy on June 12, 2012, 06:21:17 PM
Hmm, still works.  I just tested it.  

This has absolutely nothing to do with this post, but I'm glad you logged in! haha
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 12, 2012, 07:00:33 PM
And logged back out.

Actually I have my lumberjacker script running on Lexia 24/7.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: UoLugnutz on June 13, 2012, 07:09:01 AM
Thank you for the quick and incredibly detailed response! I'm once again going to be tied up with RL so will not be able to test right away but will shortly. The information posted I'm sure will be more then enough to figure out the error i seem to be making when I get back to trying it.
The great support to a very basic question is greatly appreciated!!
Thanks!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on June 13, 2012, 08:17:15 AM
I was kinda curious since I hadn't played with it for a long time and wasn't sure if UO or EasyUO broke something.  You'd be probably 1 of 3 people I know that have used the callback feature (Superslayer and myself being the other two) so it doesn't get much use.

Anyhow, hopefully there's enough detail there to make sure all the syntax is correct as well as the file locations.

I did notice that the rail creator didn't actually test the rails very well, so there's something I should look at.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: UoLugnutz on June 16, 2012, 05:01:42 AM
Going to start playing around today so loaded up the example and received a rail error and noticed

Code: [Select]
call %railsubs TM_RunRail trinsic 0 END FW
And changed it to

Code: [Select]
call %railsubs TM_RunRail LABEL1 0 END FW
Worked like a charm! I always hated Trinsic  :)

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: madatu on October 10, 2012, 07:10:40 AM
Is there a way to slow a rail down so it dont seem to be running in between the locations in a rail other than changing the timer. All that seemed to do is slow the walk between the locations along the rail.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on October 10, 2012, 08:04:38 AM
Each waypoint is capable of running or walking.  But remember that event pathfind determines this by the mouse position, so to run the mouse will be moved farther away from your character.  This makes it difficult for you to use your computer because the script will take control of your mouse.  That's why we always recommend that you use rail scripts like this from within a virtual machine so it can de-couple the physical mouse from the virtual machine.  You can even minimize the VM and the script will happily work.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Endless Night on October 10, 2012, 04:42:57 PM
you can change the setting Always Run to on and off.

event macro 32

Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on October 10, 2012, 04:44:15 PM
oh yeh, I forgot about that! 
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: madatu on October 10, 2012, 04:46:18 PM
Very smart EndlessNight will give that a try
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Endless Night on October 11, 2012, 08:54:08 AM
Very smart EndlessNight will give that a try


Was fresh in my memory .. as when i updated my charactertool box to make all my characters goto luna bank I noticed some ran some walked... diff was 1min per char or 3-4mins .. when you got a few 100chars to do that extra few mins is alot of time.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Black Widow on November 03, 2012, 04:38:11 PM
Thanks for the awesome contribution TM ....Gonna give this a whorl in Heartwood
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: grrrls on November 25, 2012, 01:47:50 PM
I just finished writing my very first script - a quester for the Naturalist quest. It says a lot about this script and all of the tools and support documentation that you've provided that I was able to figure it out. Thanks for provided such fabulous tools!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on November 25, 2012, 02:15:18 PM
Awesome!  Glad to see someone else is using this!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: madatu on February 12, 2013, 09:41:31 PM
TM,   


    I have been trying to write a small rail. I have successfully wrote one i believe. I have read the pdf setup. Can the engine actually walk me around or does it need to be put into another script for any walking to happen. I have tried it in the root drive C:\  and looking in the easy uo.exe location by Railname.txt. If it will walk me where do i put in the script.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 12, 2013, 09:47:47 PM
Can you post the code you are referring to?  Generally, you need a little script that initializes the rail engine and sends the rail to the rail engine to run.  There is a mode that you can run (the "server" mode) that allows the rail engine to run the rail for you.  But still you need a little extra script that initializes the engine, loads the rail and executes the movement.  There is some sample code in the PDF file that should still work OK.

This post actually has some sample code you might look at:

http://www.scriptuo.com/index.php?topic=16.msg83988#msg83988
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Khameleon on February 16, 2013, 07:53:05 AM
I'm trying to do search for something after each way point, and i'm not sure if i'm going about this the right way....
it seems to be skipping over a bunch of WayPoints...
Code: [Select]
For %KhamRail 0 31
    {
    Event ExMsg #CharID 3 0 Railing to Position %KhamRail
    call %railsubs TM_RunRail %rail_label present %KhamRail FW
    Wait 2s
    FindItem xxx
    event ExMsg #charID 3 0 Searching....
    if #FindKind = -1
        goto end
    else
       ;Do something here
End:   
}
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 16, 2013, 08:22:38 AM
Did you walk when you recorded the waypoints? 

You might want to query the present rail position and use that for the starting index instead of using "present".  From you're code, it looks like you are just single stepping through the rail.  Also, you might give this a go:

Code: [Select]
    call %railsubs TM_RunRail %rail_label %KhamRail %KhamRail FW
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Khameleon on February 16, 2013, 08:25:59 AM
Yes.. I recorded them slowly, I tested them with your Generated, everything works fine.. but when I call it from my script using the above code, it rails way point 1-3 ok, then waypoint 4 is where waypoint 6 or 7 is.. and it keeps jumping up from there.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Khameleon on February 16, 2013, 08:38:47 AM
ok after further investigating..
each time it loops it keeps doubling for some reason.
from 1 to 2, to 3, then to 6.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 16, 2013, 08:40:07 AM
Here's another snippet to try:

Code: [Select]
set %continue #TRUE
while %continue
{
  call %railsubs TM_DetermineCurrentWaypointIndex
  if #RESULT <> 31 ; check for end of rail
  {
    set %next_index #RESULT + 1
    call %railsubs TM_RunRail %rail_label #RESULT %next_index FW  
    Wait 2s
    FindItem xxx
    event ExMsg #charID 3 0 Searching....
    if #FindKind <> -1
    {
      ;Do something here
    }
  }
  else
  {
    set %continue #FALSE
  }
}

What may be actually happening is the index is advancing by +1 at the end of the rail execution.  You may need to correct for this.  Using the above code, it should be easy to subtract one.  But give the above code a whirl because it should update you present rail index upon each movement.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Khameleon on February 16, 2013, 08:50:37 AM
 call %railsubs TM_DetermineCurrentWaypointIndex
seems not to be updating..
I keep getting a #Result of 0

I think the problem here is the first waypoint is 0
so it keeps trying to add 1 to 0
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 16, 2013, 08:59:35 AM
Hmm, should be.  That's the index that runs at the core of the engine.  You wouldn't be running rails at all if that value wasn't updating....
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 16, 2013, 09:33:49 AM
ok, try this:

Code: [Select]
set %railsubs tool_railengine30k.txt
set %rail_filename railfile.txt
set %rail_label  RAIL_LABEL1

call %railsubs TM_Initialize

call %railsubs TM_LoadRail %rail_filename

if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}
set #LPC 1000

set %continue #TRUE
while %continue
{
  call %railsubs TM_DetermineCurrentWaypointIndex
  if #RESULT <> 31 ; check for end of rail
  {
    set %current_index #RESULT
    call %railsubs TM_RunRail %rail_label present 2 FW
    Wait 2s
    display ok %current_index
  }
  else
  {
    set %continue #FALSE
  }
}

On thing to note about the rail engine is that the second index isn't the destination index, but the number of steps

Code: [Select]
call %railsubs TM_RunRail %rail_label present 2 FW

This steps once forward but does miss the first waypoint.  There's probably a ">" that should be a ">=" somewhere in the engine.  But you can live with the above code.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Khameleon on February 16, 2013, 09:41:16 AM
thats it.. TYVM, I thought that was the next waypoint in line.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 16, 2013, 10:33:00 AM
thats it.. TYVM, I thought that was the next waypoint in line.

heh, I forgot also!
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Alpha on February 17, 2013, 01:43:20 PM
Just getting around to playing with this & it's GREAT !   I'm thinking ok I get the whole index thing & can run them forwards & backwards I'm Good!   Then I start thinking about the next step & go back to look at the callback Function & I realize I probably just need to understand it all 100% or I will be just using a small fraction of the POWER !   Anyway....   Thanks !

Only TM can write a Tool that Requires 25+ pages of PDF to use / understand correctly.  I LoL'ed when I opened the PDF & went "hmm more to this than I'm prepared for!"
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 17, 2013, 07:36:09 PM
Heh yeh, I can't remember when I had the time to write that PDF.  lol - I must have been bored at one point in my life.

Well, I'm glad you're getting some use out of it.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Alpha on March 11, 2013, 02:28:40 PM
Is there some way to make it so that the rail engine doesn't take command of the mouse when it moves?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on March 11, 2013, 03:41:05 PM
There's around 8 instances of the "click" instruction in the rail engine.  Just comment all of them out. 

The next question should not then be "my rail doesn't work anymore while I play games on facebook"  heh.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Alpha on March 11, 2013, 05:06:31 PM
Yea thats what I ended up doing before I even read this.  I had forgotten about the "n" parameter for click though.   It wasnt ME.....it was the wife playing on facebook & shes happy now!

One last question just to confirm something.  When i record a rail being mounted / not mounted DOES matter correct?  Ive had a few instances where i ran a rail on foot when it was recorded mounted & it would get stuck but im thinking it simply cannot reach the Z-coord?
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on March 11, 2013, 08:45:18 PM
It's just a matter of how fast you record the rail.  Walking slows you down, and that leads to better recorded rails.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: kdzhii on March 29, 2015, 02:53:31 AM
Edit: think i got this now.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Shawn on February 06, 2019, 01:41:47 PM
I love this tool TM.  It has made railing so much nicer and organized for me, thanks!  I am trying to figure out what would be the best way to use the rail engine to travel into and out of a cave like the Trog cave that changes waypoints completely.  Now I am using it as 2 seperate rails with event moves in between but it feels like it could be done better with your engine somehow.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: TrailMyx on February 06, 2019, 09:52:56 PM
I would do 2 rails as well.  You can use the rail developer easily enough for this, but you'll probably have to go back and tweak the last way point to the exact location of the cave transition.

What would work best is to just handle the step through the cave enterence by hand and then start the next rail.  So rail short of the enterence, move/pathfind through and then rail again.   Sounds like this is what you're doing.
Title: Re: TrailMyx's Master Rail Engine/Developer
Post by: Cortes on March 31, 2022, 09:11:53 AM
I'm having issues getting the Rail Engine to work, and would greatly appreciate if anyone can help me understand what Im doing wrong.

To be clear, Im not having any issues with the rail developer. I am able to record, save, and load rails directly through the developer. My issue is getting my recorded rail to load through the engine, so I can loop the rail and get it to run automatically.

If Im understanding this correctly, I need to run a code snippet in conjunction with the rail engine code in order to parse the rail file name and get it to loop? The recorded rail is in c:\test.txt and Im using Windows 10.


This is the snippet that I am currently using:
Code: [Select]
set %railsubs tool_railengine30l.txt
call %railsubs TM_Initialize

set %railfilename test.txt
set %railname RAIL1

call %railsubs TM_LoadRail %railfilename
if #RESULT = #TRUE
{
  display ok Rail file not found
  stop
}

set #LPC 100
loop1:
  call %railsubs TM_RunRail %railname 0 END FW  ; finish running this rail from the present position to the end
  if #RESULT = #TRUE
  {
    display ok Rail error occurred.
  }
  call %railsubs TM_RunRail %railname 0 END BW  ; finish running this rail from the present position to the end
  if #RESULT = #TRUE
  {
    display ok Rail error occurred.
  }
  goto loop1

call %railsubs TM_Close
stop

Nothing happens when I try and run this code, no error code or nothing. Same when I try and run the rail engine, nothing happens, but I do get a blank interface (attached picture).


Sorry if Im a noob but I would greatly appreciate if anyone can help me get this working.