bug, no idea why this doesn't work....

Elexxorine
25 Mar 2005, 15:08
ok, my last post is probably very confusing, but this shouldn't be. :roll:

i have a code when when you try to move it checks to see if your standing, if so it checks you'vre got some stamina, if so you move.
no stamina: tells you to rest. not standing: tells you so.
thhis is the code:
east if ( status1 = 0 ) then {
if ( sta > 0 ) then {
goto <Astnia, marketplace>
set <sta; %sta% - 1>
}
else msg <you are too tired to move.>
}
else msg <you must be standing to move.>

it says you must be standing to move even though status1 = 0!!! why? i even have commands ('stand') to set it to 0, but then it still doesn'r work.

please someone help..... :cry:

paul_one
25 Mar 2005, 18:59
Change the names, to "stamina" and "standing" instead of "sta" and "status1"... Give variables names that mean something!

Right, now as to fix the problem.
You're comparing a string to a number, how will "status1" ever equal "0"?
Try putting %'s around the status (or #'s if it's a string).

You should also turn that into a funtion/procedure to move the player around... Saves you writing the same thing a million times.

Elexxorine
25 Mar 2005, 19:41
i've had a look at the help file on functions, and found lots of stuff, i've read it but i have no idea what to do with functions. i know there like procedures, but how do you get the value at the end?

i want to make one so it'll test the standing and stamina before moving, i'd like to have it so 0 is ok, 1 is youre not standing and 2 is no stamina. please help.

paul_one
25 Mar 2005, 21:32
In the programming world, there is just a function - especially in C/C++.
A procedure is just a set of things that are executed, this is really what happens in windows/BASIC - since various bit's are split up into "procedure-al" based bits, but I have a sneaking suspicion they also return values to the main program - and so are indeed functions.

ANYWAY, to return a value, have a "return" at the end on the function.
And instead of returning a 0, 1 or 2. Have it return nothing. Either have it message the error or move the player to the required room.

Elexxorine
25 Mar 2005, 21:43
i still don't get it..... sorry but could like actually type the code for me, i might understand that. also have you read my inventory idea, if so would it be effective? thanx for all your help..... :D

paul_one
26 Mar 2005, 01:45
Actually my busy meter is reading "200%" right now - with a new job coming my way, and birthday's all over the place.

I am also busy watching movies :P ... I just don't want to write a function doing what you want.

007bond
26 Mar 2005, 02:32

Actually my busy meter is reading "200%" right now



That happens to everyone all the time, especially me!

Elexxorine
26 Mar 2005, 10:33
anyone else? cos i really don't have a clue :oops:

Alex
26 Mar 2005, 14:12
You're missing % signs.


east if ( %status1% = 0 ) then {
if ( %sta% > 0 ) then {


Otherwise Quest doesn't even know to look at the variable...

Elexxorine
26 Mar 2005, 18:40
hey thanx alex. i also put resting in the game, to get your stamina back and fixed all known moving bugs ( man i took AGES! ). any way if anyone would like a copy, they can test it, i need to find all the bugs so far and any other errors. also i'd like to know what people think of it
NOTES:
'rest' : get stamina + hp back. can't move. (it's set to really fast for the tests)
'stand' or 'wake' : lets you move again after resting.
'updates' : version list + 'thanks to' list :D
'stats' : check out your stats.
-encumberment is not done yet.


:P :P :P