So im new to lua programming because i play The Binding of isaac and this appears line: '<eof>' expected near 'else' - eof

i cant find the problem about it so im letting the script for fix it
--KEEPER B
elseif Isaac.GetPlayer(playerNum):GetPlayerType() == PlayerType.PLAYER_KEEPER_B then
bruhCostume = Bruhlite.COSTUME_KEEPERBRUH
removeCostume = Isaac.GetCostumeIdByPath("gfx/characters/character_b13_keeper.anm2")
end
I alr tried to see tutorials about it and nothing helped.

Related

problems using KbCheck and KbName (writing a matlab script)

I am currently writing code for a study using matlab and psychtoolbox on a Ubuntu system.
I'm currently trying to write a code snippet where the subject presses either the up or down key in response to a task and then metadata is collected.
However, while my code works fine on my own pc it doesn't work in the lab.
It looks like this:
ListenChar(1)
while 1
[keyIsDown, seconds, keyCode ] = KbCheck;
if keyIsDown
if keyCode(KbName('up'))
disp('up key was pressed');
break;
end
if keyCode(KbName('down'))
disp('you pressed the down key');
break;
end
end
end
I have also tried using just keyCode with numbers I got from here: https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes which didn't work either.
The Key Name 'up' I got from using KbName('KeyNamesLinux'). I also tried 'KP_Up' and 'UP_ARROW'.
When using 'space' (and using the space key respectively) everything works fine.
If anyone has an idea I'll be thankful for any input!
Best,
Anna

"invalid %N$ use detected" vlfeat sift error

I have used the vlfeat toolbox and the vl_sift, lot of times with no problem. I decided to use it in Matlab R2009a, with ubuntu 14.04. This is the error I get while running vl_setup()
??? XML-file failed validation against schema located in:
/home/tonystark/Matlab_prg/sys/namespace/info/v1/info.xsd
XML-file name:
/home/tonystark/freelancing/Content_based_image_retrieval/code/new_code/vlfeat-0.9.18/toolbox/info.xml
To retest the XML-file against the schema, call the following java method:
com.mathworks.xml.XMLValidator.validate(...
'/home/tonystark/freelancing/Content_based_image_retrieval/code/new_code/vlfeat-0.9.18/toolbox/info.xml',...
'/home/tonystark/Matlab_prg/sys/namespace/info/v1/info.xsd', true)
Errors:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found
starting with element 'help_contents_icon'. One of '{product_name_ends_with_type,
help_addon, preference_panel, dialogpref_registrar, project_plugin, state_item, list}'
is expected.
But when I run the same code again, the error doesn't come and the code vl_setup compiles, but no output displayed
And when I run this sample code
clc;
close all;
clear all;
I1 = imread('/home/tonystark/freelancing/Content_based_image_retrieval/Dataset/all_souls_000140.jpg');
I2 = imread('/home/tonystark/freelancing/Content_based_image_retrieval/Dataset/all_souls_000146.jpg');
[f1 d1] = vl_sift(single(rgb2gray(I1)));
[f2 d2] = vl_sift(single(rgb2gray(I2)));
matlab crashes with the following error on the terminal
*** invalid %N$ use detected ***
Aborted (core dumped)
I am stuck here for quite some time without any specific direction. If somebody can point me in the right direction or solve this, it would be of great help! Your help is much appreciated.
UPDATE 1
The readme file of vlfeat says it requires matlab 2009b min, for the toolbox to work. could that be a reason?

MATLAB: ??? In an assignment A(I) = B, the number of elements in B and I must be the same

I'm doing a project modelling the flow of sauce around pasta, using a BEMLIB code for stokes flow called prtcl_3d_ss_visualize.m which is available from "http://dehesa.freeshell.org/BEMLIB/". Here is the code:
%---
file2 = fopen('prtcl_3d_ss_visualize.m')
Npnt = fscanf(file2,'%f',[1,1])
Nvert = fscanf(file2,'%f',[1,1])
Nface = fscanf(file2,'%f',[1,1])
vert = fscanf(file2,'%f',[3,Nvert]);
wall = fscanf(file2,'%f',[1,1])
fclose(file2)
%---
for i=1:Nvert
save = vert(2,i);
vert(2,i) = vert(3,i);
vert(3,i) = save;
end
Ic=0;
for i=1:Nface
for j=1:Npnt
Ic=Ic+1;
fac(j,i) = Ic;
end
end
patch('faces',Nfac’,'vertices',vert’,...
'FaceColor','y',...
'FaceLighting','phong',...
'BackFaceLighting','lit')
%light('Position',[1 3 2]);
%light('Position',[-3 -1 3]);
%material dull
%material shiny
%axis vis3d off
axis([-1.5 1.5 -1.5 1.5 -0.5 2.5 ])
%view(45,34)
xlabel('x')
ylabel('z')
zlabel('y')
xw(1)=-1.5; zw(1)=-1.5; yw(1)=wall;
xw(2)= 1.5; zw(2)=-1.5; yw(2)=wall;
xw(3)= 1.5; zw(3)= 1.5; yw(3)=wall;
xw(4)=-1.5; zw(4)= 1.5; yw(4)=wall;
xw(5)=-1.5; zw(5)=-1.5; yw(5)=wall;
patch(xw,zw,yw,yw);
hold off
I have encountered several errors when inputing the code in matlab, the first of which i solved changing fopen('prtcl_3d') to fopen('partcl_3d_ss_visualize.m') which is the name of he file.
The second error I came up against was where I input
patch('faces',Nfac’,'vertices',vert’,...
'FaceColor','y',...
'FaceLighting','phong',...
'BackFaceLighting','lit')
Nfac' was orighinally fac'but i got error "??? Undefined function or variable fac" so I changed it to an already defined variable Nfac.
The problems I am now faced with the last part of the code. When I enter the first line
xw(1)=-1.5; zw(1)=-1.5; yw(1)=wall;
I get the error message: "??? In an assignment A(I) = B, the number of elements in B and I must be the same."
I get this for the rest of the xw,zw,yw inputs too, what am I doing wrong?
I solved changing fopen('prtcl_3d') to
fopen('partcl_3d_ss_visualize.m') which is the name of he file.
No, you didn't solve it, you broke it. In the original script, partcl_3d_ss_visualize.m (or the version I found on the internets, at least), we have these lines:
file2 = fopen('prtcl_3d.net')
Npnt = fscanf(file2,'%f',[1,1])
Nvert = fscanf(file2,'%f',[1,1])
Nface = fscanf(file2,'%f',[1,1])
vert = fscanf(file2,'%f',[3,Nvert]);
wall = fscanf(file2,'%f',[1,1])
fclose(file2)
This opens some sort of data file prtcl_3d.net, and loads in some required values (this file is presumably included somewhere in the code you downloaded). What you are making it do is make the script load itself and try and find some non-existent floating point numbers at the start of the file.
Having done this, it is likely that the output of wall is empty. Therefore yw(1) (1 element) and wall (zero elements) have different sizes and when you try to assign one to the other you get an error.
Important Note: It won't error earlier because it was able to open the file and try to read something - it is your job to check if what was read in is correct. In this case, just manually looking at your workspace would have been enough. In other cases, error checking can be done using functions such as isempty, isnumeric, size, and so on depending on what sort of output you're expecting.
Regarding fac/Nfac, I imagine that this script does not stand alone and you are supposed to run another script or function before this one that creates the correct variables.
It says on that website:
BEMLIB is a boundary-element software library of Fortran 77 (compatible with Fortran 90) and Matlab codes accompanying the book by C. Pozrikidis, A Practical Guide to Boundary Element Methods with the software library BEMLIB,'' Champan & Hall/CRC, (2002). Chapters 8-12 of the book contain the BEMLIB User Guide
I suggest you need the BEMLIB User Guide to help you understand what the code does and how to use it, and until you do understand that you shouldn't be making any changes to it.

Perl uninitialized value in numeric gt?

I'm a beginner in Perl and I get this message when I execute my code:
Use of uninitialized value $triggerCheck in numeric gt (>) at
./advanced-daemon.pl line 101.
This is the only error/warning I get when executing my code. The code, itself, works without any problems but I'm wondering what's the problem in that variable?
To reproduce the problem you can use this code:
while(1==1)
{
my $triggerCheck = "10";
if($triggerCheck < 10)
{
print "This var is < 10";
}
$triggerCheck = 9;
sleep 1;
}
Edit: I solved my problem. Sorry for bothering you all :)
There is absolutely nothing wrong with that code that you initially posted. Nor the code that you replaced it with (other than the annoying infinite loop).
It gets no errors or warnings and, when I change the initialisation to "9", it outputs the string.
In fact, given that your error message is complaining about > and there's no such symbol anywhere in your code, you have a serious mismatch between reality and your presentation of it.
Seriously, put together the minimal complete code sample that generates the error and post that. Helping people over the net is hard enough without being hobbled by fiction :-)

Lua: require() not working on iPhone

I am working on a shooting game on iPhone and I need lua for scripting levels, enemies, and etc.
So I wrote a bullet script like this:
-- circular_bullet.lua
local time_between_bullets = 0.2;
...
function InitializeCircularBullet(objectName)
...
end
and an enemy script:
-- level1_D2.lua
require("circular_bullet.lua");
...
But it turned out that the enemy script can't "require" the bullet script.
I tried to look into lua library, and found out that in loadlib.c :
static int ll_require (lua_State *L) {
...
if (lua_isfunction(L, -1)) /* did it find module? */
break; /* module loaded sucessfully */
else if (lua_isstring(L, -1)) /* loader returned error message? */
lua_concat(L, 2); /* accumulate it */
else
lua_pop(L, 1);
...
}
It would enter the "else if" branch, which means some error happened, but I have no idea how to read that error message.
If I comment out the "require" line, the enemy "level1_D2" would work as intend without shooting bullet. I also did try copy the whole circular_bullet.lua into level1_D2.lua, and it worked, so the problem must be the require statement.
Those two files are under root directory of the package. (I don't know how to make them in different directory, thus I had found out that Diner Dash kept its scripts in different directory.)
However the two files are not in the same group in my Xcode project. I tried putting them in same group but nothing happened.
Anyone knows what the problem is? Thanks a lot!
Finally I got the answer!!!
the lua require function searches "./scrips" directory for require files, so I got to put those script in the directory!
Yet I still don't know how to change that searching path, but it did work.
I've got a snippet here which might help you to change that path:
// Initialize library path
lua_pushstring(L,"package");
lua_gettable(L, LUA_GLOBALSINDEX);
string path = string(Globals::GetPathPrefix())+"?.lua";
lua_pushstring(L, "path");
lua_pushstring(L, path.c_str());
lua_settable(L, -3);
lua_pop(L,1);
I also had this when I was new to Lua. I don't know this also appears on iPhone, but on Windows I had to remove the '.lua' So just remove the extension.