TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

How to terminate an infinite loop ?

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Aug 26, 2014 6:00 am    Post subject: How to terminate an infinite loop ? Reply with quote

Is there an hotkey or something to terminate or pause the execution of the code on TinTin ?

I had the bad situation where an action was calling an alias that was triggering that action.... so I wasn't able to do anything...

I can't find a list of hotkeys anywhere, can you give me some directions ?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Aug 26, 2014 6:33 am    Post subject: Reply with quote

There's a list of hotkeys if you type: #cursor

There's currently no way to break out of such a situation. I'll add it to my todo list.
Back to top
View user's profile Send private message Send e-mail
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Aug 26, 2014 12:14 pm    Post subject: Reply with quote

sweet Thumbs Up

and I knew that there was something under my nose I wasn't seeing Embarassed
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Tue Sep 02, 2014 12:52 pm    Post subject: Reply with quote

Harking back to the days of BASIC would <CTRL>-<(Pause)/Break> be a good combination to use, assuming it COULD? Blink

Actually, how would one recover from such a run-away case, with an arbitrary level of information on the stack? Would an #EVENT <BREAK> {} be useful so users could clean up afterwards - with a strict lock to prevent it being called if it is already in use just in case the user's clean up code is also bad?
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Sep 02, 2014 2:23 pm    Post subject: Reply with quote

It's better not to use Pause/Break as a default, this client is very portable and many devices don't have that key, including many handhelds and even new laptops...

I still didn't found the time to look at how this client works, so I don't know how much difficult it can be to "pause" a session, but to just interrupt an evil loop maybe an #ignore everything can be a simple solution...

so maybe you can at least change/save something and then "#ignore off" when you are ready, without loosing the entire session(s)

edit: but maybe the #ignore will be inserted at the end of the other looped commands... well... better late then never

Anyway I approve the EVENT {BREAK} proposal
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Sep 02, 2014 4:47 pm    Post subject: Reply with quote

Can use ctrl-z to pause and go to the shell, and use fg to return. Doesn't work while the program is stalled however.

ctrl-d is the only way to go about it that I know, as it's a signal the terminal sends to the process.
Back to top
View user's profile Send private message Send e-mail
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Sep 02, 2014 5:08 pm    Post subject: Reply with quote

strange... I'm unable to reproduce the infinite loop I had... the client closes itself

Code:
#action {hi} {sayhi}
#OK. {hi} NOW TRIGGERS {sayhi} @ {5}.
#alias {sayhi} {#showme hi}
#OK. {sayhi} NOW ALIASES {#showme hi} @ {5}.
sayhi
DEBUG_STACK[000] = script_driver(0x80010270,-1,0x8001fba0)
DEBUG_STACK[001] = parse_input(gts,sayhi)
DEBUG_STACK[002] = script_driver(0x80010270,1,0x80093670)
DEBUG_STACK[003] = do_showme(0x80010270,0x800a2120)
DEBUG_STACK[004] = [gts] do_one_line(hi)
DEBUG_STACK[005] = script_driver(0x80010270,0,0x26252c)
DEBUG_STACK[006] = parse_input(gts,sayhi)
DEBUG_STACK[007] = script_driver(0x80010270,1,0x800a2130)
DEBUG_STACK[008] = do_showme(0x80010270,0x8009ac38)
DEBUG_STACK[009] = [gts] do_one_line(hi)
DEBUG_STACK[010] = script_driver(0x80010270,0,0x239edc)
DEBUG_STACK[011] = parse_input(gts,sayhi)
DEBUG_STACK[012] = script_driver(0x80010270,1,0x800a9668)
DEBUG_STACK[013] = do_showme(0x80010270,0x8009acb8)
DEBUG_STACK[014] = [gts] do_one_line(hi)
DEBUG_STACK[015] = script_driver(0x80010270,0,0x21188c)
DEBUG_STACK[016] = parse_input(gts,sayhi)
DEBUG_STACK[017] = script_driver(0x80010270,1,0x800b0ba0)
DEBUG_STACK[018] = do_showme(0x80010270,0x8009ad38)
DEBUG_STACK[019] = [gts] do_one_line(hi)
DEBUG_STACK[020] = script_driver(0x80010270,0,0x1e923c)
DEBUG_STACK[021] = parse_input(gts,sayhi)
DEBUG_STACK[022] = script_driver(0x80010270,1,0x800b80d8)
DEBUG_STACK[023] = do_showme(0x80010270,0x8009adb8)
DEBUG_STACK[024] = [gts] do_one_line(hi)
DEBUG_STACK[025] = script_driver(0x80010270,0,0x1c0bec)
DEBUG_STACK[026] = parse_input(gts,sayhi)
DEBUG_STACK[027] = script_driver(0x80010270,1,0x800bf610)
DEBUG_STACK[028] = do_showme(0x80010270,0x8009ae38)
DEBUG_STACK[029] = [gts] do_one_line(hi)
DEBUG_STACK[030] = script_driver(0x80010270,0,0x19859c)
DEBUG_STACK[031] = parse_input(gts,sayhi)
DEBUG_STACK[032] = script_driver(0x80010270,1,0x800c6b48)
DEBUG_STACK[033] = do_showme(0x80010270,0x8009aeb8)
DEBUG_STACK[034] = [gts] do_one_line(hi)
DEBUG_STACK[035] = script_driver(0x80010270,0,0x16ff4c)
DEBUG_STACK[036] = parse_input(gts,sayhi)
DEBUG_STACK[037] = script_driver(0x80010270,1,0x800ce080)
DEBUG_STACK[038] = do_showme(0x80010270,0x8009af38)
DEBUG_STACK[039] = [gts] do_one_line(hi)
DEBUG_STACK[040] = script_driver(0x80010270,0,0x1478fc)
DEBUG_STACK[041] = parse_input(gts,sayhi)
DEBUG_STACK[042] = script_driver(0x80010270,1,0x800d55b8)
DEBUG_STACK[043] = do_showme(0x80010270,0x8009afb8)
DEBUG_STACK[044] = [gts] do_one_line(hi)
DEBUG_STACK[045] = script_driver(0x80010270,0,0x11f2ac)
DEBUG_STACK[046] = parse_input(gts,sayhi)
DEBUG_STACK[047] = script_driver(0x80010270,1,0x800dcaf0)
DEBUG_STACK[048] = do_showme(0x80010270,0x8009b038)
DEBUG_STACK[049] = [gts] do_one_line(hi)
DEBUG_STACK[050] = script_driver(0x80010270,0,0xf6c5c)
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Sep 02, 2014 5:24 pm    Post subject: Reply with quote

Ok, found, it closes when the loop it's too fast, this is a "working" infinite loop... but I still can launch other commands in the mean time...

Code:
#action {hi} {#delay {2} {sayhi}}
#OK. {hi} NOW TRIGGERS {#delay {2} {sayhi}} @ {5}.
#alias {sayhi} {#showme hi}
#OK. {sayhi} NOW ALIASES {#showme hi} @ {5}.
sayhi
hi
hi
hi
hi
etc...


I don't remember how that loop happened, I lost the entire script when I killed the process
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Sep 03, 2014 6:45 am    Post subject: Reply with quote

Best to write scripts in a text editor and load them with #read.

The #while command is easy to create an infinite loop with. Trigger loops will cause the client to close.
Back to top
View user's profile Send private message Send e-mail
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Wed Sep 03, 2014 10:35 am    Post subject: Reply with quote

I'm sure it happened with an #alias and an #action, because my error was to have made both the alias and the action too short, something like {ki%*} and everything starting with ki was making a mess.

The loop was VERY fast, but the client did not close itself, and I was unable to write commands, even CTRL+C or CTRL+Z weren't working... that's why I asked if there was an hotkey...

but now I tried different loops, and I'm always able to insert an #ignore during the mess...

I'll update if that situation happens again, maybe with more informations
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group