Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Old
chip
Member
 
chip's Avatar
 
Status: Offline
Posts: 24
Join Date: May 2011
Location: New Hampshire
Default 05-26-2011, 05:29 PM

Quote:
Originally Posted by arty-fishL View Post
Im not sure why there would be any lag if you are using a thread. Never have a while outside a thread, that's all I can think of. You could try inserting pauses with time.sleep in the thread, but I dont think that's what you are looking for.

For the extra Java class can you not just translate it all into Jython. Its not really that big a challenge and there isn't really a noticeable compile difference.
Yeah, I was surprised that using a thread didn't reduce or eliminate the lag. But it's definitely tied to the while loop in the thread's run() code, because modifying that changes the effect of the lag. I know it is actually threaded because errors in the thread are not trapped by the main thread -- they're not fatal, it seems, so I just use try:/except: to stop the thread when they occur and then it restarts again when the character moves.

The only other while loop I have is event-driven, so if I understand Alice events properly, that, too is threaded.

The main reason I'd like to do straight Java class-building is because so many of the main "tiled" features are kind of clumsy to access from script, if you can do it at all. For example I don't seem to be able to call any of the user-designed tiled methods from script, and have direct access only to variables, which can be used to trigger the tiled methods, but that's a kludge imo. There is also a great deal that the tiled methods cannot do, or do in an odd fashion that I'd like to modify. I'll probably use a combination of scripting and custom compiled classes, as well as taking advantage of some of the more convenient features of the tiled stuff.

Last edited by chip; 05-26-2011 at 05:31 PM.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 05-27-2011, 11:10 AM

If you have any understanding of the setup of the Alice Java code (being in the jar) then you may find the following line extremely useful:

Code:
authoringTool = edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.getHack()


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
chip
Member
 
chip's Avatar
 
Status: Offline
Posts: 24
Join Date: May 2011
Location: New Hampshire
Default 05-27-2011, 08:04 PM

I can't say I have a thorough understand of Alice/Java yet, but it's growing.

Good tip! Leads to all sorts of revelations. I'll have to see what can be done with that.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.