|
jg1lbert Wanderer
Joined: 09 Nov 2006 Posts: 55
|
Posted: Tue Nov 14, 2006 8:15 am
%if( %pos, if, else) was working a while ago but not now... |
I have a trigger to read information from my prompt and it HAD been working earlier, what could have changed it?
the prompt is like 921h, 432m ebd- (where the e is equilibrium, b blind, etc)
my trigger if (%d)h, (%d)m (*)
and in my value:
#var eq %if( %pos("e",%3), 1, 0)
to test these, I even added:
#say @eq
#say %pos("e",%3)
the say only works if i change the trigger to fire on prompt (used to work as just a trigger) - ok so i uncheck the trigger on trigger and newline boxes, click trigger. now the say works but isnt evaluating th %IF and setting the variable
it #says the position, 1
it #says the variable, STILL 0
i tried it as @eq=%if(%pos("e",%3),1,0) and the same thing
I swear it was working 5 hrs ago and nothing happened other than a few bugs/crashes |
|
|
|
jg1lbert Wanderer
Joined: 09 Nov 2006 Posts: 55
|
Posted: Tue Nov 14, 2006 8:20 am |
sorry typo up there - trigger IS : (%d)h, (%d)m (*)
it evaluates any letter i can get to pop up in my prompt and returns the position.
I noticed a few times that other aliases with %if(%1,%1,@target) SOMETIMES dont use %1 - or just dont evaluate them. when I've seen it, i delete that setting and re-make the exact thing and it started working again.
I re-made this one a few time so far, same thing - %if just seems to kick out the false value |
|
|
|
jg1lbert Wanderer
Joined: 09 Nov 2006 Posts: 55
|
Posted: Tue Nov 14, 2006 6:09 pm |
OK, that's still not working,
I even tried this:
trigger - (%d)h, (%d)m (*) - now prompt looks like 751h, 720m cedx-
values:
- - - - I want it to be #var eq %if(%pos(e,%3), 1, 0) but anyhow that wont evaluate the %if so i tried to even
#var eq %if(1,1,0)
#say %pos(e,%3) - says 1
#say #eq -says 0 so %if(1, 1, 0) still returns false statement...
so its pretty fair to say that the if(%pos wont do it if it cant even evaluate a 1 from a 0 |
|
|
|
jg1lbert Wanderer
Joined: 09 Nov 2006 Posts: 55
|
Posted: Tue Nov 14, 2006 8:13 pm |
ok, I found a way around the problem but still cant fix the %ifs
Instead of #var eq %if(), I used #if (%pos(e,%3)) {#var eq 1} {#var eq 0}
that works and trigger changes the variable both as a prompt trigger and trigger on trigger/trigger on newline (and no matter the priority)
one thing that DIDNT work with that setting was {@eq=1} {@eq=0}: I cant get and @variables= to work now...
I tested some of my %if(%1,%1,@whatever) settings in a few aliases. like before, sometimes the %if doesnt evaluate and just returns the else-statement - delete it, make the identical alias, works again (for how long?)
so I have issues with @variableX=, and %if(x,x,y), and for the life of me, $X= doesnt work as a temp either...
any ideas on why those dont work, lemme know... |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Nov 14, 2006 8:51 pm |
Well, I covered a couple of bugs with triggers not firing sometimes, but I couldn't find any problem with %if(1,1,0) returning zero, so the bug might have been related to something else I've already fixed in 1.16.
However, remember that @variableX= is not the correct syntax for variable assignment. It is just variable=value. You only use the @ character when you are fetching the value of a variable, not when you are just giving it's name. The @ character is not part of the variable name.
On the other hand, with local variables, the $ *is* part of the variable name, so with local variables, you always use $. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Nov 15, 2006 12:02 am |
...except in the "params" box in the GUI. I did wonder if it'd make more sense if they were listed with the $, since you have to have them when you create the alias as well. When I first started playing with them I made a few mistakes because of that.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Nov 15, 2006 12:29 am |
Yeah, I'm considering making that change too. Since the rule is that "Local variables and arguments always use $" then it seems like the $ should be listed in the settings editor too. It's on my list.
|
|
|
|
|
|
|
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
|
|