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 01-13-2007, 12:02 AM   #1
Brent
User
 
Join Date: Feb 2006
Posts: 14

Brent has little to show at this moment (0)

Default ASCII and warcraft

Hi, is there anyone who knows how Warcraft III converts ASCII to base ten?
I'm assuming it converts to base ten, since when doing I2S on the "integer" 'A' it spits out 65, which is the base ten equivilant of that ASCII character.

however, when doing I2S on the integer 'A000', i get a very large number (I don't have world editor open at the moment, but for 4-digit ASCII codes warcraft seems to convert them to 9 - 10 digit base 10 numbers)

does anyone know how warcraft arrives at these large numbers?

i found a script by peppar that converts a single ASCII character to decimal, and I want it to work on rawcodes.
Brent is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-13-2007, 12:15 AM   #2
CaptainPicard
User
 
CaptainPicard's Avatar
 
Join Date: May 2006
Posts: 205

Submissions (4)

CaptainPicard will become famous soon enough (55)CaptainPicard will become famous soon enough (55)

Approved Map: The Story of the Norj'Hal Elves

Default

Trying my hand at actually helping people, rather than just asking questions...

My thought is that it takes a 4-character string and converts it to an integer by multiplying the ASCII value of each character. An integer is a four-byte block, and a character is one byte. No coincidentally, 2^8 = 256 and 256^4 = 2^32 ~4,000,000,000, which is the maximum value of an unsigned integer.

But, to see if I'm correct, you should get

('A' = 65)*256^3 + ('0' = 48)*256^2 + ('0' = 48)*256 + ('0' = 48) = 1093677104

for your string 'A000'.

Now, since they're guaranteed to have certain character inputs (perhaps even alphanumeric ones) they may be doing the conversions differently, but since you say the integers are on the order of a billion, I expect they're doing it as I show above.

Capt. Picard
CaptainPicard is offline   Reply With Quote
Old 01-13-2007, 12:20 AM
Guesst
This message has been deleted by Guesst. Reason: 2late
Old 01-13-2007, 12:21 AM   #3
Brent
User
 
Join Date: Feb 2006
Posts: 14

Brent has little to show at this moment (0)

Default

Quote:
Originally Posted by CaptainPicard
Trying my hand at actually helping people, rather than just asking questions...

My thought is that it takes a 4-character string and converts it to an integer by multiplying the ASCII value of each character. An integer is a four-byte block, and a character is one byte. No coincidentally, 2^8 = 256 and 256^4 = 2^32 ~4,000,000,000, which is the maximum value of an unsigned integer.

But, to see if I'm correct, you should get

('A' = 65)*256^3 + ('0' = 48)*256^2 + ('0' = 48)*256 + ('0' = 48) = 1093677104

for your string 'A000'.

Now, since they're guaranteed to have certain character inputs (perhaps even alphanumeric ones) they may be doing the conversions differently, but since you say the integers are on the order of a billion, I expect they're doing it as I show above.

Capt. Picard
it appears that they only use the characters A-Z a-z and 0 - 9, however i've tested what you've suggested and it worked out perfectly. thanks a lot!!
Brent is offline   Reply With Quote
Old 01-13-2007, 04:09 AM   #4
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

Sry for hijacking this thread, but it seems like you got your question answered. So my question is:

Is there any type of program that converts colors into ascii that wacraft can understand?
Joker is offline   Reply With Quote
Old 01-13-2007, 04:11 AM   #5
wyrmlord
User
 
wyrmlord's Avatar
 
Join Date: Feb 2006
Posts: 399

Submissions (2)

wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)

Default

Like taking a color and converting it to a color code you mean? There's quite a few tools for that in the resources section.
__________________
A member of Clan TDG - Quality mapmaking and playtesting.

Tired of boring old GUI? Want to learn JASS? Take a look at these tutorials.
wyrmlord is offline   Reply With Quote
Old 01-13-2007, 04:29 AM   #6
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

I dont see any besides vex's one with the map, but i dont want to go back and forth between maps..
Joker is offline   Reply With Quote
Old 01-13-2007, 06:15 AM   #7
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

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

CS pools uses this
DioD is offline   Reply With Quote
Old 01-13-2007, 09:14 AM   #8
Daelin
Kelani Mage
 
Daelin's Avatar
 
Join Date: Oct 2003
Posts: 737

Submissions (48)

Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)

Hero Contest - First place

Default

If you actually need a program which takes the rawcodes (base 256) from an input file and writes into an output file the base 10 number (the long one) I made something in C++. Tell me if you want this. It's not very complex but it does the trick. :)

~Daelin
__________________
I am Grand Magister Daelin Silverwing not Grand Admiral Daelin Proudmoore!!!



Daelin is offline   Reply With Quote
Old 01-13-2007, 12:06 PM   #9
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Quote:
Originally Posted by Joker
Sry for hijacking this thread, but it seems like you got your question answered. So my question is:

Is there any type of program that converts colors into ascii that wacraft can understand?
Colors aren't converted into ascii.

Then again I swear that programs are impractical for this, it is way better to understand how RGB and hex work then |cAARRGGBBtext|r

AA : alpha value
RR : red value
GG : green value
BB : blue value

All of these values are numbers from 0 to 255 in hexadecimal, 0 is 00 , 16 is 10 , 128 is 80 and 255 is FF.

Most of the times you use FF as alpha.

And as for the rest, the bigger the values the lighter the color and viceversa.

FF000000 is black since it got 0 for red, green and blue
FFFFFFFF is white since it got 255 for the 3 main colors
FFFF0000 is pure red
FF00FF00 is pure green
FF0000FF is pure blue.

Then mixing colors is really easy, in the computer world green+red = yellow , green+blue=teal, and red+blue = pink

So FFFFFF00 is yellow.

Then you can get tones between

FFFFFF80 is a mix between yellow and blue. Also if you increase / decrease all of the values at the same time you get lighter and darker colors. FF000030 is a dark blue and FF8080FF is a lighter blue
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian 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 07:43 AM.


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

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