View Single Post
metal_upa
Senior Member
Join Date: Jun 2016
Old 11-18-2018 , 03:36   Re: [Help] MegaHAL chatter bot into amxx module.
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
PHP Code:
    /*
     *        Loop for the specified waiting period, generating and evaluating
     *        replies
     */
    
max_surprise=(float)-1.0;
    
count=0;
    
basetime=time(NULL);
/*     progress("Generating reply", 0, 1);  */
    
do {
    
replywords=reply(modelkeywords);
    
surprise=evaluate_reply(modelkeywordsreplywords);
    ++
count;
    if((
surprise>max_surprise)&&(dissimilar(wordsreplywords)==TRUE)) {
        
max_surprise=surprise;
        
output=make_output(replywords);
    }
/*      progress(NULL, (time(NULL)-basetime),timeout); */
    
} while((time(NULL)-basetime)<timeout); 

"Loop for the specified waiting period"

That's the issue. It seems it forces the loop to run until 1 second elapsed to simulated a waiting time?
You can't do that in HLDS, it's single-threaded, it's going to block everything else.
Remove the do/while, and if you need the waiting, use a task system.
I see, thanks for your help, i've removed this do/while and it works.
metal_upa is offline