mIRC Home    About    Download    Register    News    Help

Print Thread
#130886 23/09/05 09:42 AM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
Could someone help me understand the Tokens part of scripting..
the $gettok and stuff cuz its confusing the hell out of me.

#130887 23/09/05 10:32 AM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
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
#130888 23/09/05 10:38 AM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
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.

#130889 23/09/05 11:00 AM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
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
#130890 23/09/05 11:17 AM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
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.

#130891 23/09/05 12:20 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
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
#130892 23/09/05 12:37 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.


Link Copied to Clipboard