wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 06-24-2009, 03:56 PM   #16
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Exclamation HTML library

So, I've written my onw little HTML library, it should be self explaining!
code

PHP Code:
/**
*    Made for creating HTML Documents.
*
*    HTML Library
*    @author Seshiro
*    @version 1.0b
*    @date 2009
*    @type Library
*/

// The Last opened Tag;
global string _lastOpenedTag "";
// Opens a tag;
string writeTag(stringtw,string tag)
{
    
tw +="<"+tag">";
    
_lastOpenedTag tag;
    return 
"<"+tag">";
}
// Opens a tag, writes a value, and closes it again;
string writeTag(stringtw,string tagstring value)
{
    
string s "<"+tag">"+value+"</"+tag+">";
    
tw +=s;
    
_lastOpenedTag tag;
    return 
s;
}
// Opens a tag, with an id, a class, and some attributes;
string writeTag(stringtw,string tag,string id,string class,array<stringatts)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\"";
    for(
int i 0;size(atts);i++)
    {
        
+= atts[i];
    }
    
+= ">"
    
tw += s;
    return 
s;
}
// Opens a tag with an id, and a class;
string writeTag(stringtw,string tag,string id,string class)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\">";
    
tw += s;
    return 
s;
}
// I would implment a version, with only an id, but it's not possible! ;
// Closes the last opened tag;
string closeTag(stringtw)
{
    
tw += "</"+_lastOpenedTag+">";
    return 
"</"+_lastOpenedTag+">";
}
// Closes the given tag;
string closeTag(stringtwstring tag)
{
    
tw += "</"+tag+">";
    return 
"</"+tag+">";
}
// Returns an attribute;
string attr(string attstring value)
{
    return 
att "=\""+value+"\"";
}

// Gets the Code for an image;
string img(string src)
{
    return 
"<img src=\""+src+"\" alt=\"\"/>";
}
// Gets the Code for an image, with an 'alt'-string;
string img(string src,string alt)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\"/>";
}
// Gets the code for an image, with height and width;
string img(string srcint wint h)
{
    return 
"<img src=\""+src+"\" alt=\"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Gets the code for an image, with height, width, and an 'alt'-string;
string img(string src,string altint wint h)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Makes a html code like &laquo; ;
string htmlCode(string s)
{
    return 
"&"+s+";";
}
// Adds a linebreak;
string br()
{
    return 
"<br/>"
}

string hr()
{
    return 
"<hr/>"



Please Wite comments, its made just for fun :D
so, don't expect too much....

Greez
Seshiro is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 06-24-2009, 05:08 PM   #17
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

nice. However, you should escape html special chars in the input automatically (a matcher could do that most quickly).

Btw thoses &...; things you call "htmlCode" are called entity.

Maybe you should have a stack of opened tags, not only one last opened tag. If you had that stack and opened 3 tags inside each other, you could just call closeTag 3 times to close them all 3 (the innermost first of course).

Your method that takes attributes as an array is still a bit unsatisfying. You just print the attributes behind each other without whitespaces. A better solution:
Let it take an array with string keys, where the key is the attribute name and its content is the value. Then, you can make the method just print them like that:
(assuming i is now the iterating string
Code:
s += " " + i + "=\"" + atts[i] + "\""; 

You can check out my xml library from YouTD. It does stuff like that. The nice thing is it can automatically transform an arbitrary struct into its xml encoding.
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-25-2009, 03:38 AM   #18
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

It gave me a Null pointer exception when I tried to use clean unused imports

edit: then froze on the display all functions

Last edited by Bobo_The_Kodo : 06-25-2009 at 03:38 AM.
Bobo_The_Kodo is offline   Reply With Quote
Old 06-25-2009, 09:27 AM   #19
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

Quote:
Originally Posted by Bobo_The_Kodo
It gave me a Null pointer exception when I tried to use clean unused imports

edit: then froze on the display all functions
That is strange, I just tested the script on a map, it worked fine.

Can you give me the full error?
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-25-2009, 03:18 PM   #20
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Default

Overworked the code, due to Gexx' critics:
Hidden information:
PHP Code:
/**
*    Made for creating HTML Documents.
*
*    HTML Library
*    @author Seshiro
*    @version 1.0b
*    @date 2009
*    @type Library
*/

// The Last opened Tag;
global array<string_lastTags "";
// Opens a tag;
string writeTag(stringtw,string tag)
{
    
tw +="<"+tag">";
    
_lastOpenedTag tag;
    return 
"<"+tag">";
}
// Opens a tag, writes a value, and closes it again;
string writeTag(stringtw,string tagstring value)
{
    
string s "<"+tag">"+value+"</"+tag+">";
    
tw +=s;
    
_lastOpenedTag[] = tag;
    return 
s;
}
// Opens a tag, with an id, a class, and some attributes;
// The attributes must be saved like that: sar["style"] = "font-size: 12pt;"
string writeTag(stringtw,string tag,string id,string class,array<stringatts)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\"";
    for(
string i atts)
    {
        
+= " " "=\"" atts[i] + "\"";
    }
    
+= ">"
    
tw += s;
    
_lastOpenedTag[] = tag;
    return 
s;
}
// Opens a tag with an id, and a class;
string writeTag(stringtw,string tag,string id,string class)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\">";
    
tw += s;
    
_lastOpenedTag[] = tag;
    return 
s;
}
// I would implment a version, with only an id, but it's not possible! ;
// Closes the last opened tag;
string closeTag(stringtw)
{
    
string s _lastOpenedTag[];
    unset(
s[]);
    
tw += "</"+s+">";
    return 
"</"+s+">";
}
// Closes the given tag;
string closeTag(stringtwstring tag)
{
    
tw += "</"+tag+">";
    return 
"</"+tag+">";
}
// Returns an attribute;
// Now Obsolete, but i leave it inside!
string attr(string attstring value)
{
    return 
att "=\""+value+"\"";
}

// Gets the Code for an image;
string img(string src)
{
    return 
"<img src=\""+src+"\" alt=\"\"/>";
}
// Gets the Code for an image, with an 'alt'-string;
string img(string src,string alt)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\"/>";
}
// Gets the code for an image, with height and width;
string img(string srcint wint h)
{
    return 
"<img src=\""+src+"\" alt=\"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Gets the code for an image, with height, width, and an 'alt'-string;
string img(string src,string altint wint h)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Makes a entity like &laquo; ;
string entity(string s)
{
    return 
"&"+s+";";
}
// Adds a linebreak;
string br()
{
    return 
"<br/>"
}

string hr()
{
    return 
"<hr/>"

Seshiro is offline   Reply With Quote
Old 06-25-2009, 07:48 PM   #21
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

does that run without an error:
Code:
 unset(s[]);

I guess you meant rather _lastTags[] instead of s[] ;)
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-25-2009, 08:12 PM   #22
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

In "Script Output" it says:

Quote:
--- Executing script removeUnusedImports.gsl ---
null

--- Execution was aborted due to an error ---

In the Log & Warnings, it said this:

Quote:
--- Executing script removeUnusedImports.gsl ---
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.doo
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.imp
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3a
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3b
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3d
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3h
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3i
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3q
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3r
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3s
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3t
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.w3u
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.wct
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.wtg
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3map.wts
Deleting file C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\war3mapUnits.doo
Copying file from "C:\Documents and Settings\Administrator\Desktop\tAge of Myths v1.09g.w3x" to "C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x"
Trying to extract war3map.wts from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3i from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3a from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3b from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3d from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3t from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3h from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3q from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3u from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3mapUnits.doo from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.doo from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.wtg from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.wct from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3r from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.w3s from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
Trying to extract war3map.imp from C:\Documents and Settings\Administrator\Desktop\GMSI\temp\in\0\tAge of Myths v1.09g.w3x --> found
null

--- Execution was aborted due to an error ---

And in the black window it said:

Quote:
java.lang.NullPointerException
at script.systemCalls.Trap_StrPos.apply(Trap_StrPos.java:22)
at script.LRfinalTokens.NativeFunctionDefinition.call(NativeFunctionDefinition.java:53
at script.LRfinalTokens.FunctionCall.eval(FunctionCall.java:75)

and like 50 more lines of that
Bobo_The_Kodo is offline   Reply With Quote
Old 06-25-2009, 08:16 PM   #23
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

Quote:
Originally Posted by Bobo_The_Kodo

And in the black window it said:



and like 50 more lines of that

super thanks. That located it :). Will fix it ASAP.
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-26-2009, 04:05 PM   #24
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

okay, new version (v2.1.15) released.

Should fix that error :).

edit: oops v2.1.15 was buggy, v2.1.16 is the fix :)
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !

Last edited by gekko : 06-26-2009 at 05:08 PM.
gekko is offline   Reply With Quote
Old 06-26-2009, 08:56 PM   #25
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Default

Quote:
I guess you meant rather _lastTags[] instead of s[] ;)
- fixed
- fixed another mistake, with the directly closing writeTag!

Hidden information:

PHP Code:
/**
*    Made for creating HTML Documents.
*
*    HTML Library
*    @author Seshiro
*    @version 1.0
*    @date 2009
*    @type Library
*/

// The Last opened Tag;
global array<string_lastTags "";
// Opens a tag;
string writeTag(stringtw,string tag)
{
    
tw +="<"+tag">";
    
_lastOpenedTag tag;
    return 
"<"+tag">";
}
// Opens a tag, writes a value, and closes it again;
string writeTag(stringtw,string tagstring value)
{
    
string s "<"+tag">"+value+"</"+tag+">";
    
tw +=s;
    return 
s;
}
// Opens a tag, with an id, a class, and some attributes;
// The attributes must be saved like that: sar["style"] = "font-size: 12pt;"
string writeTag(stringtw,string tag,string id,string class,array<stringatts)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\"";
    for(
string i atts)
    {
        
+= " " "=\"" atts[i] + "\"";
    }
    
+= ">"
    
tw += s;
    
_lastOpenedTag[] = tag;
    return 
s;
}
// Opens a tag with an id, and a class;
string writeTag(stringtw,string tag,string id,string class)
{
    
string s "<"+tag+" id=\""+id+"\" class=\""+class+"\">";
    
tw += s;
    
_lastOpenedTag[] = tag;
    return 
s;
}
// I would implment a version, with only an id, but it's not possible! ;
// Closes the last opened tag;
string closeTag(stringtw)
{
    
string s _lastOpenedTag[];
    unset(
_lastOpenedTag[]);
    
tw += "</"+s+">";
    return 
"</"+s+">";
}
// Closes the given tag;
string closeTag(stringtwstring tag)
{
    
tw += "</"+tag+">";
    return 
"</"+tag+">";
}
// Returns an attribute;
// Now Obsolete, but i leave it inside!
string attr(string attstring value)
{
    return 
att "=\""+value+"\"";
}

// Gets the Code for an image;
string img(string src)
{
    return 
"<img src=\""+src+"\" alt=\"\"/>";
}
// Gets the Code for an image, with an 'alt'-string;
string img(string src,string alt)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\"/>";
}
// Gets the code for an image, with height and width;
string img(string srcint wint h)
{
    return 
"<img src=\""+src+"\" alt=\"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Gets the code for an image, with height, width, and an 'alt'-string;
string img(string src,string altint wint h)
{
    return 
"<img src=\""+src+"\" alt=\""+alt+"\" height="\""+h+"\" width=\""+w+"\"/>";
}
// Makes a entity like &laquo; ;
string entity(string s)
{
    return 
"&"+s+";";
}
// Adds a linebreak;
string br()
{
    return 
"<br/>"
}

string hr()
{
    return 
"<hr/>"



btw, should i post this as a seperate submission?

Last edited by Seshiro : 06-26-2009 at 08:59 PM.
Seshiro is offline   Reply With Quote
Old 06-26-2009, 11:44 PM   #26
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

>.>

Quote:
--- Executing script removeUnusedImports.gsl ---
Import ReplaceableTextures\CommandButtons\BTNSelectHero.blp was found in objects.ACtc.Art.
Malformed Pattern:
Unexpected internal error near index 1
\
^

--- Execution was aborted due to an error ---
Quote:
Evaluation Error at line 66 in file pattern.gsl:
Malformed Pattern:
Unexpected internal error near index 1
\
^
At code: native string replaceAll(string input,string pattern,string replacement);
Call stack:
called by line: 104, file: removeUnusedImports.gsl, code: replaceAll(importName,"\","\\")
--- Execution was aborted due to an error ---
Quote:
script.EvaluationError: Malformed Pattern:
Unexpected internal error near index 1
\
^
at script.LRfinalTokens.NativeFunctionDefinition.call(NativeFunctionDefinition.java:56)
at script.LRfinalTokens.FunctionCall.eval(FunctionCall.java:75)
at script.LRfinalTokens.AssignExpression.eval(AssignExpression.java:34
...
Bobo_The_Kodo is offline   Reply With Quote
Old 06-27-2009, 08:47 AM   #27
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

Quote:
Originally Posted by Bobo_The_Kodo
>.>
thx will be fixed in next version.

You can quickly fix it yourself:
Open remove unused imports script (in the script folder)
and replace line 104 with:
Code:
	importName = replaceAll(importName,"\\\\","\\\\\\\\");
There were too few backslashes in the function call :)
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-27-2009, 09:25 AM   #28
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Ok, some comments about remove unused imports

It asks me to remove DISBTNs, when the BTN is being used (it shouldn't)
It's asking me to remove stuff used in the game interface section, that is actually used
Bobo_The_Kodo is offline   Reply With Quote
Old 06-27-2009, 07:29 PM   #29
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

thx, will try to fix it :)
__________________
My stuff can be found at www.eeve.org

Check out latest GMSI !
gekko is offline   Reply With Quote
Old 06-27-2009, 08:35 PM   #30
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Correct me if i'm wrong but this tool can "only" edit map already saved, there is no way to call a script when i save a map with the JassNewGenPack, in the function compilemap_path of wehack.lua ?
Troll-Brain is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:00 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services