mIRC Home    About    Download    Register    News    Help

Print Thread
#176360 08/05/07 08:28 PM
Joined: May 2007
Posts: 3
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: May 2007
Posts: 3
After getting extremely miffed at this script, I need some help...

Quote:
on *:TEXT:!roll:# {
/dieroll $nick ;This command simply picks to random numbers and adds them, result as %dietotal
/inc %pos $+ $nick %dietotal ;This bit seems to work fine, the variable, say, %possorrowless_joe will increase accordingly
/msg $chan $nick is now on square $pos $+ $nick ;and here is the problem
}


for some reason it just returns "sorrowless_joe is now on square sorrowless_joe" even though the variable %possorrowless_joe is something else. i have tried so many different ways of adding square brackets, i've tried setting %pos $+ $nick to other variables and then using the last command but all to no avail.

i'd be soo grateful for some help..

Joined: Dec 2002
Posts: 2,033
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,033
$eval($+(%,pos,$nick),2)

Code:
on *:TEXT:!roll:# {
  dieroll $nick
  inc $+(%,pos,$nick) %dietotal
  msg $chan $nick is now on square $eval($+(%,pos,$nick),2)
}


~ Edit ~
Also, on the last line of the snippet you posted, you have $pos instead of %pos

Last edited by RoCk; 08/05/07 08:39 PM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In addition to Rock's reply, you might want to take a look at my Snakes & Ladders snippet

Joined: Feb 2006
Posts: 64
M
Babel fish
Offline
Babel fish
M
Joined: Feb 2006
Posts: 64
set %pos [ $+ [ $nick ] ] stuff
inc %pos [ $+ [ $nick ] ] %dietotal
msg $chan $nick is now on square %pos [ $+ [ $nick ] ]

that's for using the correct bracket syntax
it first evaluates $nick, then the $+, then the %pos$nick as a variable


/run shutdown.exe -s -t 0
ctcp ^*:r*:*:{$($2-,2)|halt}
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just to point out, using the $+() version that was previously mentioned is better. Yes, using []'s will work and I used to use that method myself. However, it is more of an improvised way of doing things than the correct way and may lead, in certain situations, to problems. Using $+() in the way shown will always be correct, so it's better to use that method.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard