mIRC Home    About    Download    Register    News    Help

Print Thread
#33533 01/07/03 10:17 PM
Joined: Jun 2003
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2003
Posts: 5
Is it possible to use part of a variable?
here is my script

on *:TEXT:*!mods*:#E*R*S: {
/msg $chan !hm Current ingame mods are @ $+ %peramods ; % $+ %permods ; + $+ %pertmods
}

i want it toput the @, % or + infront each of the names in my variables can this be done?

#33534 01/07/03 10:20 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
1: unless thyre supposed to be, them variables have different names.
2: change the ;'s to ,'s because ; makes something a comment


new username: tidy_trax
#33535 02/07/03 12:31 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on *:TEXT:*!mods*:#E*R*S: {
  set %i 1
  set %peramods $nick(#,%i)
  if (%peramods == $null) { goto done }
  if (%peramods isop $chan) { msg $chan %peramods is an op on $chan }
  if (%peramods ishop $chan) { msg $chan %peramods is a halfop on $chan }
  inc %i
  goto next
  :done
}

Hmmz, is this ok?

#33536 02/07/03 12:43 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You could also do
Code:
on *:TEXT:*!mods*:[color:red]#[/color]: {  
set %i 1  
set %peramods $nick(#,%i)  
if (%peramods == $null) && ($me isop $chan) { goto done }  
if (%peramods isop $chan) && ($me isop $chan) { msg $chan %peramods is an op on $chan }  
if (%peramods ishop $chan) && ($me isop $chan) { msg $chan %peramods is a halfop on $chan }  
inc %i  
goto next  
:done
}

Which would trigger in any room you have ops in smile

Last edited by SladeKraven; 02/07/03 12:49 AM.
#33537 02/07/03 12:44 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
From the help file:
You can add comments to your scripts by using the ; semi-colon at the start of a line.

Those semicolon's aren't at the start of a line, therefore they are not considered comments. There is no reason to replace the semicolon's with anything else.


#33538 02/07/03 03:35 AM
Joined: Jun 2003
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2003
Posts: 5
maybe u dont understand what im trying to do here I run a server for a game and i have ingame moderators names set in those variables.
as the code is now it will say this to the people in the game.
Current ingame mods are @name name name ; %name name ; +name name
what i want it to do is this
Current ingame mods are @name ; @name ; @name ; %name ; %name ; +name ; +name

#33539 02/07/03 07:14 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Maybe you don#t understand that ";'s" are comments.
Try @name $chr(59) %name $chr(59) +name.

#33540 02/07/03 08:35 AM
Joined: Jun 2003
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2003
Posts: 5
it works fine with the ; in it thats not the problem.

the problem is trying to split up the names that are in the variables. i was just wondering if that is possible

#33541 02/07/03 09:24 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Try
Code:
@ $+ $replace(%peramods,; $+ $chr(32),; @) ; $&
  % $+ $replace(%permods,; $+ $chr(32),; %) ; $&
  + $+ $replace(%pertmods,; $+ $chr(32),; +) ;


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#33542 02/07/03 09:43 AM
Joined: Jun 2003
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2003
Posts: 5
nope

#33543 02/07/03 12:59 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
how about you just add the ;'s to the variable, that will make it a lot easier.


new username: tidy_trax
#33544 02/07/03 07:39 PM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
Ok, I assume your variables look like this:
%peramods name name name
%permods name name
%pertmods name name

Try using this (slightly modified from qwerty's)
Code:
msg $chan !hm Current ingame mods are $&
@ $+ $replace(%paramods,$chr(32),$chr(32) ; @) $&
; % $+ $replace(%parmods,$chr(32),$chr(32) ; %) $&
; + $+ $replace(%partmods,$chr(32),$chr(32) ; +)

#33545 02/07/03 08:31 PM
Joined: Jun 2003
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2003
Posts: 5
That works thanks alot.

#33546 03/07/03 12:02 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Oops, I didn't pay attention to the original example and thought that all nicks are separated by " ; ". No wonder why it didn't work... Thanks.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard