Author Topic: Server Numbers?  (Read 3003 times)

MILLANDSON

  • Guest
Server Numbers?
« on: September 15, 2009, 07:18:06 PM »
Hey!

Just wondering, how do you find a server's number, and how would you make a script that only worked on a specific server? Just that, at the moment, I can't figure it out, which means the colour script I'm using have to be turned off all the time because some of the chat's I'm on don't accept colours and so reject any message using them.

Thanks!

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Server Numbers?
« Reply #1 on: September 15, 2009, 09:08:22 PM »
ServerNumber is passed by the events for scripting.
$servernumber is the identifier.
The IceChat God

MILLANDSON

  • Guest
Re: Server Numbers?
« Reply #2 on: September 15, 2009, 10:28:31 PM »
How would I find out the Server Number though? I've never done any scripting before, and wouldn't know where to start.

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Server Numbers?
« Reply #3 on: September 16, 2009, 04:29:11 AM »
GetIDentifier("$servernumber")
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

MILLANDSON

  • Guest
Re: Server Numbers?
« Reply #4 on: September 16, 2009, 09:30:42 AM »
GetIDentifier("$servernumber")

Where would I put that in? As a command in the chat?

I have pretty much zero experience with coding, scripting, or IRC chats, so I'm gonna need this explained.

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: Server Numbers?
« Reply #5 on: September 16, 2009, 09:59:52 AM »
Does the script you are using use OUTTEXT function? if so, it can be easily modified to work on only certain servers.

Code: [Select]
Function OUTTEXT(OutgoingText)
if lcase(Network)="quakenet" then
    OUTTEXT = "5" & OutgoingText
else
    OUTTEXT = OutgoingText
end if
End Function

(This is a .ICE file script, or Icechat 5 style scripting)

The 'network' function is a special variable/function. If you use it as a variable, it returns the network name of the server you are currently looking at. If you use it as a function and pass it a server number, it returns the network name of the specific server.


Now to go back and answer your questions.

When passed through events, such as onJoin, onText, etc, the "ServerNumber" variable is automaticly parsed and you dont have to retrieve it, just use it. in custom functions or functions that are not event-related (such as OUTTEXT) you must manually retrieve this variable (if you actually need it.)

The GetIdentifier() function can be used in Icechat 5 style scripts, like the one I gave above. If you really wanted to, you could change line 2 of my code to this:

Code: [Select]
if lcase(Network(GetIdentifier("$servernumber")))="quakenet" then
but thats just pointlessly confusing since the network variable by itself has the same effect.
This message brought to you by the Wonderful Wizard of Oz.