Author Topic: Varibles  (Read 4287 times)

Jacob

  • Newbie
  • *
  • Posts: 45
Varibles
« on: March 18, 2008, 08:33:51 PM »
Is there a way to make it so that when I do /test it add 1 to $test? So if $test = 1, when I do /test/ $test = 2?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Variables
« Reply #1 on: March 19, 2008, 11:12:25 AM »
This is a LOT easier to do with VB Script

So you can add an alias /test /! Test

Then for the Script , add this.

Code: [Select]
somevalue = 1
Sub Test()
somevalue = somevalue + 1
End Sub

If you want to do it with mirc style, I will need to get back to you, as I am getting an error for some reason doing that.
The IceChat God

Jacob

  • Newbie
  • *
  • Posts: 45
Re: Varibles
« Reply #2 on: March 19, 2008, 01:40:28 PM »
Dosent work for me

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Varibles
« Reply #3 on: March 19, 2008, 02:47:29 PM »
this variable gets reseted every time you save the script. Use this to save the number to an .ini file:

Code: [Select]
   count = GetIniFile("counter.ini","Counter","Total", "0")           
   WriteIniFile "counter.ini","Counter","Total",count + 1
"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

Jacob

  • Newbie
  • *
  • Posts: 45
Re: Varibles
« Reply #4 on: March 19, 2008, 05:17:51 PM »
What should the ini look like?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Varibles
« Reply #5 on: March 19, 2008, 05:36:20 PM »
The INI file will get auto created for you.

And what part of it did not "work" ?
You did not have any way to make it respond back to you, so it will work just fine.

If you want to return the value, the script will need to do that as well.
The IceChat God

Jacob

  • Newbie
  • *
  • Posts: 45
Re: Varibles
« Reply #6 on: March 19, 2008, 07:31:16 PM »
I got it, thanks

Jacob

  • Newbie
  • *
  • Posts: 45
Re: Varibles
« Reply #7 on: March 19, 2008, 07:36:10 PM »
Now how do you have it say the number

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: Varibles
« Reply #8 on: March 19, 2008, 10:16:19 PM »
Use SendCommand.

Code: [Select]
Sub Test()
somevalue = somevalue + 1
SendCommand "SomeValue: " & somevalue
End Sub
This message brought to you by the Wonderful Wizard of Oz.

Jacob

  • Newbie
  • *
  • Posts: 45
Re: Varibles
« Reply #9 on: March 20, 2008, 03:14:29 PM »
Thanks, it works