Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Hi all, I have a problem here with setting strings.
Here some examples:
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(0)))))
I cant understand why when Im setting simple text or number it isn't working, but when Im setting number with Integer A I get it working. Is that is some kind of we bug?
Hi all, I have a problem here with setting strings.
Here some examples:
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(0)))))
I cant understand why when Im setting simple text or number it isn't working, but when Im setting number with Integer A I get it working. Is that is some kind of we bug?
Im trying to make my own one save/load system only with numbers (conwerting letters to numbers)
Here's trigger:
save
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Actions
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), 1, 1))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(0)))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), (Length of (Name of Hero[(Player number of (Triggering player))])), (Length of (Name of Hero[(Player number of (Triggering player))]))))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2)))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: (-load + (String(save_code[(Player number of (Triggering player))])))
Unit - Remove Hero[(Player number of (Triggering player))] from the game
Set Hero[(Player number of (Triggering player))] = No unit
I added "game display" before actions (setting) and got that conditions are 100% working properly.
So the problem is in action.
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + ((String(0)) + (String((Integer A)))))))
well, first of all get rid of Do Nothing as that's an extra, unneeded process that's run. Just leaving it blank is sufficient, the language is smart enough to know to do nothing.
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
won't substring return a/b/c.. and what with A=52? (which is end of loop)
I suppose it will be null and if you hero name is not null then it won't work.
and this:
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), 1, 1))
Are you sure that it will return anything? It's hard to help if you won't atach any map coz I can't see init. Try to debug this way to know if some variable is not ititialized:
save
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Actions
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), 1, 1))
quest - message <<hero_name>>}
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
quest - message <<string(integer A)>>}
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
quest - message <<save_code>>}
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(0)))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
quest - message <<save_code>>}
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), (Length of (Name of Hero[(Player number of (Triggering player))])), (Length of (Name of Hero[(Player number of (Triggering player))]))))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2)))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: (-load + (String(save_code[(Player number of (Triggering player))])))
Unit - Remove Hero[(Player number of (Triggering player))] from the game
Set Hero[(Player number of (Triggering player))] = No unit
well, first of all get rid of Do Nothing as that's an extra, unneeded process that's run. Just leaving it blank is sufficient, the language is smart enough to know to do nothing.
Read chapter g. and please confirm me that you are sure that it's got nothing to do with that.
Also: you might find some usefull tips in that tutorial
EDIT: Sorry I haven't really got the time to look into this enormous trigger, have to create a report of 30 pages -,-"
I can only give some guidelines on analysis of your problem. I can't go into detail at this moment
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
won't substring return a/b/c.. and what with A=52? (which is end of loop)
I suppose it will be null and if you hero name is not null then it won't work.
and this:
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), 1, 1))
Are you sure that it will return anything? It's hard to help if you won't atach any map coz I can't see init. Try to debug this way to know if some variable is not ititialized:
save
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Actions
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), 1, 1))
quest - message <<hero_name>>}
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
quest - message <<string(integer A)>>}
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
quest - message <<save_code>>}
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(0)))))
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
quest - message <<save_code>>}
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), (Length of (Name of Hero[(Player number of (Triggering player))])), (Length of (Name of Hero[(Player number of (Triggering player))]))))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Set Hero_name[(Player number of (Triggering player))] = (Substring((Name of Hero[(Player number of (Triggering player))]), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2), ((Length of (Name of Hero[(Player number of (Triggering player))])) / 2)))
For each (Integer A) from 1 to 53, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_name[(Player number of (Triggering player))] Equal to (Substring(abc, (Integer A), (Integer A)))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (String((Integer A)))) Equal to 2
Then - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String((Integer A))))))
Else - Actions
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (0 + (String((Integer A)))))))
Else - Actions
Do nothing
Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: (-load + (String(save_code[(Player number of (Triggering player))])))
Unit - Remove Hero[(Player number of (Triggering player))] from the game
Set Hero[(Player number of (Triggering player))] = No unit
From your comment as I can see u have not much expierence with variables and some of actions, pls do not go out of theme. I want this problem to be solved as fast as it can be. Later Ill explain everything...
You just didn't show init. Action that you pointed as wrong looks good. If it is bug you can try to avoid it seting var tmp and doing it this way:
tmp = 0;
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(tmp)))));
You just didn't show init. Action that you pointed as wrong looks good. If it is bug you can try to avoid it seting var tmp and doing it this way:
tmp = 0;
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(tmp)))));
I don't think this got anything to do with parsing a variable to String() since
Integer A is a pre-defined global variable which does already work.
In theory using 0 or a variable would not make any difference.
D0W3R could you perhaps tell us where the variable String is defined, or is this just a conversion from integer to string?
You just didn't show init. Action that you pointed as wrong looks good. If it is bug you can try to avoid it seting var tmp and doing it this way:
tmp = 0;
Set save_code[(Player number of (Triggering player))] = (Integer(((String(save_code[(Player number of (Triggering player))])) + (String(tmp)))));
I don't think this got anything to do with parsing a variable to String() since
Integer A is a pre-defined global variable which does already work.
In theory using 0 or a variable would not make any difference.
D0W3R could you perhaps tell us where the variable String is defined, or is this just a conversion from integer to string?
That might be because an integer that's 0 can be seen as being empty (don't know about Jass though...), however when converting 0 to a string this should work fine so that's what bothers me.
So your saying this does work when using Integer A but not when your setting it to 0??
So if your using Integer A it shows 12041 but with 0 it shows 1241?
Are you sure it's got nothing to do with how you concatenate the string?
That might be because an integer that's 0 can be seen as being empty (don't know about Jass though...), however when converting 0 to a string this should work fine so that's what bothers me.
So your saying this does work when using Integer A but not when your setting it to 0??
So if your using Integer A it shows 12041 but with 0 it shows 1241?
Are you sure it's got nothing to do with how you concatenate the string?
Ugh
I tried changing number to 3 and it worked perfectly:
set a = a + 12
set a = a + 3
set a = a + 41
result:
12341
(LOL)
Sow how May I now to get number "0" is this possible?
Couse I need all letters to have 2 numbers. The real problem is almost solved, thenks to Hashjie
Thread is solved!!! First number of integer can't be ZERO......... ><
So I just put big letters at the and of string. (cose names starting with capital letters...)
Thenks to all who spend so much time to such reckless thread
Ugh
I tried changing number to 3 and it worked perfectly:
set a = a + 12
set a = a + 3
set a = a + 41
result:
12341
(LOL)
Sow how May I now to get number "0" is this possible?
Couse I need all letters to have 2 numbers. The real problem is almost solved, thenks to Hashjie
Thread is solved!!! First number of integer can't be ZERO......... ><
So I just put big letters at the and of string. (cose names starting with capital letters...)
Thenks to all who spend so much time to such reckless thread
Hehe, not to mention I didn't really look at the trigger at all, nor did I go into the world editor to solve this
Want to know how I figured it out? If Integer = 0 is considered to be empty then that means when converting empty to string the string = ""
So now you need a way of showing 0 right?
Have you tryed creating a string variable which contains "0" and then use that instead of the actual 0 integer..?
This would mean you'd have to not convert integer to string and use the string variable which contains "0"...
Or just manually type in the 0 as a string instead of integer...
In my previous post i gave a solution on how to add 0 as a string to the variable. Since converting an 0 integer becomes an empty string, the string needs to contain 0 instead of an integer. He should be abled to fix it but I haven't heared from him so far
Here (in poland) it looks not so clear. There are only few peaple that can understand english becouse of long german and rusia occupation. Its hard to practise if noone can talk with you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.