Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
Could you tell me what exactly it writes? I'm running a bit short on ideas. Just now, I realized that the player number is passed to the a1 function, but ideally, this shouldn't affect anything.
Novik, in his manual, describes how to create hooks; you can use it.
void errorHook( fCallback )
Allows you to set an error handler. By default, when a script error occurs, the current thread terminates. Thanks to this function, you have the opportunity to adjust this behavior – before stopping, control will be passed to the fCallback function.
Example:
function onError()
print("Error occured ")
end
function SetArtefactUntrans(nArtefactName)
errorHook(onError)
RemoveArtefact("Berein",nArtefactName)
GiveArtefact("Berein",nArtefactName,1)
end
If an error occurs in the SetArtefactUntrans function (for example, if the hero does not have the required artifact), the string "Error occured " will be displayed in the console. Note that this very informative string will not save you from the thread stopping (nor from displaying diagnostics in the console). The hook will work in all script threads (and not just in the one that called it) until errorHook is called with the parameter nil. I also recommend paying attention to the fact that the hook only works on runtime errors; it does not affect interpretation errors. Regarding the example provided, it is much more reasonable to check the hero for the presence of the required artifact instead of using a hook.