ULX

Author Topic: draw.DrawText  (Read 3527 times)

0 Members and 1 Guest are viewing this topic.

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
draw.DrawText
« on: September 26, 2015, 11:46:58 PM »
Hello, I edited my completely working code, then I was greeted with this error.

Code: [Select]
[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:408: ')' expected near '<eof>'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

Then I undid all the edits I made, saved it, and

Code: [Select]
[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:408: ')' expected near '<eof>'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

What is happening?

Another thing.
Code: [Select]
draw.DrawText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", ScrW() * 0.5, ScrH() * 0.15, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_CENTER )Isn't working. The default DarkRP lockdown text
Code: [Select]
draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)Isn't even drawing anything.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: draw.DrawText
« Reply #1 on: September 27, 2015, 06:49:18 AM »
The first part of your question is pretty clear - you likely managed to erase a ) (closing bracket) somewhere near line 408 in your code of that file.
EOF means end of file. Somewhere near line 408 there was a opening bracket in a statement or function and the ending one is missing between line 408 and eof.

Apologies, I won't be able to help you with the 2nd part of your question.
I'm sure many of our other community members should be able to.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #2 on: September 27, 2015, 04:04:50 PM »
Nope, I literally spammed ctrl z to go back to when it was working perfectly, and checked everything.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: draw.DrawText
« Reply #3 on: September 27, 2015, 04:31:16 PM »
It's easy to undo too much/little. :D

Would you mind posting your code here so we can help you find what's causing that error?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: draw.DrawText
« Reply #4 on: September 27, 2015, 06:15:53 PM »
Sweepyoface, You asked for help - ignoring those who willingly give it freely gets you no further.
There is no arguing that error.
The code is missing a closing parenthesis - the error message is quite clear in that respect.
408: ')' expected near '<eof>' in file  addons/admin_stick/lua/admin_stick_base_funcs.lua
Somewhere between 407 and end of the file, lua can't find a closing parenthesis to match a starting parenthesis.

Blame who you want for the error if not yourself, that doesn't change the fact the code is missing one.

« Last Edit: September 27, 2015, 06:18:25 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #5 on: September 27, 2015, 06:39:17 PM »
Code: [Select]
AddStickTool("[DarkRP] Toggle Lockdown", {
Description = "Turns lockdown on and off.",
Icon = "icon16/lock.png",
CanTarget = anything,
OnRun = function(Player, Target)
if GetGlobalBool("DarkRP_LockDown") then
SetGlobalBool("DarkRP_LockDown", false)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_ended"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_ended"))
else
SetGlobalBool("DarkRP_LockDown", true)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_started"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_started"))
for k, v in pairs (player.GetAll()) do
v:ConCommand("play npc/overwatch/cityvoice/f_confirmcivilstatus_1_spkr.wav\n")
end
end
end
})
end)

Proper formatting: http://prntscr.com/8l9mn3
« Last Edit: September 27, 2015, 06:41:17 PM by Sweepyoface »

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: draw.DrawText
« Reply #6 on: September 27, 2015, 06:57:03 PM »
You need a closing parenthesis for the OnRun function.
You open an anonymous function declaration but never close it.
Place a closing parenthesis on the third "end".


I'm smart, don't worry about me. ;)
« Last Edit: September 27, 2015, 07:02:50 PM by Bytewave »
bw81@ulysses-forums ~ % whoami
Homepage

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #7 on: September 27, 2015, 06:59:41 PM »
No, that closes the AddStickTool and gives me this.

Code: [Select]
[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:412: '}' expected (to close '{' at line 395) near ')'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

None of my other tools have that, either.

It seems to be working fine now randomly. I'll update if something happens.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: draw.DrawText
« Reply #8 on: September 27, 2015, 07:02:28 PM »
No, that closes the AddStickTool and gives me this.

Code: [Select]
[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:412: '}' expected (to close '{' at line 395) near ')'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

None of my other tools have that, either.

It seems to be working fine now randomly. I'll update if something happens.
Oh wait, I'm smart. Read that wrong.
Hopefully it stays fixed, I suppose. What would be nice is a dump of the entire file, on something like Ubuntu Pastebin. You might have an error higher up in the file.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #9 on: September 27, 2015, 07:17:07 PM »
Now I'm getting

Code: [Select]
[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:412: '}' expected (to close '{' at line 395) near ')'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

on server restart and

Code: [Select]

[ERROR] addons/admin_stick/lua/admin_stick_base_funcs.lua:409: unfinished string near '<eof>'
  1. unknown - addons/admin_stick/lua/admin_stick_base_funcs.lua:0

when trying to use it.

Here it is: http://pastebin.ubuntu.com/12599425/

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #10 on: September 27, 2015, 07:20:13 PM »
Now I just restarted and no problems at all. So confused.

Offline Sweepyoface

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: draw.DrawText
« Reply #11 on: September 28, 2015, 03:07:14 PM »
Alright, this is what I had.

Code: [Select]
AddStickTool("[DarkRP] Toggle Lockdown", {
Description = "Turns lockdown on and off.",
Icon = "icon16/lock.png",
CanTarget = anything,
OnRun = function(Player, Target)
if GetGlobalBool("DarkRP_LockDown") then
SetGlobalBool("DarkRP_LockDown", false)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_ended"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_ended"))
else
SetGlobalBool("DarkRP_LockDown", true)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_started"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_started"))
                         
for k, v in pairs (player.GetAll()) do
v:ConCommand("play npc/overwatch/cityvoice/f_confirmcivilstatus_1_spkr.wav\n")
end
end
end
})

I added the line below printMessageAll and it gives me the ) expected near <eof>

Code: [Select]
AddStickTool("[DarkRP] Toggle Lockdown", {
Description = "Turns lockdown on and off.",
Icon = "icon16/lock.png",
CanTarget = anything,
OnRun = function(Player, Target)
if GetGlobalBool("DarkRP_LockDown") then
SetGlobalBool("DarkRP_LockDown", false)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_ended"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_ended"))
else
SetGlobalBool("DarkRP_LockDown", true)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_started"))
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_started"))
                                draw.DrawNonParsedText("lockdown_started", "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
for k, v in pairs (player.GetAll()) do
v:ConCommand("play npc/overwatch/cityvoice/f_confirmcivilstatus_1_spkr.wav\n")
end
end
end
})

This proves my code is fine and it's being screwed up somehow. The drawing also didn't work and it didn't run any code past that line (the sound)

I then remove that entire line to revert to the perfectly working code before, and it gives me the same error. I bet 99% if I restart the server there will be no more error. But if I edit the code and have it refresh, error, no matter what.
« Last Edit: September 28, 2015, 03:13:43 PM by Sweepyoface »