jwildfire.org

The official JWildfire forum
It is currently Sun May 24, 2020 11:12 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Nov 03, 2013 11:49 pm 
Offline
User avatar

Joined: Thu May 16, 2013 1:05 am
Posts: 490
Location: Vancouver,BC Canada
Is it possible to have a script read a Custom.txt file into a custom_wf variation so that manually adding the file is not necessary?


Top
   
PostPosted: Tue Nov 05, 2013 4:14 am 
Offline
User avatar

Joined: Thu May 16, 2013 1:16 am
Posts: 419
This is how we read in a subflame in a script:

// Subflame transform
{
XForm xForm = new XForm();

String flameXML = new java.util.Scanner(new java.io.File("/home/mick/j-wildfire_scripts_2013/Several_j-wildfire_and_Apo-Scripts_and_Tips/jw_05_01-15-13.flame")).useDelimiter("\\Z").next();
VariationFunc subFlame = VariationFuncList.getVariationFuncInstance("subflame_wf", true);
subFlame.setRessource("flame", flameXML.getBytes());

xForm.addVariation(1.0, subFlame);

xForm.setWeight(1.0);
currFlame.getXForms().add(xForm);
}


A flame is just text, and a subflame just contains text; a custom_wf also just contains text, so, I think this would work:

// Custom transform
{
XForm xForm = new XForm();

String flameXML = new java.util.Scanner(new java.io.File("/home/mick/j-wildfire_scripts_2013/Several_j-wildfire_and_Apo-Scripts_and_Tips/codefile.txt")).useDelimiter("\\Z").next();
VariationFunc customFlame = VariationFuncList.getVariationFuncInstance("custom_wf", true);
customFlame.setRessource("code", flameXML.getBytes());

xForm.addVariation(1.0, customFlame);

xForm.setWeight(1.0);
currFlame.getXForms().add(xForm);
}


Let me know if this works; I haven't tested it... :)


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 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® Forum Software © phpBB Limited
Theme Created by HOLLYSMOKE
Theme updated to phpBB 3.1.6 by KamijouTouma
Theme Version is 3.1.6-ss2