www.ClassicTW.com
http://classictw.com/

Something Changed
http://classictw.com/viewtopic.php?f=45&t=32820
Page 1 of 1

Author:  T0yman [ Tue Jan 31, 2012 10:08 am ]
Post subject:  Something Changed

Some changed in the way you exit out. Now when you start Mombot from within game it jumps to:

==-- Trade Wars 2002 --==

T - Play Trade Wars 2002
I - Introduction & Help
S - View Game Settings
H - High scores
M - View Access Modes
X - Exit

Enter your choice:

Like normal but it is not relogging back in. So the question is WHAT CHANGED? There is no trigger that would cause a relog so something has changed on that screen. If I hit * <enter> it kicks off just fine, but some trigger it wants has changed...... Once I find the issue I will post a fix unless someone beats me to it. :)

Author:  T0yman [ Tue Jan 31, 2012 10:31 am ]
Post subject:  Re: Something Changed

Adding a single line will correct the issue

# ============================== GAME STATS ==============================
:gamestats
if ($startingLocation = "Citadel")
send "qqzn"
end
if (($startingLocation = "Command") OR ($startingLocation = "Citadel"))
send "qyn"
waitfor "Enter your choice" <--- This will fix the issue
send #42 "*"

So on my initial testing this seems to fix the issue and will allow the bot to work correctly.

EDIT: I have tested on mine and RP's servers running 2.17 works without a hitch. I hope this helps someone else :)

Author:  John Pritchett [ Tue Jan 31, 2012 10:56 am ]
Post subject:  Re: Something Changed

Ok, but I don't want people to have to change their scripts for an unintended change. Let's figure out what changed so I can restore it.

Author:  T0yman [ Tue Jan 31, 2012 11:03 am ]
Post subject:  Re: Something Changed

I compared what I can see visually and nothing is jumping out at me. The change I placed in the above post will work with all version's so it won't make a difference on mine. But I have an older version I can test if you need me to check some thing for you later.

Author:  John Pritchett [ Tue Jan 31, 2012 11:05 am ]
Post subject:  Re: Something Changed

Can I see what was being triggered on before you fixed it? That might shed some light.

Author:  T0yman [ Tue Jan 31, 2012 11:10 am ]
Post subject:  Re: Something Changed

If you remove the waitfor line I added thats all it was sending. My guess is that there is a slight delay going to that menu causing the - send #42 "*" not to be sent at the right time.

I read another thread.... this might be causing the delay.

2) If the player exits the game to the start menu, the game will actually close, then re-open and return to the start menu. Before, it would just fall back to the start menu, but this allowed certain variables to be in an undefined state when restarting the game.

Author:  John Pritchett [ Tue Jan 31, 2012 11:36 am ]
Post subject:  Re: Something Changed

Yes, that is a change for this version. But there should be no difference in the output. From the player's side, it should be impossible to tell that the game closed and restarted vs that it just dropped to the startup menu. If there is any change (and you'd see it in a raw log even if you visually can't see something), I can clean it up.

Author:  John Pritchett [ Tue Jan 31, 2012 11:38 am ]
Post subject:  Re: Something Changed

Oh, I think I see what it might be. When TW is closing and then restarting, it's discarding input that would otherwise have been sent to the startup menu. There seems to be a period of time in which data sent to TW is pulled off the socket but not used. That isn't supposed to happen, so I'll clean that up. Then even if you send the "*" line before getting back into the startup menu, it will get processed by the startup menu just as before.

Author:  T0yman [ Tue Jan 31, 2012 11:40 am ]
Post subject:  Re: Something Changed

Yep, thanks John.... not bad we got this one discussed in under 3 pages.... :lol:

Author:  mob [ Tue Jan 31, 2012 2:35 pm ]
Post subject:  Re: Something Changed

I just went over the same thing with Vid, and thats what my post was in Crosby's thread. I came up with the exact same fix and tested it multiple times. I figured the same thing that happened to crosby might have some how happened here.

(9:58:00 AM) 421291872: :gamestats
if ($startingLocation = "Citadel")
send "qqzn"
end
if (($startingLocation = "Command") OR ($startingLocation = "Citadel"))
send "qyn"
waiton "Enter your choice:"
send #42 "*"
(9:58:25 AM) 421291872: without the waiton it just sits at the game menu...not main menu
(9:58:41 AM) 421291872: once I put that in it works perfect

Author:  John Pritchett [ Tue Jan 31, 2012 3:06 pm ]
Post subject:  Re: Something Changed

This is fixed. I may provide RP with the fixed version, but hold the public release until we see if any more bugs surface and can be fixed. At least a few days wait.

What was happening here was that input that was buffered on TW along with the Qy commands were getting discarded when TW shut down and restarted. With the fix, I will buffer up to 1024 characters of data between the quit prompt and the startup menu. This will fix the bug you're describing, but I think it'll become more important once I start using this restart mechanism to support warping from one game to another. In that case, I'd expect to see more input buffered as a player warps through a jumpgate from one game into another.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/