|
soniczny Newbie
Joined: 11 Jun 2009 Posts: 8
|
Posted: Thu Jun 11, 2009 9:11 am
Problem after importing script from cmud to zmud. Variables propably. |
Hi, Im new to cmud. Just imported all my scripts. Fixed all where the problem was about "". But here im dizzy.
There I've got 2 macros.
#Var d_odm_biernik {}
#Var p_odm_biernik {}
#var przeciwnicy {}
#UNKEY ALT-1 {Bindy}
#UNKEY ALT-CTRL-1 {Bindy}
#UNKEY ALT-2 {Bindy}
#UNKEY ALT-CTRL-2 {Bindy}
#UNKEY ALT-3 {Bindy}
#UNKEY ALT-CTRL-3 {Bindy}
#UNKEY ALT-4 {Bindy}
#UNKEY ALT-CTRL-4 {Bindy}
#UNKEY ALT-5 {Bindy}
#UNKEY ALT-CTRL-5 {Bindy}
#UNKEY ALT-6 {Bindy}
#UNKEY ALT-CTRL-6 {Bindy}
#UNKEY ALT-7 {Bindy}
#UNKEY ALT-CTRL-7 {Bindy}
#UNKEY ALT-8 {Bindy}
#UNKEY ALT-CTRL-8 {Bindy}
#UNKEY ALT-9 {Bindy}
#UNKEY ALT-CTRL-9 {Bindy}
#T+ Odmiana_d
druzyna
#WAIT 500
#FORALL @druzyna {odmien %lower( %i)}
#WAIT 500
#FORALL @d_odm_biernik {
#KEY ALT-%ismember( %i, @d_odm_biernik) {zaslon %i} {Bindy}
#KEY CTRL-ALT-%ismember( %i, @d_odm_biernik) {gzzaslon %i} {Bindy}
}
#T- Odmiana_d
Anather One
#UNKEY CTRL-1 {Bindy}
#UNKEY CTRL-2 {Bindy}
#UNKEY CTRL-3 {Bindy}
#UNKEY CTRL-4 {Bindy}
#UNKEY CTRL-5 {Bindy}
#UNKEY CTRL-6 {Bindy}
#UNKEY CTRL-7 {Bindy}
#UNKEY CTRL-8 {Bindy}
#UNKEY CTRL-9 {Bindy}
#CLR Kondycja
#T+ Kondycja
kondycja wszystkich
#VAR przeciwnicy %null
#VAR p_odm_biernik %null
#WAIT 500
#T+ Odmiana_p
#FORALL @przeciwnicy {odmien %lower( %i)}
#WAIT 500
#T- Kondycja
#T- Odmiana_p
#FORALL @p_odm_biernik {
#KEY CTRL-%ismember( %i, @p_odm_biernik) {
zabij %i
edgniew na %i
wskaz na %i
} {Bindy}
#KEY CTRL-SHIFT-%ismember(%i, @p_odm_biernik) {
przelam obrone %i
zabij %i
zabij %i
} {Bindy}
}
cechy
I have no idea what's wrong about it. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jun 12, 2009 1:08 pm |
I don't see any problems offhand, and a syntax check shows no problems. What problem are you seeing? Also, could you perhaps post the entire script, within code tags so the spacing is preserved? Preferably the xml code. Sometimes incorrect spacing causes problems.
|
|
|
|
soniczny Newbie
Joined: 11 Jun 2009 Posts: 8
|
Posted: Wed Jun 17, 2009 6:24 pm |
This one should bind ctrl+something ctrl+shift +something and it doesnt work.
Worked in Zmud 7.21 |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 17, 2009 7:01 pm |
Actually, now that take another look at the code, you set two variables, @przeciwnicy and @p_odm_biernik, to %null early in your code. Then later you run loops over the values of both these variables. If those variables are %null, those loops won't run, and the entire code fails. How are these variables gaining values? I'm guessing that you exect those variables to be set somehow outside of this script, during the #wait periods. Is that correct? This is unreliable at best, and can cause a number of problem. That is probably why your code is not working.
There is probably a much better way to do what you want. If you can explain exactly how those variables are being set, we can probably come up with a good solution. |
|
|
|
soniczny Newbie
Joined: 11 Jun 2009 Posts: 8
|
Posted: Thu Jun 18, 2009 7:04 am |
There are 4 triggers doing this. Below:
Pattern :
^{|> }Druzyne prowadzi &tmp1 i oprocz ciebie {sa|jest} w niej jeszcze{:|} &tmp2
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, i , |)
#VAR tmp2 %replace( @tmp2, , , |)
#VAR tmp2 %remove( ., @tmp2)
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
Pattern :
^{|> }Druzyne prowadzi &tmp1, zas ty jestes jej jedynym czlonkiem.
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
Pattern:
^{|> }Nie jestes w zadnej druzynie.
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna @postac
Pattern:
^{|> }Przewodzisz druzynie, w ktorej oprocz ciebie jest jeszcze &tmp2
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, i , |)
#VAR tmp2 %replace( @tmp2, , , |)
#VAR tmp2 %remove( . , @tmp2)
#VAR druzyna @postac
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
At Zmud it was like this : (I deleted " thing)
#TRIGGER {^{|> }Druzyne prowadzi &tmp1 i oprocz ciebie {sa|jest} w niej jeszcze{:|} &tmp2} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, " i ", |)
#VAR tmp2 %replace( @tmp2, ",", |)
#VAR tmp2 %remove( ".", @tmp2)
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
}
#TRIGGER {^{|> }Przewodzisz druzynie, w ktorej oprocz ciebie jest jeszcze &tmp2} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, " i ", |)
#VAR tmp2 %replace( @tmp2, ",", |)
#VAR tmp2 %remove( ".", @tmp2)
#VAR druzyna @postac
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
}
#TRIGGER {^{|> }Nie jestes w zadnej druzynie.} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna @postac
}
#TRIGGER {^{|> }Druzyne prowadzi &tmp1, zas ty jestes jej jedynym czlonkiem.} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
} |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jun 19, 2009 5:49 pm |
None of those four triggers you quote set a value for @p_odm_biernik or @przeciwnicy. They do not even refer to either of those variables. So, the question is still, how and when are you assigning a value to @p_odm_biernik and @przeciwnicy? Also, is that value assignment supposed to happen during the #wait? Or is is supposed to have happened before the problem trigger fires?
If you aren't assigning a value to these variables, or you are assigning them before your problem trigger fires, then your problem is simply that these variables have %null values.
And please, when quoting code, put the code inside code tags. Like this:
[code]
Paste your code here
[code]
That makes it a lot easier to read code, and it retains all the spacing too. |
|
|
|
soniczny Newbie
Joined: 11 Jun 2009 Posts: 8
|
Posted: Fri Jun 19, 2009 10:51 pm |
Actually i have no idea what's all about, so ill paste full class.
Code: |
#CLASS {Druzyna}
#VAR druzyna {Gabriel}
#VAR d_odm_biernik {}
#VAR log {1}
#VAR numpad {3}
#VAR poc {0}
#VAR VKeyPad_Index {1}
#VAR przeciwnicy {Miskel|Sarrendil|Eloenil|Rothinel|Etran|Eseldar|Endenmar|Lotharion|Laimar}
#VAR p_odm_biernik {miskela|sarrendila|eloenila|rothinela|etrana|eseldara|endenmara|lothariona|laimara}
#TRIGGER {^{|> }Druzyne prowadzi &tmp1 i oprocz ciebie {sa|jest} w niej jeszcze{:|} &tmp2} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, " i ", |)
#VAR tmp2 %replace( @tmp2, ",", |)
#VAR tmp2 %remove( ".", @tmp2)
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
}
#TRIGGER {^{|> }Przewodzisz druzynie, w ktorej oprocz ciebie jest jeszcze &tmp2} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR tmp2 %replace( @tmp2, " i ", |)
#VAR tmp2 %replace( @tmp2, ",", |)
#VAR tmp2 %remove( ".", @tmp2)
#VAR druzyna @postac
#FORALL @tmp2 {#VAR druzyna %additem( %proper( %trim( %i)), @druzyna)}
}
#TRIGGER {^{|> }Nie jestes w zadnej druzynie.} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna @postac
}
#TRIGGER {^{|> }Druzyne prowadzi &tmp1, zas ty jestes jej jedynym czlonkiem.} {
#VAR d_odm_biernik %null _nodef Druzyna
#VAR druzyna %proper( @tmp1)
#VAR druzyna %additem( @postac, @druzyna)
}
#CLASS 0 |
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sun Jun 21, 2009 3:49 pm |
All right, I see in that class that class Druzyna includes variables @przeciwnicy and @p_odm_biernik, with values. If this is the only class that deals with those variables, then my guess is that your first macro is failing because of these lines:
#Var p_odm_biernik {}
#var przeciwnicy {}
And your second macro is failing because of these lines:
#VAR przeciwnicy %null
#VAR p_odm_biernik %null
Those lines set the variables to null, so when you try to loop over the values in the variables, nothing happens. |
|
|
|
soniczny Newbie
Joined: 11 Jun 2009 Posts: 8
|
Posted: Sun Jun 21, 2009 4:44 pm |
Then ? What should I do about that? Null them in other way ?
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 22, 2009 12:24 pm |
If I'm correct, you shouldn't null them at all. Let me ask you again--are you setting a value to those variables in any other scripts? If you aren't, then you shouldn't be setting them to null in this macro, because the macro needs the values in those variables.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|