Jump to content

Photo

Automatic Global Script Combiner


  • Please log in to reply
40 replies to this topic

#16 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 06 October 2017 - 08:34 PM

It's normal it's not compile the combined script with Moosh's combined scripts ? (the copy of Combined.z ''Combined2.z'') I'll need to create a new combined script file ?



#17 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 06 October 2017 - 11:45 PM

It's normal it's not compile the combined script with Moosh's combined scripts ? (the copy of Combined.z ''Combined2.z'') I'll need to create a new combined script file ?

Link the scripts you're trying to combine. If it's a problem with the combiner I can fix it, but it could also be that the scripts are broken or not in the right format.



#18 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 07 October 2017 - 10:05 AM

Here's the global script 

https://www.purezc.n...=scripts&id=170



#19 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 07 October 2017 - 11:50 AM

Okay try it now. Should be fixed.



#20 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 07 October 2017 - 12:06 PM

alright



#21 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 October 2017 - 06:44 PM

Two minor things:

1. I think that you are ignoring any local functions to the global active script. Anything between the closing brace of run() and the closing brace of the script, may be ignored with the present code.

2. For comments, the best way to read them, is to read from // to EOL (end of line), looking for CR (carriage return) or similar end of line tokens. This will ensure that all forms of comments work.

You may also want to add a statement for block comments, as those are forthcoming. For those, you need only scan for */ and end with /* .

3. I think it would be best to save the output to a new file, and to select a file or series of files with button widgets. You should be able to dynamically add multiple files, and do an extra pass (per file beyond the second) to merge them all.

---------

Other notes: This does not look as if it would be terribly hard to convert to Pascal. If you like the JS syntax, I urge you to look at Pascal/FreePascal, as the syntax is similar, and you can use Pascal IDE tools to graphically build a UI and compile to most platforms.

If you want to get this bugger up on GitHub, and need help setting it up/learning how to do commits, I'll guide you through the process.

Edited by ZoriaRPG, 08 October 2017 - 07:14 PM.


#22 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 08 October 2017 - 11:00 PM

1. I think that you are ignoring any local functions to the global active script. Anything between the closing brace of run() and the closing brace of the script, may be ignored with the present code.

This is something that genuinely never crossed my mind that people might do. Is there any benefit to putting global script functions at local scope, aside from making combining scripts harder on people? :P

Anyways, this is definitely something I should add in a future version. Not looking forward to getting stuff between the last two closing braces, though. I imagine I'll need a new function for that...
 

2. For comments, the best way to read them, is to read from // to EOL (end of line), looking for CR (carriage return) or similar end of line tokens. This will ensure that all forms of comments work.

I don't think I have any functions that read what's in comments, but I'll keep that in mind.
 
 

3. I think it would be best to save the output to a new file, and to select a file or series of files with button widgets. You should be able to dynamically add multiple files, and do an extra pass (per file beyond the second) to merge them all.

I didn't know JavaScript did file output stuff. This is something I could add, although I wonder how many people would want to save scripts to individual files before combining them...

 

Something I did want to do at one point would be to link the program up with the PureZC database so you could search for and add scripts all in one easy step, but I guess apparently there's some sort of Same-origin Policy thing that prevents this. I can't imagine why someone wouldn't want scripts that mass harvest data from other websites. :P :P :P


  • Anthus likes this

#23 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 October 2017 - 06:31 PM

This is something that genuinely never crossed my mind that people might do. Is there any benefit to putting global script functions at local scope, aside from making combining scripts harder on people? :P

Anyways, this is definitely something I should add in a future version. Not looking forward to getting stuff between the last two closing braces, though. I imagine I'll need a new function for that...
 
I don't think I have any functions that read what's in comments, but I'll keep that in mind.


it has a development advantage, in that you can define functions that will not be in the global namespace. That means that you do not need to worry about your functions creating future issues, with other scripts that you release that use them.

This is primarily applicable to ffc scripts, but I've been known to do it with global scripts as well; and not only the active script. There are times where I have a similar function in Init,m Active, and OnContinue or OnExit, such as MainEventSetup().

That function may do different things in each script, and thus take advantage of the limited polymorphism available under ZScript.
 

I didn't know JavaScript did file output stuff. This is something I could add, although I wonder how many people would want to save scripts to individual files before combining them...


You should be able to read from a filesystem, but not write to it on the client-side. You will need some Perl in there to write (server-side), and allow downloading the output. JS is 'safeguarded' against this type of function; however, if the user runs this on their local system, then their local filesystem is treated as both the server, and the client, making it possible to create files.

I'd say that it is a terrible idea (security) to run any JS on a local machine that you do not understand.

Anyway, this is why a quick port to FP would be better, as it would run as binary on the client system, and be able to work with the filesystem. I'll look into it when I am feeling better, and see if there are any better interim options.
 

Something I did want to do at one point would be to link the program up with the PureZC database so you could search for and add scripts all in one easy step, but I guess apparently there's some sort of Same-origin Policy thing that prevents this. I can't imagine why someone wouldn't want scripts that mass harvest data from other websites. :P :P :P


Again, this would be bad. Intra-server script injection? Why would anyone ever guard against that? (JS is unsafe at all times, because it allows so much to run, invisibly.)

Edited by ZoriaRPG, 09 October 2017 - 06:32 PM.


#24 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 23 October 2017 - 08:02 AM

Btw, pin this maybe. ^^,


Edited by Avataro, 23 October 2017 - 08:02 AM.


#25 David

David

    Fallen leaves... adorn my night.

  • Administrators
  • Real Name:David
  • Pronouns:He / Him

Posted 23 October 2017 - 08:56 AM

I went ahead and pinned this topic because it will be very useful for a lot of people. Nice work! :)

  • Anthus likes this

#26 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 23 October 2017 - 12:40 PM

Thanks for pinning this, now I don't have to stalk Moosh's profile to find the thread cause I forgot which forum it was in. :D


  • David likes this

#27 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 24 October 2017 - 02:34 PM

I think i have an question.

 

If i put only the global script lines exemple

//Exemple for the script
global script GlobalScriptName{
	void run(){
		while(true){
			
			Waitdraw();
			
			Waitframe();
		}
	}
}

and i put only those lines to combine with another scripts, they'll still works if i input the correct global script without screw the entire global script ? 



#28 Evan20000

Evan20000

    P͏҉ę͟w͜� ̢͝!

  • Members
  • Real Name:B̵̴̡̕a҉̵̷ņ̢͘͢͜n̷̷ę́͢d̢̨͟͞
  • Location:B̕҉̶͘͝a̶̵҉͝ǹ̵̛͘n̵e̸͜͜͢d҉̶

Posted 25 October 2017 - 02:00 AM

Thanks for pinning this, now I don't have to stalk Moosh's profile to find the thread cause I forgot which forum it was in. :D

You should be stalking Moosh anyway to see if he leaves any useful ZScript droppings tbh. :D


  • Anthus likes this

#29 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 25 October 2017 - 02:25 AM

I think i have an question.

 

If i put only the global script lines exemple

//Exemple for the script
global script GlobalScriptName{
	void run(){
		while(true){
			
			Waitdraw();
			
			Waitframe();
		}
	}
}

and i put only those lines to combine with another scripts, they'll still works if i input the correct global script without screw the entire global script ? 

 

That should work. Merge in one global script at a time, to that, and you should be fine.

 

You may want to pay attention to what the merge tool changes, each time, so that you can do it yourself in the future.



#30 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 25 October 2017 - 03:50 PM

I'll try that then. Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users