mIRC Home    About    Download    Register    News    Help

Print Thread
Var not evaluating in gettok? #198724 03/05/08 06:10 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Using example

alias test {
var %t = hi
echo -a $gettok(I wonder if the person said hi or bye?,%t,32)
}

The variable is not being evaluated now in a earlier script that I asked to be written shorter I forgot if it was RusselB or Riamus2 that wrote me something like

did -rab systok $gettok(12 13 14 15,%sys,32) $v1

Where %sys would be a numerical value in order of whatever changes, however I noticed that my PID's have changed variable wise etc... but it doesnt change my dialog because %sys is not being evaluated in this $gettok command

What it's suppose to do is change the dialog editbox entry and disable the ID according to which PID has changed.

any help would be appreciated.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Var not evaluating in gettok? [Re: Lpfix5] #198726 03/05/08 06:49 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
First of all, your /test example uses a text value in %t, not a numerical value, so it's obviously not going to work... in case that wasn't just a typo, /help $gettok.

Regardless, variables are evaluated fine in $gettok(), you can test it with something as simple as

//var %t = 3 | echo -a $gettok(a b c d,%t,32)

Your problem is elsewhere and nothing of what you posted can help us determine it: you need to provide more context.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Var not evaluating in gettok? [Re: qwerty] #198728 03/05/08 07:06 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Code:
on *:text:*SYS*:#FFXVI:{
  if (FFbot isin $nick) && ($len($5) == 32) && ($did(systok,28).state == 1) {
    var %sys = $findtok(000106 000146 000506 000696 000700 000800 000914,$+($2,$3),32)
    if ($($+(% $+ sys.bk,%sys),2) != $5) { 
      .write backup.txt $v1 $date(mm/dd)
      set %sys.bk $+ %sys  $5
      did -rab systok $gettok(12 13 14 15 3 11 39,%sys,32) $v1
      echo 4 -a $v1 changed 
    }
  }
}


The code is here, as you can see the check for the PID to see if its different works, setting it up in my variables work, and when it comes down too adding to my dialog nadda.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Var not evaluating in gettok? [Re: Lpfix5] #198729 03/05/08 07:21 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Have you checked whether %sys itself is set correctly? I'm willing to bet that it's not. You're only checking %sys.bk<%sys>, and that only if it's different from $5. Apart from the fact that you shouldn't check things after they are used but rather before, you should check them in the order they change, eg if %b relies on %a, you don't check %b directly: first you check %a. Once you are sure %a is ok, then check %b.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Var not evaluating in gettok? [Re: Lpfix5] #198730 03/05/08 07:32 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Although I can't see anything wrong with that code, I did note that your original dialog has 8 PID locations, and you're only accounting for 7 here. That may be due to my error. The dialog ID that is missing from the $gettok is 40.. this corresponds with the text entry of SYS DOW 96

Are you sure that the dialog is open when that code was run? If it wasn't, then it can't update the dialog.

Re: Var not evaluating in gettok? [Re: qwerty] #198820 05/05/08 01:00 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Originally Posted By: qwerty
Have you checked whether %sys itself is set correctly? I'm willing to bet that it's not. You're only checking %sys.bk<%sys>, and that only if it's different from $5. Apart from the fact that you shouldn't check things after they are used but rather before, you should check them in the order they change, eg if %b relies on %a, you don't check %b directly: first you check %a. Once you are sure %a is ok, then check %b.


To qwerty %sys picks up data has entry 1-7 properly in the script therefore %sys is not the issue when it is made into a variable, the floating variable is correct in other terms

To RusselB, has mentioned in the last script is that when I revised the bots code i noticed that 1 pid was not neccasary to make it a total of 7 now instead of 8 pids, (future releases will have more) As we noticed pid 8 didnt change because it didnt exists yet.

P.S. The original bot (data) is being fetched ONLINE via sockets once it's updated on the bot, it releases the information that the public release of the script has and picks up from the original bot

Now the original bot in question the script runs flawlessly and fetches my code as I want it in pure form

Now the end user script works fetches data, updates variable accordingly BUT DOES NOT updated/disable the dialog itself in question. Meaning that the variable %sys is working perfectly since it updates the variable in the variable (editor) again just not on my dialog I dont know if it's a bug with the dialog mIRC structure itself.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Var not evaluating in gettok? [Re: Lpfix5] #198822 05/05/08 01:19 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
OMG! Guess what guys i was using $v1 to update the PID Data numerous times I Guess the problem was there that it was somehow not returning the $v1 data properly has the new PID it would return be the OLD PID I noticed that error when i just swapped a byte in the PID

Replaced all $v1 instances with $($+(% $+ sys.bk,%sys),2) and script works flawlessly now ODDly i think theres something not evaluating when using $v1

Im not to sure how $v1 works if its a variable that stores info from an if statement or if it always calls back to the if statement or somethin gbut if it calls back then somehow its not double evaluating the text because the same string i used has for $v1 should be returning me the correct stuff and its not

EDITED I figured it out,

In my if statement the VAR change didnt happen till i use /set therefore the information stored has $v1 is THE OLD information therefore the problem has been targetted in pure form I can use $v1 up till the backup is performed after that the whole command has to be processed again

wink (DOH) to me knowing the information doesn't stay static throughout the whole script.

Last edited by Lpfix5; 05/05/08 01:34 AM.

Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }