View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-16-2018 , 06:36   Re: [Help] MegaHAL chatter bot into amxx module.
Reply With Quote #2

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.
__________________
Arkshine is offline