Trivia Bot issues... I think...
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Trivia Bot issues... I think...

Started by Spleeze, 28 December, 2003, 20:12:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spleeze

Hi. First time poster. Long time reader. HeHe.

Anyhow, I just got the TriviaBot 2.1 and have been using it... However when i load the script it tells me that it has a syntax error, but everything looks like it works to me....

this is where i got the script...
http://207.44.232.77/~lysekil/script/lua/trivia(2.1).rar

this is the syntax error that it gives me...
Syntax Error: attempt to index local `curUser' (a nil value)


This is probably a really easy mistake that i made, but you guys need to set me straight. thanks...

xjr13sp

thanks to past the entire script ...

Spleeze

Here is one possible problematic peice of code... I did not post all of the code before because it's just too big to post! I couldn't post it all now, so I gave you a part that might have a problem... That's why i provided people with a link to the source so they could inspect the whole thing on thier own.... Thanks guys, I hope someone could help me out...

Quotefunction Main()
  frmHub:RegBot(BotName)
  ReloadQuestions()
  setlocale("swe")
  LoadScores()
end

function NewUserConnected(curUser)
  if (boolAutoLogin) then
   if (not (playerArray[curUser.sName])) then
        playerArray[curUser.sName] = 1
  else
     playerArray[curUser.sName] = nil
  end
  end
end

function OpConnected(curUser)
  if (boolAutoLogin) then
   if (not (playerArray[curUser.sName])) then
        playerArray[curUser.sName] = 1
  else
     playerArray[curUser.sName] = nil
  end
  end
end

function UserDisconnected(curUser)
  playerArray[curUser.sName] = nil
end

function OpDisconnected(curUser)
  playerArray[curUser.sName] = nil
end

function DataArrival(curUser, data)
  local boolPlaydata = nil
  if (strsub(data, 1, 1) == "<") then
    data = strsub(data, 1, (strlen(data) - 1))
    if ((lngMode == 0) or (lngMode == 1)) then
      boolPlaydata = 1
    end
  elseif (strsub(data, 1, 4) == "$To:") then
    data = strsub(data, 1, (strlen(data) - 1))
    local _, _, whoTo = strfind(data,"$To:%s+(%S+)")
    if (whoTo == BotName) then
      data = strsub(data, (15 + strlen(BotName) + strlen(curUser.sName)))
      if (lngMode == 2) then
        boolPlaydata = 1
      end
    end
  end

xjr13sp

Sorry... this part of code should work fine ...

SMF spam blocked by CleanTalk