throwing objects command problem
lyteside
16 Apr 2007, 17:24hey, could i get some advice on how to make this proc work appropriately... currently, if the player has the object in question, it will still give me a "i can't see that here" in response to the command. but if the object is in the same room as the player, it will run the "else" part at the end, like its suppose to. just curious on what i should change. all the other procs and timers that lead from this are in working order.
command <throw #@object# at #throwtarget# #throwdirection#> {
if (%battle% > 0 ) then msg <You are too busy |iBATTLING|xi right now to throw that further in |i|bany|xi|xb direction!>
else {
if got <#object#> then {
if (#throwdirection# = n) then set string <throwdirection; north>
if (#throwdirection# = s) then set string <throwdirection; south>
if (#throwdirection# = e) then set string <throwdirection; east>
if (#throwdirection# = w) then set string <throwdirection; west>
if (#throwdirection# = ne) then set string <throwdirection; northeast>
if (#throwdirection# = nw) then set string <throwdirection; northwest>
if (#throwdirection# = se) then set string <throwdirection; southeast>
if (#throwdirection# = sw) then set string <throwdirection; southwest>
if (#throwdirection# = u) then set string <throwdirection; up>
if (#throwdirection# = d) then set string <throwdirection; down>
do <throwdirectionproc(#throwdirection#)>
}
else {
if property <#object#; combat> then msg <That character is a bit to big for you to throw across the room.>
else msg <You have to pick up that item first before you can throw it.>
}
}
}
witch wyzwurd
16 Apr 2007, 20:06First: You have your italics and bold formatting tags nestled incorrectly ("any").
Second: It appears you have one too many "else" conditionals...
command <throw #@object# at #throwtarget# #throwdirection#> {
if (%battle% > 0 ) then msg <You are too busy |iBATTLING|xi right now to throw that further in |i|bany|xi|xb direction!>
else {
if got <#object#> then {
if (#throwdirection# = n) then set string <throwdirection; north>
if (#throwdirection# = s) then set string <throwdirection; south>
if (#throwdirection# = e) then set string <throwdirection; east>
if (#throwdirection# = w) then set string <throwdirection; west>
if (#throwdirection# = ne) then set string <throwdirection; northeast>
if (#throwdirection# = nw) then set string <throwdirection; northwest>
if (#throwdirection# = se) then set string <throwdirection; southeast>
if (#throwdirection# = sw) then set string <throwdirection; southwest>
if (#throwdirection# = u) then set string <throwdirection; up>
if (#throwdirection# = d) then set string <throwdirection; down>
do <throwdirectionproc(#throwdirection#)>
}
<--------------------------------makes sense up to here-------
------------why do you have the next else conditional?----->
<quote>else {
if property <#object#; combat> then msg <That character is a bit "to" big for you to throw across the room.></quote>
why not just another if-conditional? As in:
else if you have the object then (commands); if combatted object then "too big."
Then nestle in the next "else" conditional...
else msg <You have to pick up that item first before you can throw it.>
}
}
}
You'd have to eliminate a curly brace then.
I'm not sure if this will help your problem, but cleaning up the code would be good anyways. Other than those issues, I didn't find anything wrong. Maybe you do have a conflict somewhere else in your code.
Powered by phpBB
Second: It appears you have one too many "else" conditionals...
command <throw #@object# at #throwtarget# #throwdirection#> {
if (%battle% > 0 ) then msg <You are too busy |iBATTLING|xi right now to throw that further in |i|bany|xi|xb direction!>
else {
if got <#object#> then {
if (#throwdirection# = n) then set string <throwdirection; north>
if (#throwdirection# = s) then set string <throwdirection; south>
if (#throwdirection# = e) then set string <throwdirection; east>
if (#throwdirection# = w) then set string <throwdirection; west>
if (#throwdirection# = ne) then set string <throwdirection; northeast>
if (#throwdirection# = nw) then set string <throwdirection; northwest>
if (#throwdirection# = se) then set string <throwdirection; southeast>
if (#throwdirection# = sw) then set string <throwdirection; southwest>
if (#throwdirection# = u) then set string <throwdirection; up>
if (#throwdirection# = d) then set string <throwdirection; down>
do <throwdirectionproc(#throwdirection#)>
}
<--------------------------------makes sense up to here-------
------------why do you have the next else conditional?----->
<quote>else {
if property <#object#; combat> then msg <That character is a bit "to" big for you to throw across the room.></quote>
why not just another if-conditional? As in:
else if you have the object then (commands); if combatted object then "too big."
Then nestle in the next "else" conditional...
else msg <You have to pick up that item first before you can throw it.>
}
}
}
You'd have to eliminate a curly brace then.
I'm not sure if this will help your problem, but cleaning up the code would be good anyways. Other than those issues, I didn't find anything wrong. Maybe you do have a conflict somewhere else in your code.
Powered by phpBB
lyteside
16 Apr 2007, 22:26after some further testing, i realize now that if the got <object> returns true, it will run a msg tag in the braces. like a MSG <Test1> or whatever, but it does not run any procedure from within it. I tried to just linking to any random procedure, but to no avail. like this.
when i do the command, it only returns "Test1". Any suggestions?
command <throw #@object# at #throwtarget# #throwdirection#> {
if got <#object#> then {
msg <Test1>
do <randomtestproc>
}
else {
if property <#object#; combat> then msg <That character is a bit to big for you to throw across the room.>
else msg <You have to pick up that item first before you can throw it.>
}
}
define procedure <randomtestproc>
msg <Test2>
end define
when i do the command, it only returns "Test1". Any suggestions?
Alex
17 Apr 2007, 12:18That code works fine for me:
Gives:
Have you checked the ASL Log for any error messages?
define game <test>
asl-version <400>
start <room>
end define
define text <intro>
end define
define room <room>
define object <thing>
take
end define
command <throw #@object# at #throwtarget# #throwdirection#> {
if got <#object#> then {
msg <Test1>
do <randomtestproc>
}
else {
if property <#object#; combat> then msg <That character is a bit to big for you to throw across the room.>
else msg <You have to pick up that item first before you can throw it.>
}
}
end define
define procedure <randomtestproc>
msg <Test2>
end define
Gives:
You are in room.
There is thing here.
> take thing
You pick it up.
> throw thing at a b
Test1
Test2
Have you checked the ASL Log for any error messages?
lyteside
17 Apr 2007, 15:29finally figured out that it was because the procedure was in the add to game area of the qlb file. when i left the commands and variables in the add to game area, did the !end tag, and then put the procedures after it, seemed to work fine!
thanks for your help. yay.
thanks for your help. yay.