Author Topic: Unresponsible TForm with "while" cycle  (Read 31417 times)

0 Members and 1 Guest are viewing this topic.

Offline MrMongusTopic starter

  • Newbie
  • *
  • Posts: 8
  • Activity:
    0%
  • Reputation Power: 1
  • MrMongus has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Unresponsible TForm with "while" cycle
« on: November 08, 2019, 05:29:10 AM »
+1
Hello, sorry for maybe stupid question, but I'm stuck while creating menu.
I'm trying (about 14 days of trying and searching) to start and stop "while" cycle by buttons, but when I start cycle then menu stops responding.

I tried all sorts of crazy constructions, but I just couldn't. Certainly it will be related to the fact that I play it in the same thread ...I just don't know how the threads work in LUA, so if anyone would want to advise me, I'll be glad.

Please is there any way I can start and stop a "while" cycle using the form with button ?

Here is my last example of start/stop menu - that stops responding after start of course...
Spoiler: show

local val = false
function Main()
        frmMain = Obj.Create("TForm")
        frmMain.Left =          0
        frmMain.Top =           0
        frmMain.Width =         100
        frmMain.Height =        100
        frmMain.Font.Name =     "Arial"
        frmMain.Font.Size =     8
        frmMain.Caption =       "Some testing text"
        frmMain.OnClose =       function(pSender) Obj.Exit() end
        frmMain.FormStyle =     3
 
        btnStartStop = Obj.Create("TButton")
        btnStartStop.Caption =      "Start/stop"
        btnStartStop.OnClick =      function(pSender) btnOnClick(not val, pSender) end
        btnStartStop.Parent =       frmMain
        btnStartStop.Top =          10
        btnStartStop.Left =         20
        btnStartStop.Width =        100
 
        frmMain.Show()
        Obj.Loop()
end

function btnOnClick(value)
  while value == true do
    print("...")
    wait(500)
  end
end
 
function Clean()
        Obj.Free(btnStartStop)
        Obj.Free(frmMain)
end
 
Main()
Clean()


Thank you very much for your suggestions.

Offline MrMongusTopic starter

  • Newbie
  • *
  • Posts: 8
  • Activity:
    0%
  • Reputation Power: 1
  • MrMongus has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #1 on: November 11, 2019, 03:52:20 AM »
+1
OK, I give up, using an atom and two running scripts at the same time... It's not comfortable, but what can be done...

Offline Crisis

  • Global Moderator
  • *
  • *
  • Posts: 3091
  • Activity:
    1.6%
  • Reputation Power: 42
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +566
  • Referrals: 2
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #2 on: November 11, 2019, 05:58:54 AM »
+1
I am sorry you have had little help. I am not sure how many people actually use OEUO. I tried it a while back but got frustrated and gave up. This is within the first year of it and I could not find the variety of scripts nor make my own. I ended up going back to normal EUO.

Offline MrMongusTopic starter

  • Newbie
  • *
  • Posts: 8
  • Activity:
    0%
  • Reputation Power: 1
  • MrMongus has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #3 on: November 11, 2019, 06:19:52 AM »
+1
It's OK. I was just trying to ask. :) I read somewhere that an atom is perhaps the only option...

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #4 on: November 11, 2019, 07:57:55 AM »
+1
Its been years since I fiddled with OpenEUO,  I'm not 100% sure the menu system ever even completed.   My advise would be to look for a posted openeuo scripts that incorporates a menu system and see how they did it.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline MrMongusTopic starter

  • Newbie
  • *
  • Posts: 8
  • Activity:
    0%
  • Reputation Power: 1
  • MrMongus has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #5 on: November 12, 2019, 03:53:18 AM »
+1
....  I'm not 100% sure the menu system ever even completed. ...

Found it. Menu system was never completed. Multithreading is impossible except getatom and setatom commands - between two running scripts simultaneously.

The more I read about openEUO, the less I am sure I should stay with it. Good functionality easyuo outweighs the advantages of openeuo.

Can you think of a better alternative to the openEUO ?

EDIT: I'm looking at ScriptUO and it looks interesting, this alpha version is latest ? Is that usable as in description?
« Last Edit: November 12, 2019, 05:20:31 AM by MrMongus »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13312
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: Unresponsible TForm with "while" cycle
« Reply #6 on: November 12, 2019, 05:38:44 AM »
+1
This is pretty much why the rest of us stopped using it.  Both EN and I were pretty deeply involved in it at one point, but after we started uncovering issues that were pretty much broken at the core, we sort of abandoned it.  The hobbling of the multithreading was also an annoyance.

At first I really enjoyed LUA.  The syntax is very straight forward.  However the more I used it, I found it hard to implement the same constructs that are possible in EasyUO.  The lack of CONTINUE and BREAK as a programming construct was very annoying.  I hate even more when the authors of LUA were adamantly opposed to short-circuiting loops and made the decision not to include that functionality explicitly. (only to change their mind at some point down the line).

ScriptUO is just an editor for classic EasyUO. Nothing more.  It's a great programmer's editor though.  I pulled together the best features of all the programmer's editors I've used over the past and coupled it with the functionality I thought useful in helping program specifically in EasyUO.  Sadly the last feature was added nearly 10 years ago.  It still works which is amazing, however.
« Last Edit: November 12, 2019, 07:43:57 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: Unresponsible TForm with "while" cycle
« Reply #7 on: November 12, 2019, 05:46:28 AM »
+1
....  I'm not 100% sure the menu system ever even completed. ...

Found it. Menu system was never completed. Multithreading is impossible except getatom and setatom commands - between two running scripts simultaneously.

The more I read about openEUO, the less I am sure I should stay with it. Good functionality easyuo outweighs the advantages of openeuo.

Can you think of a better alternative to the openEUO ?

EDIT: I'm looking at ScriptUO and it looks interesting, this alpha version is latest ? Is that usable as in description?

Try Stealth,    I never really got into deeply as I stopped playing about the time it came out,  but I would say its probably the best platform.

http://www.scriptuo.com/index.php?board=145.0
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13312
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: Unresponsible TForm with "while" cycle
« Reply #8 on: November 12, 2019, 06:42:41 AM »
+1

Try Stealth,    I never really got into deeply as I stopped playing about the time it came out,  but I would say its probably the best platform.

http://www.scriptuo.com/index.php?board=145.0

The one I wanted to try until I stopped scripting was the new Razor Enhanced that has python scripting built-in.  I have no idea how well it works as you get past the surface and see how the gooey core is.

http://www.scriptuo.com/index.php?topic=15039.msg120324#msg120324
« Last Edit: November 12, 2019, 06:44:12 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: