mIRC Home    About    Download    Register    News    Help

Print Thread
Small glitch/Error #171439 24/02/07 11:55 AM
Joined: Feb 2007
Posts: 2
Z
Zephyr Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
Z
Joined: Feb 2007
Posts: 2
Just a little baffled by the fact that, I think it is all right. It all works but when it comes to actually using it, it does not say 'You begin to chop a Yew Tree'. On the whole it works fine it's just that. Here it is

Code:
on *:text:!cut yew*:#RuneScapeLife:{ if (!$($+(%,$nick),2)) notice $nick You do not have an account! Type !create to make one.
  else { if ($($+(%,$nick,.WcXP),2) < 50000) notice $nick You do not have enough Woodcutting experience to cut a Yew Tree. (50000 Woodcutting Experience minimum.)  
    else { if ($($+(%,$nick,.Busy),2) == On) notice $nick You need to wait before you can cut another Yew Tree!
      else { if (!$($+(%,$nick,.Axe),2)) notice $nick You do not have an Axe!
>>>>>>   else { if (!$($+(%,$nick,.RuneAxe),2) == Yes) notice $nick You begin to chop a Yew Tree... 
          set % $+ $nick $+ .yewlogs $rand(1,15)
          timer 1 5 notice $nick You have chopped $($+(%,$nick,.yewLogs),2) Logs.
          inc % $+ $nick $+ .Yews $($+(%,$nick,.yewLogs),2)
          inc % $+ $nick $+ .WcXP $calc($($+(%,$nick,.yewLogs),2) * 175)
          unset % $+ $nick $+ .yewLogs
          set % $+ $nick $+ .Busy on
          timer 1 10 unset % $+ $nick $+ .Busy
          else { notice $nick You begin to chop a Yew Tree...
            set % $+ $nick $+ .yewlogs $rand(1,10)
            timer 1 5 notice $nick You have chopped $($+(%,$nick,.yewLogs),2) Logs.
            inc % $+ $nick $+ .Yews $($+(%,$nick,.yewLogs),2)
            inc % $+ $nick $+ .WcXP $calc($($+(%,$nick,.yewLogs),2) * 175)
            unset % $+ $nick $+ .yewLogs
            set % $+ $nick $+ .Busy on
            timer 1 10 unset % $+ $nick $+ .Busy
          }
        }
      }
    }
  }
} 


I pointed out the line which has the error, it goes through 'else { if (!$($+(%,$nick,.RuneAxe),2) == Yes)' But then it skips out the 'notice $nick You begin to chop a Yew Tree'

Hope you can help, Thanks wink

Last edited by Zephyr; 24/02/07 11:58 AM.
Re: Small glitch/Error [Re: Zephyr] #171440 24/02/07 12:17 PM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
You error lays in your elseif lines. Your lines currently look like
Code:
 else { if 
I'm not sure why, but you seperated your elseif ith a {. Take the { out from in between so it they look like
Code:
 elseif 
I haven't tested to see if there's anything else wrong, but this is the only mistake I can see by looking at it.

Re: Small glitch/Error [Re: Zephyr] #171442 24/02/07 12:35 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
hi Zephyr. Well I have to admit, I am not familiar with identifiers you have used. It very well could be my inexperience.

for starters, I removed a lot of else's and used halts instead.
I stopped at the line you had trouble with because I was a little perplexed.
Code:
on *:text:!cut yew*:#RuneScapeLife:{
  if (!$($+(%,$nick),2)) { notice $nick You do not have an account! Type !create to make one. | halt }
  if ($($+(%,$nick,.WcXP),2) < 50000) { notice $nick You do not have enough Woodcutting experience to cut a Yew Tree. (50000 Woodcutting Experience minimum.) | halt }  
  if ($($+(%,$nick,.Busy),2) == On) notice $nick You need to wait before you can cut another Yew Tree!
  if (!$($+(%,$nick,.Axe),2)) { notice $nick You do not have an Axe! | halt }
  else {
    if (!$($+(%,$nick,.RuneAxe),2) == Yes) notice $nick You begin to chop a Yew Tree... 
    set % $+ $nick $+ .yewlogs $rand(1,15)
    timer 1 5 notice $nick You have chopped $($+(%,$nick,.yewLogs),2) Logs.
    inc % $+ $nick $+ .Yews $($+(%,$nick,.yewLogs),2)
    inc % $+ $nick $+ .WcXP $calc($($+(%,$nick,.yewLogs),2) * 175)
    unset % $+ $nick $+ .yewLogs
    set % $+ $nick $+ .Busy on
    timer 1 10 unset % $+ $nick $+ .Busy
    else { 
      notice $nick You begin to chop a Yew Tree...
      set % $+ $nick $+ .yewlogs $rand(1,10)
      timer 1 5 notice $nick You have chopped $($+(%,$nick,.yewLogs),2) Logs.
      inc % $+ $nick $+ .Yews $($+(%,$nick,.yewLogs),2)
      inc % $+ $nick $+ .WcXP $calc($($+(%,$nick,.yewLogs),2) * 175)
      unset % $+ $nick $+ .yewLogs
      set % $+ $nick $+ .Busy on
      timer 1 10 unset % $+ $nick $+ .Busy
    }
  }
}


I will touch on the identifiers last. Lets assume all your comparisons are correct.

At the line you marked you say...
else {
if (variable == Yes) {
notice $nick chop tree
set rand var
start timer
inc var
inc var
unset var
set var
start timer
else { <its this else, else what? It needs an if statement to say else.

Ok now I am not familiar at all with (!$(%var,2) == yes)
ex: (!$($+(%,$nick,.RuneAxe),2) == Yes) Please explain this to me so I can learn this way.

Also, in my experience using variables, its best to use evaluation brackets. [ ] I start a variable by a static name and then attach the dynamic info to it.
Lets use $($+(%,$nick,.yewLogs),2) as an example.
%yewLogs. [ $+ [ $nick ] ] this is how I am used to writing dynamically named variables. I am open to learning new ways.

Re: Small glitch/Error [Re: drc4] #171444 24/02/07 12:46 PM
Joined: Feb 2007
Posts: 2
Z
Zephyr Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
Z
Joined: Feb 2007
Posts: 2
It still works and that isn't the problem, I made it a command by accident by using an extra ! when not needed. Thanks anyway smile

Re: Small glitch/Error [Re: DJ_Sol] #171447 24/02/07 01:25 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Avoid HALT in a script. Use RETURN if you need to. Even so, I'd personally use ELSEIF in that situation (and not ELSE { IF ).


Invision Support
#Invision on irc.irchighway.net
Re: Small glitch/Error [Re: drc4] #171501 25/02/07 12:20 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
'else' is also a keyword in mIRC, so:

Code:
else { if (...) { ... } }


Is perfectly valid.

Re: Small glitch/Error [Re: hixxy] #171504 25/02/07 02:23 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I didn't say it wasn't. However, as-is, you're basically doing extra commands.

ELSE
IF
ELSE
IF

Rather than:

ELSEIF
ELSEIF

I can't see that being a very optimal way of doing ELSEIF stuff.


Invision Support
#Invision on irc.irchighway.net
Re: Small glitch/Error [Re: Riamus2] #171508 25/02/07 03:32 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I didn't reply to you.

Re: Small glitch/Error [Re: hixxy] #171509 25/02/07 04:19 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
let me try to illustrate my point.

on *:join:#:{
else { if (..) { .. } }
}
This is what I see, join event is just for an example. Why would you say else with no preceeding if?

As for the author of this thread, I asked to learn the identifier you are using. Is this possible?

Re: Small glitch/Error [Re: DJ_Sol] #171513 25/02/07 05:09 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The IF is on the same line as the event. ie.

on *:EVENT:*:*:{ if (condition)..

-genius_at_work