mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
I have so many questions, nothing ever works, anyone willing to discord?

Quote:

on *:load: {
/hmake tempHash ; <-- only the 1st line work same using aliases
/hmake score
/hload score score.ini
}


on *:text:!guess *:#:{
if ($regex($2,^[1-9]$)) {<-- this is fine thanks god like, doing the regex was the easiest part... how.
/hadd -s tempHash $nick $2- <-- this sometimes work, sometimes not ?? since on load stuff is not working correctly i use this /hadd -sm so it create the table on the fly
}
}

on *:text:!winner *:#:{
set %i 1
set %nwin $hfind(tempHash, $2-,0).data
while ( %i <= %nwin ) {
set %wname $hfind(tempHash, $2-, %i).data <-maybe I don't really need this line
if ($hfind(score, %wname, 1)) {
set %points $hget(score, %wname)
/hadd -s score %wname $calc(%points + 500)
}
else {
/hadd -s score %wname 500
}
inc %i
}
/hfree tempHash
/hsave -i score score.ini <-- after I restart mirc this overwrite the file losing data no matter if I -a
}


honestly i don't even understand this post you know, it's just so many things that work on other people scripts but never work on my end, like I copy and paste a dude's script, it doesn't work as intended, almost like if I had a outdated version of mirc (using latest actually) or... idk man, if you can't understand where I need the help I will try to break things line per line. I almost giving up and moving on, I never had to ask help on forums when learning other languages.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Well, one thing I see is that you save the score file using the -i switch, but you load it without the -i switch. That could be why your score file appears to get trashed.

Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
yeah, I tried that but sometimes it just delete the old data, other times it adds a "[hashtable]= %wname=xxx. Like I dont add or remove anything from the script, I just use another account to trigger the commands.

Thanks tho man, I appreciate your help

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
On Load only happens the one time in your lifetime, and that's when you first load the script into mIRC. You want to use On Start instead.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
Thanks man, every help matters, anything you guys can see it's wrong or there's a better way to do, feel free to comment about

Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
Ok, once again thanks guys, after a lot of cigarettes, cleaning mirc files and reinstalling I made all that stuff to work.
But now I discovered that my regex actually sux and "normal"/"as much as I know" regex doesn't quite work.
What I need is a way to only accept numbers between 1 and 22
ugly code that I have now:
Quote:
If ($regex($2,1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22)) {
/hadd -si tempH $nick $2-

I also want to make this command available only during a certain amount of time, the plan is to:
Quote:
ON *:TEXT:!StartGame *:#: {
"/msg Game has started, use !guess N to play"
"make !guess command available during X seconds"


I'm almost done finally

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
This seems to work, though it doesn't accept leading zeroes:

//var %x ^([1-9]|2[1-2])$ | echo -a $regex(22,%x)

Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
Lol I did that and didn't worked now I just cleaned the files on the mirc folder again, guess what, it worked...
Can't thank you enough tho, you're always here to help people <3


Link Copied to Clipboard