Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Announcements (https://forums.graalonline.com/forums/forumdisplay.php?f=240)
-   -   GS3 conversion tool (Updatedx2) (https://forums.graalonline.com/forums/showthread.php?t=134268330)

Admins 06-16-2013 01:59 PM

GS3 conversion tool (Updatedx2)
 
We have worked on a tool for converting GraalScript2 to the new Graalscript3 syntax:

http://graalscript3.graalonline.com/

You can use it to test a little bit and see how the new scripting will look like. We plan to release GS3 officially in a few weeks, after improving compatibility and features.

Edit: Updated on June 21 to add better support for global functions and types! You have to restart the npcserver.
Edit: Updated on June 24 to fix object attributes like player.account (TServerPlayer.account), no additional restart required.

Chompy 06-16-2013 02:19 PM

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.speed 1;
}

function 
onTimeout() {
  
player.+= (keydown(3)-keydown(1))*this.speed;
  
player.+= (keydown(2)-keydown(0))*this.speed;
  
setTimer(0.05*this.on);
}

function 
onKeyPressed(codekey) {
  
this.on abs(this.on-(key=="b"));
  
setTimer(0.05*this.on);
}
function 
onPlayerChats() {
  if (
player.chat.starts("/speed ") && this.on) {
    
this.speed int(player.chat.substring(7));
  }


Tested this staff boots script, just to see how it works, and it gave this error in the onPlayerChats() event, right under the if statement:
NPC Code:
Unexpected symbol 'if'



But apart from that, looking good!

BlueMelon 06-16-2013 03:01 PM

Fails to convert a 50 line script when I tried..
(No error just stays at "Converting..." forevor)

Chompy 06-16-2013 03:29 PM

Quote:

Originally Posted by BlueMelon (Post 1719314)
Fails to convert a 50 line script when I tried..
(No error just stays at "Converting..." forevor)

I think posting the script could help with debugging it and to find a solution :)

scriptless 06-16-2013 04:34 PM

Sweet. Looking forward to an official release.

Julien 06-17-2013 01:50 PM

Quote:

Originally Posted by Chompy (Post 1719312)
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.speed 1;
}

function 
onTimeout() {
  
player.+= (keydown(3)-keydown(1))*this.speed;
  
player.+= (keydown(2)-keydown(0))*this.speed;
  
setTimer(0.05*this.on);
}

function 
onKeyPressed(codekey) {
  
this.on abs(this.on-(key=="b"));
  
setTimer(0.05*this.on);
}
function 
onPlayerChats() {
  if (
player.chat.starts("/speed ") && this.on) {
    
this.speed int(player.chat.substring(7));
  }


Tested this staff boots script, just to see how it works, and it gave this error in the onPlayerChats() event, right under the if statement:
NPC Code:
Unexpected symbol 'if'



But apart from that, looking good!

There was a problem with the '&' and '&&' operators.
It's fixed now.
Your script is reporting more meaningful errors.

Please note that built-in global functions are only partially supported:
"keydown" and "setTimer" are still being reported as not existing functions.

Draenin 06-17-2013 02:33 PM

It'd be nice if this were integrated into RC, and not a web page that people have to find via the forums. (Most likely months later.)

scriptless 06-17-2013 03:57 PM

Quote:

Originally Posted by Draenin (Post 1719343)
It'd be nice if this were integrated into RC, and not a web page that people have to find via the forums. (Most likely months later.)

They probably wont even know it's enabled until they see the thread tho.. lol

fowlplay4 06-17-2013 05:15 PM

Quote:

Originally Posted by Julien (Post 1719342)
There was a problem with the '&' and '&&' operators.
It's fixed now.
Your script is reporting more meaningful errors.

Please note that built-in global functions are only partially supported:
"keydown" and "setTimer" are still being reported as not existing functions.

look guys its either an intern or paid eurocenter employee!

Dragon551 06-17-2013 06:27 PM

Quote:

Originally Posted by fowlplay4 (Post 1719350)
look guys its either an intern or paid eurocenter employee!

He's watching us..

Cubical 06-17-2013 08:28 PM

Quote:

Originally Posted by fowlplay4 (Post 1719350)
look guys its either an intern or paid eurocenter employee!

dont be silly, its ravej's troll account where he actually uses spell check

callimuc 06-17-2013 08:39 PM

Quote:

Originally Posted by Julien (Post 1719342)
There was a problem with the '&' and '&&' operators.
It's fixed now.
Your script is reporting more meaningful errors.

Please note that built-in global functions are only partially supported:
"keydown" and "setTimer" are still being reported as not existing functions.

OMG HAII!!! Enjoy your stay

Gunderak 06-19-2013 08:43 AM

Failed completely :/
PHP Code:

public function NewRC(acc){
  
//Let NC messages send first..
  
sleep(5);
  
temp.comment this.GetComments(acc);
  if(
md5(comment) != this.(@acc)){
    
acc.sendtorc("Your comments have changed since you last logged on.");
  }
  
this.(@acc) = md5(comment);
}
function 
GetComments(ac){
  
temp.st temp.ac.substring(02);
  
temp.path format("accounts/%s/%s.txt"stac);
  
temp.file.loadstring(temp.path);
  
temp.file temp.file.tokenize("\r\n");
  
temp.comments;
  for(
temp.line temp.file){
    if(
line.starts("COMMENTS")){
      return 
line.substring(9);
    }
  }
  return 
"none";



Julien 06-19-2013 09:15 AM

Quote:

Originally Posted by Gunderak (Post 1719407)
Failed completely :/
PHP Code:

public function NewRC(acc){
  
//Let NC messages send first..
  
sleep(5);
  
temp.comment this.GetComments(acc);
  if(
md5(comment) != this.(@acc)){
    
acc.sendtorc("Your comments have changed since you last logged on.");
  }
  
this.(@acc) = md5(comment);
}
function 
GetComments(ac){
  
temp.st temp.ac.substring(02);
  
temp.path format("accounts/%s/%s.txt"stac);
  
temp.file.loadstring(temp.path);
  
temp.file temp.file.tokenize("\r\n");
  
temp.comments;
  for(
temp.line temp.file){
    if(
line.starts("COMMENTS")){
      return 
line.substring(9);
    }
  }
  return 
"none";



Hello,

After trying the above code on http://graalscript3.graalonline.com/, it reports successful conversion.
The conversion is not really perfect though. For example, the converter tool cannot guess the type of the "acc" parameter in the "NewRC" function.

When checking syntax, several errors are reported.
Some errors are valid, others are not (for example "md5" function is not supported yet).

Could you please detail what is going wrong on your side?
Do you have any error reported? Is the conversion running forever maybe?

Gunderak 06-19-2013 09:38 AM

No, it converts it with errors.
The main problem is the md5, the rest I could convert myself, and did.
How would I reference md5?
It would be cool if we could do something like global::md5() or using namespace global;


All times are GMT +2. The time now is 04:41 AM.

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