|
Joined: Feb 2007
Posts: 2
Bowl of petunias
|
OP
Bowl of petunias
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 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
Last edited by Zephyr; 24/02/07 11:58 AM.
|
|
|
|
Joined: Nov 2005
Posts: 105
Vogon poet
|
Vogon poet
Joined: Nov 2005
Posts: 105 |
You error lays in your elseif lines. Your lines currently look like I'm not sure why, but you seperated your elseif ith a {. Take the { out from in between so it they look like 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.
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
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. 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.
|
|
|
|
Joined: Feb 2007
Posts: 2
Bowl of petunias
|
OP
Bowl of petunias
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
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
'else' is also a keyword in mIRC, so: else { if (...) { ... } } Is perfectly valid.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
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?
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
The IF is on the same line as the event. ie.
on *:EVENT:*:*:{ if (condition)..
-genius_at_work
|
|
|
|
|