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 > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 02-23-2013, 09:12 PM   #1
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,558

Submissions (5)

cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)

Default Ability Id limitations.

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?
__________________
<nosignature />
cohadar is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-23-2013, 09:16 PM   #2
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 604

Submissions (1)

Fledermaus has a spectacular aura about (134)

Send a message via MSN to Fledermaus
Default

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.
Fledermaus is offline   Reply With Quote
Old 02-23-2013, 10:22 PM   #3
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,558

Submissions (5)

cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)cohadar is a jewel in the rough (247)

Default

Collapse 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!!!
__________________
<nosignature />

Last edited by cohadar : 02-24-2013 at 07:26 AM.
cohadar is offline   Reply With Quote
Old 03-01-2013, 08:02 AM   #4
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,757

Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

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.
__________________
Current Activity: Spring
Evaluation: ...
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

— 1 Corinthians 13:1-2

Last edited by Ignitedstar : 03-01-2013 at 08:35 AM.
Ignitedstar is offline   Reply With Quote
Old 03-30-2013, 05:10 PM   #5
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (12)

Deaod is a jewel in the rough (182)Deaod is a jewel in the rough (182)Deaod is a jewel in the rough (182)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Quote:
Try typing "hp()" in JASS. It won't compile.
That is a compiler problem. Heres a version of PJASS that wont complain about this: http://www.wc3c.net/showpost.php?p=1...&postcount=155
__________________
Deaod is offline   Reply With Quote
Old 03-31-2013, 12:28 PM   #6
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,528

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

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) {}
		}
	}
}
DioD is offline   Reply With Quote
Old 04-01-2013, 07:42 PM   #7
Kyrbi0
~There we go~
 
Kyrbi0's Avatar
 
Join Date: May 2008
Posts: 2,885

Submissions (1)

Kyrbi0 has a spectacular aura about (143)

Send a message via MSN to Kyrbi0
Default

It may not matter, cohadar, but you mispelled "melee" at least once in your original code-post.
__________________
Kyrbi0 is offline   Reply With Quote
Old 04-15-2013, 06:03 PM   #8
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,757

Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

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...
__________________
Current Activity: Spring
Evaluation: ...
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

— 1 Corinthians 13:1-2

Last edited by Ignitedstar : 04-15-2013 at 06:16 PM.
Ignitedstar is offline   Reply With Quote
Old 04-22-2013, 10:04 PM   #9
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (12)

Deaod is a jewel in the rough (182)Deaod is a jewel in the rough (182)Deaod is a jewel in the rough (182)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

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.
Deaod is offline   Reply With Quote
Old 05-04-2013, 05:52 AM   #10
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,757

Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)Ignitedstar has a spectacular aura about (98)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

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.
__________________
Current Activity: Spring
Evaluation: ...
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

— 1 Corinthians 13:1-2

Last edited by Ignitedstar : 05-04-2013 at 05:54 AM.
Ignitedstar 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 05:10 PM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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