custom command for mining game
Elexxorine
30 May 2005, 22:41ok the custom command is mine #@object#, how do i get it to check the object. eg 'mine coal', check coal in is room etc.....
EDIT: is it if #@object# = 'coal' then blah blah....... etc. ??
EDIT: is it if #@object# = 'coal' then blah blah....... etc. ??
paul_one
31 May 2005, 09:24The 'coal' is reversed into the object name (say col).
If you just want to chose from a selection (coal/gold/silver/iron-ore) then just use '#object#' and use if's.
If you just want to chose from a selection (coal/gold/silver/iron-ore) then just use '#object#' and use if's.
Elexxorine
31 May 2005, 15:47this is the code i've got, i did what i thought would work but it doesn't:
command <mine #@object#> if ( #@object# = coal ) and here <coal rock> then {
msg <you swing your pic at the rock...>
if ( mininglvl + miningbonus + picval + $rand(-3;3)$ - 9 > 24 ) then {
msg <you get some coal.>
set <have_coal; %have_coal% + 1>
else msg <you fail to get some coal.>
}
}
you want to mine the coal, sees if there rock there, then tests to see if you get it. i think the first bit's wrong, what needs changing?
btw: i'm not using the normal inventory system, i have a variable for each object (how many you have), cos it'll be built into TBC, which uses that system. thanks.
command <mine #@object#> if ( #@object# = coal ) and here <coal rock> then {
msg <you swing your pic at the rock...>
if ( mininglvl + miningbonus + picval + $rand(-3;3)$ - 9 > 24 ) then {
msg <you get some coal.>
set <have_coal; %have_coal% + 1>
else msg <you fail to get some coal.>
}
}
you want to mine the coal, sees if there rock there, then tests to see if you get it. i think the first bit's wrong, what needs changing?
btw: i'm not using the normal inventory system, i have a variable for each object (how many you have), cos it'll be built into TBC, which uses that system. thanks.
Elexxorine
31 May 2005, 23:45ok other snag: i want it to test all the have_whatever values, to see if they're below 0, and if so make them 0. how can i make it so it checks all of them, not me having to type every one in (in the final game there will propably be MILLIONS!!!!!!!!!!!!!!!! - arggg.....) help me please tron/other kind person.
paul_one
01 Jun 2005, 11:14So as I said in the first one - take away the @.
The @ is for OBJECT names/alias's.. You're using it for a string constant.
Think about the part where you check if the object is in the current room... Think it over real hard and don't come to me if you have a problem here in the future.
You can simplify that whole thing down of course - if you use arrays, but it'll be easier for you to do each object (coal/gold/whatever) as seperate commands.
To check if they're below zero use the lessthan if comparison (obviously).
Instead of have_whatever, use:
have[%number%]
and the number is a reference to each object... THIS is an array.
You can go through each number in the array and check if it's zero etc.
The @ is for OBJECT names/alias's.. You're using it for a string constant.
Think about the part where you check if the object is in the current room... Think it over real hard and don't come to me if you have a problem here in the future.
You can simplify that whole thing down of course - if you use arrays, but it'll be easier for you to do each object (coal/gold/whatever) as seperate commands.
To check if they're below zero use the lessthan if comparison (obviously).
Instead of have_whatever, use:
have[%number%]
and the number is a reference to each object... THIS is an array.
You can go through each number in the array and check if it's zero etc.
Elexxorine
01 Jun 2005, 11:23um, i don't really *get* the @object/object thing. or the arrays, can you give me some code or something?