 |
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Nov 12, 2007 11:31 am
Errors with functions? |
| Quote: |
ERROR: argument still on stack: focus
ERROR: argument still on stack: focus |
This gives me an idea that -something- is wrong with the function I'm calling, however, the error message is pretty vague. Any help/pointers?
It does start the alarms associated with it as normal, so it does -eventually- throw out the command I specified, it will just always fail with that error message the first time.
Help?  |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Mon Nov 12, 2007 12:13 pm |
Use #SEND or #SENDRAW to send a command to the mud. Function were made much more strict in this regards. If you want the #SEND preformed by the calling routine use #RETURN.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Nov 12, 2007 12:36 pm |
It'd help if we could see the code you're using. The main rule is that all functions must end in a #return (at least for now), regardless of whether or not you're interested in the return value. Just use #return "" for now.
|
|
|
|
 |
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Nov 12, 2007 1:03 pm |
| Code: |
#IF (@aeon=0 AND @impatience=0 AND @focustry=0 AND @focusbal=0 AND %numitems( @focusaffs) >= 2 AND @indifference=0) {#SWITCH (@stupidity=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@anorexia=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@recklessness=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@masochism=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@confusion=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@masochism=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@clumsiness=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@indifference=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@hallucinations=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@dementia=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@dizziness=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@claustrophobia=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@agoraphobia=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@vertigo=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@loneliness=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
} (@weariness=1) {
#VARIABLE focustry 1
focus
#T+ Focus_timer
}}
#RETURN "" |
I'll try the #SEND/#SENDRAW that Vijilante suggested. |
|
|
|
 |
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Nov 12, 2007 2:16 pm |
Your 'focus' text considered as data that your function left after its execution, not as command you wish to send to mud. It is an error. That is why Vijilante suggested to use #SEND focus, or #RETURN "focus" and then make use of this returned value in the calling routine.
And why you are checking twice on @masochism=1? It's kind of masochism!  |
|
Last edited by Arde on Mon Nov 12, 2007 2:33 pm; edited 1 time in total |
|
|
 |
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Nov 12, 2007 2:33 pm |
.. Good eye. I was meant to switch the order in which I attempted to cure masochism. I must've forgot to delete one. >.>
|
|
|
|
 |
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Nov 12, 2007 2:39 pm |
| Fang Xianfu wrote: |
| It'd help if we could see the code you're using. The main rule is that all functions must end in a #return (at least for now), regardless of whether or not you're interested in the return value. Just use #return "" for now. |
| Quote: |
2.11 9-Nov-07 (BETA)
* Added new Script Debugging window. If you have a saved layout, customize the main menu toolbar and move the new option in the Window menu to the position in the menu you wish.
* Added automatic timestamps to windows. See the Session Preferences, Scrollback tab for options, including setting the timestamp format and whether to display relative time between lines, or absolute time/date. Color is set in the Styles Preferences
* Added #DEBUG command to send text to the new debug log window
* Old #DEBUG command is now the #DEBUGFILE command
* Added <HR> tag to MXP for drawing horizontal rule. Full syntax is <HR fore="color" back="color" size="pixels">. If used after text, the horizontal rule is drawn from the current cursor position to the end of the line.
* Added the #SAYADD command to add new text to the end of the current line
* Aliases no longer change the current context when they execute
* Variable default values are no longer reset on reconnect
* #SAY and #ECHO properly terminate their colors
* Variables should properly set their default values now instead of being null
* Functions return a null value if no #RETURN is used (instead of giving an error)
* Fixed infinite trigger loop when a trigger doesn't compile and is triggered
* Fixed problem with main window not saving it's size/position
* Disabled expression triggers no longer fire
* Triggers with HTML characters in their patterns should now be handled properly in Compatibility report
* Fixed a crash in updating the tree view in the settings editor
* File/Log option properly reflects whether logging is enabled
* File/Save Buffer properly saved timestamp values
* Logging of windows with timestamps enabled automatically write timestamp values to log file
* Improved performance of dragging the splitter bar in the scrollback display
* Fixed Ctrl-Q speed test to work the same as previous versions (it was changed briefly in v2.10) |
I thought that implies that no #RETURN is needed in functions? (unless you specify it.)
I might be wrong, but I close off all of my functions with #RETURN anyway. |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Nov 12, 2007 3:16 pm |
Grargh. I should really learn to read - I totally missed that change :(
|
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Nov 13, 2007 1:53 am |
I have to do this. There are some days I am just disturbed by messy code.
Also you have indifference checked for both 0 and 1. I think that might be a problem.
| Code: |
#IF (@aeon=0 AND @impatience=0 AND @focustry=0 AND @focusbal=0 AND %numitems( @focusaffs) >= 2 AND @indifference=0) {
$DoFocus=(@stupidity+@anorexia+@recklessness+@masochism+@confusion+@clumsiness+@agoraphobia)
$DoFocus=($DoFocus+@indifference+@hallucinations+@dementia+@dizziness+@claustrophobia+@vertigo)
$DoFocus=($DoFocus+@loneliness+@weariness)
#IF ($DoFocus) {
#VARIABLE focustry 1
#SEND focus
#T+ Focus_timer
}
}
#RETURN "" |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Tue Nov 13, 2007 2:21 am |
Much neater! 
|
|
|
|
 |
|
|
|