Search found 614 matches

by rjroldan1
Mon Jun 22, 2020 15:02
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Ohh wait @Ølsken what's the role of "local number = 12" there based on my sent script?
by rjroldan1
Mon Jun 22, 2020 14:21
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

But thats still need lots of elseif conditions


Ok I get it thanks :)
by rjroldan1
Mon Jun 22, 2020 13:23
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Ølsken wrote:
Mon Jun 22, 2020 12:46
Long? Can you show the code?
Lets go PM
by rjroldan1
Mon Jun 22, 2020 12:20
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Hello again may i ask if this was an issue
IMG_20200622_174421.jpg
IMG_20200622_174421.jpg (10.8 KiB) Viewed 1246 times
I used long "if, elseif " conditions and it works fine, I just want to ask if it is still valid even it has error like that ↑?
by rjroldan1
Mon Jun 22, 2020 3:11
Forum: Other
Topic: Eye protection filters v2
Replies: 11
Views: 1324

Re: Eye protection filters v2

I dont think that it was an issue :calc
by rjroldan1
Sun Jun 21, 2020 16:07
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

It works well now Thanks for your help also :)

Hope this conversation would help others too :)
by rjroldan1
Sun Jun 21, 2020 16:05
Forum: Smalltalk
Topic: Anyone know History of Theotown?
Replies: 5
Views: 2590

Re: Anyone know History of Theotown?

CommanderABab wrote:
Fri Dec 27, 2019 0:58
https://youtu.be/7gY3_Zxjenw
I liked how cars and fountain animation moves so smooth
by rjroldan1
Sun Jun 21, 2020 15:30
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

... local _, rank, var2 function script:update() _, rank = City.getRank() end local var = function() var2 = rank * 1 end ... I you define a variable as local in a function it won't be accessible from outside of that function :teach Oh ok i get it this is just like getting the 2nd return info. To st...
by rjroldan1
Sun Jun 21, 2020 15:05
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

local flag1 = Draft.getDraft("AoSflag1") local flag2 = Draft.getDraft("AoSflag2") local flag3 = Draft.getDraft("AoSflag3") local flag4 = Draft.getDraft("AoSflag4") function script:update() local rank = City.getRank() end local var = function () local var2 = rank * 1 end function script:draw(tileX, ...
by rjroldan1
Sun Jun 21, 2020 15:02
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Lobby wrote:
Sun Jun 21, 2020 15:02
Please upload your whole code as text so I can edit it :)
Together with json?
by rjroldan1
Sun Jun 21, 2020 15:00
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Lobby wrote:
Sun Jun 21, 2020 14:57
Yes, because your var2 was also declared as local within a function :)

Im clueless what should i do :calc
by rjroldan1
Sun Jun 21, 2020 14:56
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Lobby wrote:
Sun Jun 21, 2020 14:54

Code: Select all

...
local _, rank

function script:update()
  _, rank = City.getRank()
end
...
:teach

I try this but it gives me an issue that like "expected 'then at line (where the condition are) " even it has already
by rjroldan1
Sun Jun 21, 2020 14:50
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Anyway i add new function to call before it initiate the condition , hope this work
Screenshot_20200621-204754.png
by rjroldan1
Sun Jun 21, 2020 14:45
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

So if i don't include "_," thing, my variables turns to global variable? Anything that doesn't have local in front of it is a global value in Lua. _ is just a variable name like rank since Lua allows alphanumeric and _ for variable names (cannot start with a number though) _ in Lua is a common plac...
by rjroldan1
Sun Jun 21, 2020 12:40
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

So if i don't include "_," thing, my variables turns to global variable?
by rjroldan1
Sun Jun 21, 2020 12:36
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

@rjroldan1 I'd say more like that: local _,rank function script:update() _,rank = City.getRank() end You have to define rank as local outside of script:update() if you want to use it in another function (it's nil there otherwise) City.getRank() does return the rank index as second return value, the...
by rjroldan1
Sun Jun 21, 2020 12:05
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Still not work @Ølsken Is the flag an animation or static? If static you forgot getFrame([ number ]) . So flag1 = Draft.getDraft("Aosflag4"):getFrame(1) -- or Drawing.drawImage(flag1:getFrame(1), x, y) An animation it works well if i exclude the rank condition but i dont want it to be like that
by rjroldan1
Sun Jun 21, 2020 11:46
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Still not work @Ølsken
by rjroldan1
Sun Jun 21, 2020 11:30
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

I will try
by rjroldan1
Sun Jun 21, 2020 10:12
Forum: Lua Scripting
Topic: Lua chatbox
Replies: 161
Views: 8836

Re: Lua chatbox

Need help @Ølsken

While coding an animation (via lua) that only occurs when City ranks is 0 and I'd encountered this:
Screenshot_20200621-160143.png
Im using realtime editing btw here's the script
IMG_20200621_160303.jpg
IMG_20200621_160303.jpg (23.89 KiB) Viewed 1805 times

Go to advanced search