|
|
#1 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
http://www.asciitable.com/
__________________It is possible to create spells/heroes/items with IDs that contain non-alphanumeric ascii characters Example: A#@~ Is there any limitation to using these that I should be aware? |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
default string
|
Don't use ] there are a couple others as well but I can't remember them. Maybe \ ; and " too. Also don't use Axxx and AXXX - they're counted as the same thing which messes shit up.
Last edited by Fledermaus : 02-23-2013 at 09:19 PM. |
|
|
|
|
|
#3 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
JASS:library Tags globals // every spell must belong to exactly one race public constant integer RACEX_HUMAN = 'H' public constant integer RACEX_ORC = 'O' public constant integer RACEX_UNDEAD = 'U' public constant integer RACEX_NIGHTELF = 'E' public constant integer RACEX_NAGA = 'N' public constant integer RACEX_DEMON = 'D' public constant integer RACEX_OTHER = 'X' // spell can belong to melle/ranged or both public constant integer RANGE_ANY = 0 public constant integer RANGE_MELEE = 1 public constant integer RANGE_RANGED = 2 // spell can belong to one type of hero STR/AGI/INT or all types public constant integer PRIMARY_ANY = 0 public constant integer PRIMARY_STR = 1 public constant integer PRIMARY_AGI = 2 public constant integer PRIMARY_INT = 3 // combined range+primary tags public constant integer ANY_ANY = '0' public constant integer MELEE_ANY = '1' public constant integer RANGED_ANY = '2' public constant integer ANY_STR = '3' public constant integer MELEE_STR = '4' public constant integer RANGED_STR = '5' public constant integer ANY_AGI = '6' public constant integer MELEE_AGI = '7' public constant integer RANGED_AGI = '8' public constant integer ANY_INT = '9' public constant integer MELEE_INT = ':' public constant integer RANGED_INT = ';' endglobals // example ability encodings // 'AH7x' - Human Melee Agi spell // 'AU9x' - Undead Int spell public struct Ability integer unitRange integer unitPrimary integer unitRace endstruct // example hero encoding // 'H4xx' - Human Melee Str hero // 'E;xx' - NightElf Ranged Int hero public struct Hero integer unitRange integer unitPrimary integer unitRace endstruct endlibrary I am too tired to finish this atm. If you would like to contribute please add any of these functions: 1. extracting Tags_Ability from abilitId 2. extracting Tags_Hero from heroId 3. function that returns true if Tags_Hero can have ability Tags_Ability EDIT: forget this, it is bad design. It is too rigid to hardcode hero/spell properties into IDs. There needs to be more flexibility with hero/spell classifications. Will probably just use hashtables for everything. Or even better importing data from SLK file!!! Last edited by cohadar : 02-24-2013 at 07:26 AM. |
|
|
|
|
|
#4 |
|
Moderator
RP Section Moderator
|
I've used this extensively in my map... now, where was it that I had huge problems...
__________________You can't use any of the quotation marks. These: ' and " Should be obvious, but for those that don't know, Warcraft 3's engine uses ' to denote the beginning and end of object IDs. i.e. 'hpal' is used for the Paladin. I think that trying to create an object ID that uses " or ' will crash the editor upon saving the map. I tested this a long time ago and didn't write down my findings, so my memory is hazy on that. I've used !, @, #, $, %, ^, &, and * with no problems. Even the blank character works! 'hpa ' as an object ID is valid. I don't know about ~ or the underscore, though. JASS script uses both parentheses ( and ) for defining a function's parameters. It also uses quotation marks (these " ") to denote strings, so you can't use these characters. Try typing "hp()" in JASS. It won't compile. I haven't tried {, }, [, or ] though. I assume that since % works, +, -, and = should work (haven't tried it). Hmm... I guess so long as you don't use impartial or combinations of IDs that would cause some kind of syntax function in JASS to happen, you should be okay. The reason why I tried using these object IDs is because an array can only carry 8192 indexes. No normal person would need this many indexes, but... if you store an object ID into an array by doing something like 'I000' - 'I000' it will return the array index of zero. It will do it this for 0 through 9 and then moves onto A through Z. However, if you know how ASCII works, you'll know that: 0 to 9 are characters 48 to 57 A to Z are characters 65 to 90 a to z are characters 97 to 122 (Unfortunately, Warcraft 3's game engine was made to assume that A = a, B = b, etc.) Characters 128 to 255 (see the link for details), Warcraft 3 can't even comprehend them. Don't try. If someone else can get them to work, that's great, but it never worked for me. What're those missing characters? Also, when you casually enter the object IDs from 'I000' to 'I00Z', the editor makes you move onto 'I010'. 'I000' - 'I000' will return zero, but 'I010' - 'I000' returns 256. So normally, if you're only using the object IDs that the Object Editor gives to you by default, you're only using about 35 of every 256 array indexes. That's a huge waste of space. In order to use those other characters though, you'll end up with funny looking object IDs, like 'I0@@' and stuff. Remember that the blank character is BEFORE 0, so 'I00 ' - 'I000' will return a negative. Last edited by Ignitedstar : 03-01-2013 at 08:35 AM. |
|
|
|
|
|
#5 | |
|
User
|
Quote:
|
|
|
|
|
|
|
#6 |
|
obey
|
you can run this java code to compile whatever ID you want to use.
i already have precompiled jar version with winpe wrapper, can post if anyone need it. DoOP is main execution part, it can be done much more faster but in completely obscure and unobvious way, if interesting i will post fast implementation. Code:
import java.awt.Button;
import java.awt.Color;
import java.awt.Event;
import java.awt.Font;
import java.awt.TextField;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class rxCalc extends JPanel {
static rxCalc instance = null;
TextField txtDisp;
TextField OUT;
public void init() {
xButton JustDoIt;
setLayout(null);
setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
instance = this;
Thread tt = new Thread(new Fun());
tt.setDaemon(false);
tt.start();
JustDoIt = new xButton("БЫСТРО РАБ", 0, 0);
add(JustDoIt);
JustDoIt.setBounds(8, 8+32+32, 256-16-8, 256-32-32-8-32);
txtDisp = new TextField("1093689649", 80);
txtDisp.setEditable(true);
add(txtDisp);
txtDisp.setBounds(8, 8, 256-16-8, 32);
OUT = new TextField("РЕЗУЛЬТАТ БЛЯТЬ", 80);
OUT.setEditable(true);
add(OUT);
OUT.setBounds(8, 8+32, 256-16-8, 32);
}
public void doOp(int nNewOp) {
Integer RC = 0;
try {
RC = Integer.parseInt(txtDisp.getText());
} catch (NumberFormatException e) {
OUT.setText("Хуета");
return;
}
OUT.setText("Считаем");
int[] data = new int[4];
data[0] = RC >> 24; RC %= 1<<24;
data[1] = RC >> 16; RC %= 1<<16;
data[2] = RC >> 8; RC %= 1<<8;
data[3] = RC;
OUT.setText(new String(data,0,4));
}
public static void main(String args[])
{
JFrame frm = new JFrame("rxCalc");
frm.addWindowListener(new ExitListener());
rxCalc pnl = new rxCalc();
pnl.init();
frm.add("Center", pnl);
frm.pack();
frm.setSize(256, 256);
frm.setVisible(true);
}
}
class xButton extends Button {
int mnOp;
int mnValue;
xButton(String sText, int nOp, int nValue) {
super(sText);
mnOp = nOp;
mnValue = nValue;
}
public boolean action(Event evt, Object arg) {
rxCalc par = (rxCalc) getParent();
par.doOp(mnOp);
return true;
}
}
class ExitListener extends WindowAdapter
{
public void windowClosing(WindowEvent event) {System.exit(0);}
}
class Fun implements Runnable
{
static Random RND = new Random();
public void run()
{
while (true)
{
rxCalc.instance.setBackground(new Color(RND.nextInt(255),RND.nextInt(255),RND.nextInt(255)));
try {Thread.sleep(100);} catch (InterruptedException e) {}
}
}
} |
|
|
|
|
|
#7 |
|
~There we go~
|
It may not matter, cohadar, but you mispelled "melee" at least once in your original code-post.
__________________ |
|
|
|
|
|
#8 |
|
Moderator
RP Section Moderator
|
Alternatively, you could make it so that your array index omits characters 0 to 31 and 128 to 256 altogether. That way 'H010' minus 'H000' would only be a difference of 96 instead of 256.
__________________If you're going to go that far, you could very well keep your object IDs cleaner by only using characters 0 to 9 and A to Z. Lowercase letters get turned into uppercase letters by the game engine anyway, so characters 97 to 122 are useless. We omit characters 32 to 47, 58 to 64, and 91 to 96. Then 'H010' minus 'H000' would only be a difference of 36 instead of 96. Then, your array index limit will be utilized to its maximum 8192 indexes without having any space in between that gets wasted. Then 'H100' minus 'H000' becomes [360] instead of [2560], 'H200' minus 'H000' is [720] instead of [5120], etc. THEN, we really can say, "Are you really going to have 8192 units/items/spells in your map?" Why didn't I think of that earlier? Duh. DUUUUH. I feel so stupid... Last edited by Ignitedstar : 04-15-2013 at 06:16 PM. |
|
|
|
|
|
#9 |
|
User
|
Lower case letters DO NOT get turned into upper case letters. For units, the case of the first letter of its ID indicates whether its a hero or a normal unit (upper case -> hero, lower case -> normal unit).
__________________Last edited by Deaod : 04-22-2013 at 10:04 PM. |
|
|
|
|
|
#10 |
|
Moderator
RP Section Moderator
|
Are you talking about units or abilities? Or both? I haven't tested it on units, but on abilities the latter doesn't work. I've tested it very extensively by making ability IDs using both the lowercase and uppercase letters.
__________________Yes, the game will realize that there is a difference between "H00a" and "H00A". You can give each ability to the same unit and they will appear as separate abilities. However, if you are triggering an ability and make the two abilities do something different, the game will try casting both. UNLESS in the last two years, they patched this. Last edited by Ignitedstar : 05-04-2013 at 05:54 AM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |