| 08-24-2003, 07:43 PM | #1 |
If some one can tell me how to turn the frist 3 letters of a players name into 3-6 numbers that would be great. dodn't need the whole code planned out but just how to do it. And items too if thats possible. |
| 08-24-2003, 08:01 PM | #2 |
first create a string, then on initlization set it to the following text: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-=_+[]\{}|;':",./<>?`~" Next, just use 2 nested for loops to find the letter and corresponding index then just use the index as your value (ex 'Mar' becomes '132744') for values like 1 make sure to buffer them with zeros, so it becomes 01. For Items just convert their ID to an integer ('Xxxx' is already an integer, so there is really no conversion), then just use that value for the item, if you have charged items, you will need 1-2 more integers after that for the number of charges. (2 if you have any items with 10+ charges) |
| 08-24-2003, 08:24 PM | #3 |
2 nested loops? Can you go into a little more detail there? I created a string variable and then i set it. An i don;t get the next part. |
| 08-24-2003, 09:22 PM | #4 |
Sorry, I guiess I expect more people to know JASS. Code:
local integer i
local integer j
local string s
local integer value
set i = 1
loop
exitwhen i > 3 //Use only first 3 characters of name
set j = 1
loop
exitwhen j > 94 //length of 'letters' string
if(GetSubStringBJ(udg_PlayerName,i,i) == GetSubStringBJ(udg_Letters,j,j) then
if(j < 10) then // Buffer number with '0's
set s = s + "0" + I2S(j)
else
set s = s + I2S(j)
endif
set j = 94 // no need to keep scanning, we've already found the index
endif
set j = j + 1
endloop
set i = i + 1
endloop
set value = S2I(s)
//value is now your 6 digit number.you might want to check if GetSubStringBJ is the correct function name. Just open up your editor and set a string to SubString("",0,0) then convert that to custom text. |
| 08-24-2003, 10:08 PM | #5 |
Thanks. I don't know jass but it resembles C in a way... |
| 08-24-2003, 10:17 PM | #6 |
hum... any way to make only that trigger jass? |
| 08-24-2003, 10:31 PM | #7 |
If I understand what you mean, you just select the trigger, and in the menu click "Convert to Custom Text" or something of that sort. |
| 08-25-2003, 02:48 AM | #8 |
I don't really understand it enough... Since you have it worked out right here ill ask if anyone can make this code for me. Turns frist 3 letters of players name into numbers (already done just incluse the rest into it) Turns hero[number of triggering player] expierence into a number (hero[] is my hero array i have for each players hero, starts at 1) Turns items in heros invitory into the code too. if some one could put that all togther that would be great. Also is there a way to do unit types? Since it will be in JASS i won't be able to do much editing on the trigger. All i really need are the players name and hero experience, but the item feature would be cool to add in. |
| 08-25-2003, 03:38 AM | #9 |
Here, how about this, wait until Xmas, then I will release a second version of the DarkCrescent Server program, so that you can you can work on others parts of your map. The program will also come with a text file that will have the required triggers in your program (the saving string you need) |
| 08-25-2003, 03:41 AM | #10 |
Yeah, the dark cresent thing will work, i've been fallowing that mod. The only problem is that i have to wait until late december... Oh well, i release it without a save feature and when Xmas comes ill release a saving version. I'll see what other people will like more. |
