mIRC Coder tools

By TMFKSOFT on Nov 28, 2011

After making my Topic script i found medelling with 'two dimensional' vars tiresome and annoying.

So, I've created a way to simplify double variables below I have made a simple way to handle them for those new to irc or those who like a bit of help here and there before they step into the main stream stuff in mIRC.

I will add more snippets below as i come across them!

; mIRC Coder Tools

; By Thomas Edwards (TMFKSOFT)

; This script contains commands that you will find to be of great use in bot creation
; If you use any of it please leave credit to myself!
; Feel free to remove commenting when using in your scripts.

; Better vars, giving our code some type of standards is whats best this will speed the process.

alias setvar {
  ;Usage: /setvar [main var] [sub var] [value]
  ; e.g. /setvar talk #ilkotech 0
  ; Which is the same was %talk.#ilkotech
  ; This allows different vars for different channels.
  set % $+ $1 $+ . $+ $2 $3-
}
alias getvar {
  ;Usage $getvar([main var],[sub var])
  ; e.g. if ($getvar(talk,#ilkotech == 1) { HALT } else { msg # Hello. }
  ; This gets the result of a var set via the /setvar command.
  ; It will return $null by default
  return % [ $+ [ $1 ] $+ . $+ [ $2 ] ]
}
alias unsetvar {
  ;Usage: /unsetvar [main var] [sub var]
  ; e.g. unset talk #ilkotech
  ; Will unset the previously set var, It may be used for normal vars e.g. unsetvar %test
  unset % $+ $1 $+ . $+ $2
}

; More to come as I dig it up...

; Fixes
; * Fixed that sleeply slurr on initiating a variable before return.
; * Aded the simpler brackets.

Comments

Sign in to comment.
TMFKSOFT   -  Dec 12, 2011

Its a large script I see, ill shove it on my laptop and tonight i'll have a go at converting it for you :)

 Respond  
California   -  Dec 09, 2011

Honestly, I'd have no clue how to do that. I got my uno script from here (http://www.mirc.net/projects.php?go=1085886167), and this would be a lot to go through and manually change. Plus, I don't really know what all I would have to change in it.
mIRC scripting isn't really my strong point.... I only make small basic scripts.

 Respond  
TMFKSOFT   -  Dec 09, 2011

California:
You have hit the nail on the head, That is the precise function of the script. You could easily convert a script using the above, just copy and paste my three alias' then raplace the vars in the script :D

 Respond  
California   -  Dec 08, 2011

Would it be possible to use something like this to be able to have a game script (eg. an uno script) run on multiple channels simultaneously without the vars conflicting? As of now, all the uno scripts I've seen can only one on one channel at a time.
If I seem pretty confused, I am... all i really looked at was this line:
; This allows different vars for different channels.

 Respond  
TMFKSOFT   -  Dec 01, 2011

locks Lucius up :P

 Respond  
Lucius   -  Dec 01, 2011

Well deduced. I was guilty of boredom, it's true. lock me up. :D

 Respond  
TMFKSOFT   -  Dec 01, 2011

toclafane1:
As for thinking what i think, you need to be bored and browsing through old creations by yourself or others, this was the result of me looking at my topic script and wondering if i could handle variables quicker.

 Respond  
TMFKSOFT   -  Nov 30, 2011

Lucius:
I intend to improve it when i can be bothered but you can make a good bot using it i have created my own IRCD in mIRC using this method for storing modes, topics and anything else that needs to be handled including nicks.
Also its better 2.point than nothing and is useful for simple game scripts. Its not exactly going to be needed to recreate 9/11...

 Respond  
Lucius   -  Nov 30, 2011

You mean things like:
%IPtrack. [ $+ [ $nick ] ]
%adminpass. [ $+ [ $nick ] ]

True enough, but also not all variables need that 2 point style, what about simple counters which only need one?
Or 3point ones like: %autopass. [ $+ [ $server ] . $+ [ $nick ]
(take note of that people, thats the kind of thing you need to stop you failing OPER when you connect to another server, I still have my autokill on failed oper. And I still use it.)

The way you have it now is permenantly set to 2point variables.
So something like %lolcount would become %lolcount.info and unusable (although it would be simpler to use /set
I understand that you meant it to help a standardised variable set, but isn't it better that everyone has their own style of doing it? Thats one of the reasons vars don't overlap across scripts very often.

If I was to consider using that, I'd need it to be multiple optional. $setvar(blah blarg blah INFO,3) or $setvar(blah blarg bleh 4th_option, INFO) etc which would make it recognise %how.many.are.needed for the variable in question.
For games on bots especially I can see this having a use once it isn't so restricted.
%uno.$nick.wins
%uno.$server.$nick.wins
for example.

It's just too simplified right now to be a properly useful tool. It's a 2.point or nothing type of alias.

That said I apologise for my inital derogatory post, it has more use than I expected but it's got more potential as more of an intermediate/advanced use for bot game coders than an initial help.

 Respond  
Protheus   -  Nov 29, 2011

TMFKSOFT, nice concept bro. Looking forward to more stuff from you.

 Respond  
Protheus   -  Nov 29, 2011

LMFFAO SunnyD that was EPIC bro. I lold so frakkin hard.

 Respond  
TMFKSOFT   -  Nov 29, 2011

Lucius:
As easy as it is to set %something.something you can do that for variables that differ and arent fixed.

SunnyD:
I were tired and for some reason if i didnt init the var before returning my mind would implode, i should fix that.

pball:
I've not tried that but my gut instinct would tell me it wouldn't work, excuse me if it does work.

Jethro:
I've never tried $eval() so i have no idea how to use it, thansk for letting me know i will get around to learning it!

jaytea:
I've never devled into $hget() and so forth so i never thought to try it, and the bracket mess was the result of me messing with the brackets used in my topic script, so thanks for pointing out about simplyfying it.

pball:
I love working it out and hey its fun! some people dislike that concept and prefer the intelligent method which i dont so there you are!

Thanks for the feed back guys, ill apply the simplified brackets and sort that silly return!

 Respond  
pball   -  Nov 29, 2011

I also personally feel eval brackets are messy, because you have to find what the inner most ones are and work your way out. But that's just my personal feelings.

 Respond  
jaytea   -  Nov 29, 2011

assuming many 'sub vars' to one 'main var', the interface you've created is essentially an alias for /hadd and $hget() ;) but i've always liked the idea of creating utilities for other scripters, so i look forward to future submissions made in the same vein.

% [ $+ [ $1 ] ] [ $+ [ . ] ] [ $+ [ $2 ] ]

there's a lot going on behind the scenes there, and it's worth noting that the above can be simplified to:

% [ $+ [ $1 ] $+ . $+ [ $2 ] ]

the simplification makes the pattern easier to understand, should you try to do so. evaluation brackets are fascinating, but as pball showed, their use in this context has been superseded by $eval().

 Respond  
Jethro   -  Nov 29, 2011

You can also use $eval()

 Respond  
pball   -  Nov 28, 2011

I personally just use the following which is a simple way to make dynamic variables.

;setting %part1part2
set $+(%,part1,part2) value

;retrieving %part1part2
echo $($+(%,part1,part2),2)

 Respond  
Sorasyn   -  Nov 28, 2011
  var %var % [ $+ [ $1 ]  ] [ $+ [ . ] ] [ $+ [ $2 ] ]
  return %var

GYAH shirt rips, turns green HULK SMASH. Why initiate a variable just to return it..? :/

 Respond  
Stewie1k94   -  Nov 28, 2011

How did you think of this? :p

 Respond  
Lucius   -  Nov 28, 2011

while you are at it why don't you add in:

/chat_in_room
/doing_an_action
/make_me_quit
/show_only_to_me
/who_is_that
/join_this_room
/leave_this_room

then you wouldn't need to actually know how to use IRC at all. You'd just have to learn those commands instead...

yes that was sarcasm, sorry. I don't mean to be an ass but seriously?
why not make the variables use mirc's built in /set and /unset along with /echo
that way people can learn the right way of doing it, and just add some echo reply information which mirc doesn't do as standard like: your variable was set/unset.
The closest I can see to useful is the getvar but that is easily accomplished with //echo -a %varname

There's no reason I can see for this at all. One of the first things someone learns for coding is the /set and /unset along with /echo -a
this just confuses the issue with unneeded complications.

If you are going to make a coding help script, why not run it as an interactive script that people can do themselves with mirc's normal commands. If It's for a bot then it's even easier, just make the bot pose hypothetical variable names and ask them to answer them.

how can I remove my variable? it's called: %kick.count.ROOMNAME (reply with !answer ...) !answer /unset %kick.count.ROOMNAME CORRECT! how do I check what is in my variable? it's called: %brb.count.ROOMNAME !answer /echo -a %brb.count.ROOMNAME Close! remember to use double slash. /echo -a will show the name, not check inside it. Use //echo -a now that would be useful for learning. As I can see right now you are just making new commands to learn and adding a bit of info to it.
 Respond  
TMFKSOFT   -  Nov 28, 2011

haha, Well its going to be a set of useful snippets :P
I have no idea what to name it, gimmie an approiate name and i'll change it

 Respond  
Jethro   -  Nov 28, 2011

"mIRC Coder Tools" sounds as if there's a job title called "mIRC Technician." lol

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.