mIRC Home    About    Download    Register    News    Help

Topic Options
#130886 - 23/09/05 10:42 AM tokens
reece1312 Offline
Ameglian cow

Registered: 18/09/05
Posts: 44
Could someone help me understand the Tokens part of scripting..
the $gettok and stuff cuz its confusing the hell out of me.

Top
#130887 - 23/09/05 11:32 AM Re: tokens
Mentality Offline
Planetary brain

Registered: 01/06/03
Posts: 5024
Loc: London, England
A token is a segment of a given string. You need to specify what the string is (i.e. a sentence), what token you want to manipulate, and what character number (ASCII number) the characters are separated by. For example:

//echo -a $gettok(quick brown fox,3,32) will return 'fox'.
quick brown fox is the string. 3 is telling mIRC you want to GET the third TOKEN (gettok) and 32 is the ASCII number for a space - the tokens are separated by a space.

OR

//echo -a $gettok(apples.pears.milk,2,46) will return 'pears' because the 2 means the second token, and the tokens are separated by ASCII character 46 (a period).

More examples/explanations can be found in this tutorial as not all token identifiers are as simple as that. /help Tokens is also a reference. You can also find a list of ASCII characters and their associated character numbers at http://www.mirc.net/ascii.php which may be useful.

Regards,
_________________________
Mentality/Chris

Top
#130888 - 23/09/05 11:38 AM Re: tokens
reece1312 Offline
Ameglian cow

Registered: 18/09/05
Posts: 44
thanks alot.

this is a piece of code and im stuck...

n109=extraground {
n110= var %i = $calc( $lines(controller.ini) - 1 )
n111= var %p = 0
n112= :loop
n113= inc %i
n114= inc %p
n115= var %j = $calc( ( %p * 2 ) - 1 )
n116= if $gettok( $1- , %j , 64 ) == $null { goto end }
n117= var %item = $gettok( $1- , %j , 64 )
n118= if %grid == specialgrid { var %item = $slice( %item ) }
n119= if %grid == wrestlergrid { var %item = $slice( %item ) }
n120= writeini controller.ini controller %i %item $gettok( $1- , $calc( %j + 1 ) , 64 )
n121= goto loop
n122= :end

this is the thing i mean, im really stuck, its of a guys game and i need to know what it means...

ree.

Top
#130889 - 23/09/05 12:00 PM Re: tokens
Mentality Offline
Planetary brain

Registered: 01/06/03
Posts: 5024
Loc: London, England
On its own you can't really see what that does. $slice must be a custom identifier, it's not internal with mIRC. This is obviously just a small bit of a larger script.

It uses a GOTO loop, see /help goto loops and if statements, /help if then else.

For further info on that script, please talk to the author.

Regards,
_________________________
Mentality/Chris

Top
#130890 - 23/09/05 12:17 PM Re: tokens
reece1312 Offline
Ameglian cow

Registered: 18/09/05
Posts: 44
kk thanks neway. the author is a dick and wont help me learn.

if i knew what that stuff meant id be able to make the game easier.

well... his is a wrestling game and he has a Ref nick thats op and its got another set of scripts that respond to what we do.

we start in a normal chat window, and challenge someone and when we choose what match type it is, another window opens which is the game screen. people can join this to watch the people battle it out.

we have adrenaline and health and we click moves and the ref responds to it and the move connects depending how low / high adrenaline and health have, if it hits they lose health and we lose adrenaline, if it fails we lose nothing. obviously the if-then-else is used for some of that. i just cant write the ref code cuz im stuck with some stuff... and cuz we cant see the ref scripts i cant even learn from it. could ne of you help on bits of this?

would we have the wrestling moves in seperate scripts to the wrestlers or the same?

thanks, Reece.

Top
#130891 - 23/09/05 01:20 PM Re: tokens
Om3n Offline
Fjord artisan

Registered: 06/07/03
Posts: 655
In a previous thread you asked about making scripts into executables so your code can not be ripped off, in this thread of you are talking about doing just that to somebody else...

Ripping somebody elses script is never a good idea, different people script in different ways because they simply think differently. One method may or may not be better than the other, but the one thing ripping somebody else code does is create trouble for you in the future since you will not fully understand and be familiar with the code. This will make it much harder and more time consuming to bug fix and tweak later on.

I suggest you read through the help and any relevent tutorials you can find. It is also usually a good idea to develope your idea a little and plan how you want your script to work (either written down or just in your head) before starting.

It is very hard for us to help you with anything specific until such a time that you have developed the idea and began your own coding.
_________________________
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby

Top
#130892 - 23/09/05 01:37 PM Re: tokens
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
That alias essentially takes the passed command line, that should look like this
????@N@????@N@????@N
each ???? could be anything likely a action of the ref maybe i dont know
each N is a number
there could be 1 or more repeats of ?????@N each seperted by a @

Now all it appears to do is take this ???? and insert it on a new line into the "controller.ini" file using the number of lines in the file + 1 as the item name for the /writeini

example...

---controller.ini --- start ---
[controller]
2=blah 23
3=blob 4
4=fred 999
---controller.ini --- finish ---

/EXTRAGROUND [email]qwerty@987@car@1@devil@666[/email]

---controller.ini --- start ---
[controller]
2=blah 23
3=blob 4
4=fred 999
5=qwerty 987
6=car 1
7=devil 666
---controller.ini --- finish ---

* these two lines appear to modify the ???? in some way (might be highlight removal might be anything!)
if %grid == specialgrid { var %item = $slice( %item ) }
if %grid == wrestlergrid { var %item = $slice( %item ) }


** All up it looks like a section of code that just a storage of the controller commands or settings maybe.

Top