mIRC Home    About    Download    Register    News    Help

Print Thread
$pos problem #47830 07/09/03 03:16 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
i have a prob, if i do $pos(meis is test, is ,1) it returns 3, so mirc ignores the spaces in the string.
Is there a way to make mirc not ignore the spaces so it would show up 6?

(i use it in a script, so N is always 1)

and yes i did a search but that still answered my question... and i know " meis" isnt a word laugh
grtz, Jo-W (sry about my bad english smile )

Last edited by JoWie; 07/09/03 03:20 PM.
Re: $pos problem #47831 07/09/03 03:34 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
that's the way it works
$pos(meis is test,is,1) returns 3
$pos(meis is test,is,2) returns 6

/help $pos


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: $pos problem #47832 07/09/03 03:51 PM
Joined: Sep 2003
Posts: 29
M
MircMania Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Sep 2003
Posts: 29
You could resort to using the $mid(%text,%number,4) identifier, you could increment the number until the end of the file and check for each four letters whether they equalled chr(32) $+ is $+ chr(32). If they do, you will know the %number you are on.

Re: $pos problem #47833 07/09/03 03:58 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Or you could just use $findtok.
$findtok(this is my test,is,1,32)
If I understand what he is saying, that should do what he wants.

Re: $pos problem #47834 07/09/03 04:09 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
Joke wrote:
----------------------------
that's the way it works
$pos(meis is test,is,1) returns 3
$pos(meis is test,is,2) returns 6

/help $pos

----------------------------


the N is always 1 in my script...

Re: $pos problem #47835 07/09/03 04:15 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
post your script so we can understand what r u trying to make


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: $pos problem #47836 07/09/03 04:25 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
Code:
alias NEW {
  set %is-item $$1
  set %is-value $$3-
  echo -s %is-item == %is-value
}


This is my code, now if I do /new testing blah is testing blah123
I get testing == blah testing blah123

so i tryd to make with the $pos to return the number where "is" is, then i used $left with the number from $pos.

Only then if i do "/new 324092is is testing" i get "324092"

Last edited by JoWie; 07/09/03 05:01 PM.
Re: $pos problem #47837 07/09/03 04:42 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
still does not make any sense...


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: $pos problem #47838 07/09/03 04:43 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
kk but the thing is i just wanna know how i can use a space in $cos

Re: $pos problem #47839 07/09/03 05:01 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
ow damn i ment $pos instead of $cos (already edited my post)

Re: $pos problem #47840 07/09/03 05:50 PM
Joined: Feb 2003
Posts: 10
Z
z00ey Offline
Pikka bird
Offline
Pikka bird
Z
Joined: Feb 2003
Posts: 10
Code:
//echo # $pos(meis is test,$+($chr(32),is,$chr(32)),1)

..returns 5 (due to the space before "is").

Code:
//echo # $pos(meis is test,$+(is,$chr(32)),1)

..returns 6 like you want it to.. (btw, i agree, strange coding but i hope it helps you, whatever you re doing, lol smile)



Last edited by z00ey; 07/09/03 07:04 PM.

return is the movement of sense.
Re: $pos problem #47841 08/09/03 05:54 PM
Joined: Dec 2002
Posts: 117
R
Rich Offline
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
//echo # $pos(meis is test,$+(is,$chr(32)),1)
echoes 3 because of meis, please test code before posting it, especially when it is this easy to test.

If you just want to split the text into the part before and after 'is' use this code:
Code:
alias new {
  var %pos = $findtok($$1-,is,1,32)
  var %is-item = $gettok($1-,1- $+ $calc(%pos - 1),32)
  var %is-value = $gettok($1-,$calc(%pos + 1) $+ -,32)
  echo -s %is-item == %is-value
}


If you really want the position of the 'i' character from 'is' try this:
Code:
$calc($len($gettok($1-,1- $+ $calc($findtok($1-,is,1,32) - 1),32)) + 1)

That will return the number of characters(including the space in front of 'is') before the word 'is'.


$input(Me like stars, You too?)
Re: $pos problem #47842 08/09/03 08:06 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
lmao, ty cool

Re: $pos problem #47843 08/09/03 08:09 PM
Joined: Sep 2003
Posts: 21
J
JoWie Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Sep 2003
Posts: 21
please test code before posting it, especially when it is this easy to test.
----------------------
you dont get my question, i asked because it went rong when i whas testing smirk