Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-13-2011, 04:12 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
keydown, float, and more.

When checking if the direction keys are pressed,
PHP Code:
temp.sum 0;
for (
temp.i: {0,1,2,3})
  
temp.sum += keydown(temp.i);
echo(
temp.sum); 
is always less than or equal to 2. I can understand doing this as an optimization, but can it at least choose to report the keys that do not also have the reverse direction pressed?
e: Nevermind the above. Thanks, Jazz.

Additionally,
PHP Code:
echo(float("0.0")) 
prints -1.

e: Another bug just recently discovered. sleep-like functions are messing up the callstack. The specifics are:
  • the parent caller is a public function
  • the call is to a public function of another object (I've tried both weapon and TStaticVar)
  • the public function contains a sleep-like function. Before the sleep, the callstack correctly contains an entry for the caller, afterwards, it does not
  • script hangs indefinitely

In as terse a script as possible:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.= new TStaticVar();
  
temp.b.= function () { return this.c.a("f"); };
  
temp.b.= new TStaticVar();
  
temp.b.c.= function (b) { sleep(1); return "a" b; };
  
player.chat temp.b.a();
  
/* the below never gets executed */
  
player.chat "?";

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 10-13-2011 at 05:29 PM..
Reply With Quote
  #2  
Old 10-13-2011, 06:40 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
As for the keydown thing, thats not a limitation of Graal, thats a limitation of your keyboard.

My keyboard allows me to press left, right, and down at the same time. (So with your script, it = 3)
But I cannot do up/down/left.

However, if I use the num keys, I can do all four directional buttons at once. (The script outputs 4)

So, yeah.
__________________

Reply With Quote
  #3  
Old 10-13-2011, 08:55 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by oo_jazz_oo View Post
As for the keydown thing, thats not a limitation of Graal, thats a limitation of your keyboard.

My keyboard allows me to press left, right, and down at the same time. (So with your script, it = 3)
But I cannot do up/down/left.

However, if I use the num keys, I can do all four directional buttons at once. (The script outputs 4)

So, yeah.
So it is! I had someone else try on their computer and reported the same problem... oh well. Thanks.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #4  
Old 10-13-2011, 10:38 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The thing about float(string) is that it's only returning 0 if the string is really "0". That way you can check if it's a number and not a name or so. May be it could also allow "0.0" (but then you complain about 0.0000 i guess

I can check the problem with sleep(). The thing is that waitfor() is working fine, so it might be a problem of the sleeping object not being active (some this.trigger("update",""); or so could fix it).
Reply With Quote
  #5  
Old 10-13-2011, 10:50 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Stefan View Post
The thing is that waitfor() is working fine, ...
I actually uncovered this because waitfor exhibits this behavior.

e: The call stack is only severed at the call from script A to script B. The call stack is intact for any function calls within B.

What I have looks like this:

A
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
thing = new TStaticVar();
  
thing.set = function () {
    if (
B.ask("Are you sure?")) {
      
fool_the_DCO 1;
    }
    echo(
"foo"); // never called
  
};
}

function 
onKeyPres$ed() {
  
thing.set();

$ inserted to get around the silly security.

B
PHP Code:
//#CLIENTSIDE
public function ask(text) {
  
temp.resp display(text,{"yes","no"});
  echo(
temp.resp); // echo just fine
  
return temp.resp// call stack severed, never returns
}

function 
display() {
  for (
temp.i=0temp.i<pagestemp.i++) {
    
// ask for player input
    
while (!waitfor(this.name,"onPlayerInput"));
    
temp.some_datum;
  }
  return 
temp.r// returns just fine

Or on Zenkou, pfatest: 432-6, SystemAlerts.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 10-14-2011 at 12:15 AM..
Reply With Quote
  #6  
Old 10-14-2011, 12:56 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Well in that case it might a problem that your TStaticVar has no name... Would be good to check that. We are using tons of waitfors in other objects (database queries) and never had problems with that.
Reply With Quote
  #7  
Old 10-14-2011, 02:39 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Stefan View Post
Well in that case it might a problem that your TStaticVar has no name... Would be good to check that. We are using tons of waitfors in other objects (database queries) and never had problems with that.
The TStaticVar has a name in the actual code.

e: This mimics exactly the problem I've been having:
PHP Code:
function onCreated() {
  
this.call = function () {
    echo(
"before" SPC getcallstack().size()); // before 3
    
waitfor(this.name,"ignoreme",1); // equivalently, sleep(1);
    
echo("after" SPC getcallstack().size()); // after 1
    
return "test";
  };
  
temp.= new TStaticVar("A");
  
temp.a.call = function (caller) {
    
temp.resp caller.call();
    echo(
temp.resp);
    return 
temp.resp;
  };
  echo(
temp.a.call(this));

However, I think this illustrates an even deeper problem:
PHP Code:
//#CLIENTSIDE

function onCreated() {
  
temp.= new TStaticVar("B");
  
temp.b.call = function () {
    echo(
"before" SPC getcallstack().size()); // before 2
    
sleep(1);
    echo(
"after" SPC getcallstack().size()); // never gets executed...
    
return "test";
  };
  echo(
temp.b.call());

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 10-14-2011 at 05:40 AM..
Reply With Quote
  #8  
Old 10-14-2011, 08:11 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Well this might be more a problem of your use of function pointers, just tried simply to se script classes?
Reply With Quote
  #9  
Old 10-14-2011, 05:50 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Stefan View Post
Well ..., just tried simply to se script classes?
Yes, this fixes the problem, but can nothing be done about sleep and waitfor in an anonymous function? e: Because in fact, the offending sleep in my code is in a regular function in a weapon/GUI, which is called by a public function of that weapon/GUI, and it is still causing the execution to halt within my anon. function. While I can verify that the return within the function is working correctly, the same cannot be said of the public function.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 10-14-2011 at 06:06 PM..
Reply With Quote
  #10  
Old 10-17-2011, 10:06 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Ok the problem is that a script-less object cannot continue after sleep or waitfors, will be fixed in the next version.
Reply With Quote
  #11  
Old 10-17-2011, 10:12 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Stefan View Post
Ok the problem is that a script-less object cannot continue after sleep or waitfors, will be fixed in the next version.
Great; thank you!
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #12  
Old 10-18-2011, 12:19 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Nice!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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


All times are GMT +2. The time now is 10:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.