de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Namespacing troubleshot
PostPosted: Mon Nov 28, 2011 11:53 am 
Offline
Active member
Hi there,

I have been trying to define functions in my scripts to encapsulate some pieces of code and make cleaner scripts, but I had some problems calling the wait(sec) command from inside a function.

For what I believe (please someone correct me if Im wrong) every script on sexscripts is a ss.FullScript java object, and like every java object it has a wait() method to synchronize threads. The sexscripts script object overrides this method to implement his own wait(sec) command, and everytime we call it from a script, the the sexscripts built-in wait() is executed.

But I realized that if I call wait(sec) from inside a function, the original wait() method is executed cause when I run the script an IllegalMonitorStateException is thrown. for example, in the following code this exception is thrown:
Code:
setInfos(1, "testWait", "Wait call from function testing", "wololo", "started", -1, "en", []);

// Function definition
def myWait = {
   ->
   show("Hello world!");
   wait(3);
   show("");
}

// Script body
setImage(null);
show("");

myWait();

showButton("Exit");
return null;


I can fix that problem by calling the wait() with this.wait(), with this, the built-in sexscripts wait is executed:
Code:
def myWait = {
   ->
   show("Hello world!");
   this.wait(3);
   show("");
}


I don't understand why in the first case the original wait it's called, I think that the built-in wait should be called. does someone know why it happens, and how I can do to call the built-in wait with a simple wait(sec); call (without the this.) within a function?


Top
 Profile Send private message 
 
 Re: Namespacing troubleshot
PostPosted: Mon Nov 28, 2011 6:29 pm 
Offline
Site Admin
User avatar
Strange type conflict, it seems to use 3 as a long. Use wait(3.0) instead.

Yes, "wait" was not the best name possible. :oops:

(edit:later, this problem was corrected)


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  


cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.