Search found 824 matches

by Bugala
Wed Sep 25, 2019 10:40 am
Forum: General programming
Topic: Anyone done script system that is written to a file?
Replies: 14
Views: 686

Re: Anyone done script system that is written to a file?

@SamuraiCrow thanks for answering. Didnt realise there could be something like json parser already existing to do the job for me, although I am not sure JSON will work for me in the end, but at least it is a start and maybe I can at least use parts of it, I am actually asking about it a bit in here:...
by Bugala
Wed Sep 25, 2019 10:30 am
Forum: Showcase
Topic: json.hollywood
Replies: 8
Views: 1203

Re: json.hollywood

It looks like this JSON could be solution to my problem. I am actually still not sure what this JSON exactly is, hence I am asking about this. What I am trying to do is to have something like this for example: Capitol: EnemyGenerator("thieves", 10) EnemyGenerator("orcs", 1) AddEvent("earthquake", 2,...
by Bugala
Mon Sep 23, 2019 8:19 pm
Forum: Tutorials
Topic: Speed testing - for n to x compared to foreach and if elseif else comparison
Replies: 5
Views: 453

Re: Speed testing - for n to x compared to foreach and if elseif else comparison

I never even thought that Global and Local Variables would have difference in speed, so based upon Jalihs comment took a following try: testtable = {} For n=1 To 100 InsertItem(testtable, {name="item"..n, number=Rnd(1)} ) Next amountoftimes=1000000 StartTimer(1) ResetTimer(1) amount = TableItems(tes...
by Bugala
Mon Sep 23, 2019 5:32 pm
Forum: General programming
Topic: Anyone done script system that is written to a file?
Replies: 14
Views: 686

Re: Anyone done script system that is written to a file?

Should have explained bit better, but point is that this is own made script, not hollywood script. So #INCLUDE wont work because they are not Hollywood commands. My examples were bad as they were too Hollywood like commands. But lets have another script: Turn Left, 90 Move Forward, 10 Move Forward, ...
by Bugala
Mon Sep 23, 2019 11:42 am
Forum: Wishlist
Topic: Shuffle Table
Replies: 3
Views: 239

Re: Shuffle Table

Code: Select all

nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Sort(nums, Function(a, b) Return(Rnd(1)) EndFunction)
For k = 0 To 9
   DebugPrint(nums[k])
Next
It is not explained very clearly in the sort documentation, but function needs to return either FALSE or TRUE (which can also be 0 or 1).
by Bugala
Mon Sep 23, 2019 11:22 am
Forum: General programming
Topic: Anyone done script system that is written to a file?
Replies: 14
Views: 686

Anyone done script system that is written to a file?

So far I have done own script systems with Hollywood in way of: Script { [1] = {command = "display picture", filename = "filename.png", x=300, y=300}, [2] = {command = "displaytext", text = "just a test", x=100, y=100}, [3] = {command = "waitfor", forwhat="left mouse"}, [4] = {command = "clearall"} ...
by Bugala
Mon Sep 23, 2019 9:02 am
Forum: Tutorials
Topic: Speed testing - for n to x compared to foreach and if elseif else comparison
Replies: 5
Views: 453

Re: Speed testing - for n to x compared to foreach and if elseif else comparison

OR vs multiple IF vs ELSEIF: StartTimer(1) amountoftimestodo = 10000000 For a=-1 To 6 ResetTimer(1) For n=1 To amountoftimestodo c=0 If a = 1 Or a=2 Or a=3 Or a=4 Or a=5 c=1 EndIf Next time=GetTimer(1) DebugPrint("a:"..a.." time:"..time) Next For a=-1 To 6 ResetTimer(1) For n=1 To amountoftimestodo ...
by Bugala
Mon Sep 23, 2019 8:37 am
Forum: Tutorials
Topic: Speed testing - for n to x compared to foreach and if elseif else comparison
Replies: 5
Views: 453

Re: Speed testing - for n to x compared to foreach and if elseif else comparison

HaveItem vs RawGet: StartTimer(1) amountoftimestocheck = 10000000 a = {} a.b = 1 ResetTimer(1) For n=1 To amountoftimestocheck If RawGet(a, "a") Else EndIf Next time = GetTimer(1) DebugPrint(time) ResetTimer(1) For n=1 To amountoftimestocheck If RawGet(a, "b") Else EndIf Next time = GetTimer(1) Debu...
by Bugala
Sat Sep 21, 2019 6:22 pm
Forum: Tutorials
Topic: Speed testing - for n to x compared to foreach and if elseif else comparison
Replies: 5
Views: 453

Re: Speed testing - for n to x compared to foreach and if elseif else comparison

Next test is about several ELSEIFs with different ELSEIF being the answer. Also ELSEIF-ELSE and ELSEIF¨-SWITCH comparison: timestodo = 10000000 DebugPrint("IF-ELSEIF-ENDIF") StartTimer(1) For a = -1 To 6 b = 0 ResetTimer(1) For n=1 To timestodo If a=1 b=1 ElseIf a=2 b=1 ElseIf a=3 b=1 ElseIf a=4 b=1...
by Bugala
Fri Sep 20, 2019 4:04 pm
Forum: Tutorials
Topic: Speed testing - for n to x compared to foreach and if elseif else comparison
Replies: 5
Views: 453

Speed testing - for n to x compared to foreach and if elseif else comparison

testtable = {} For n=1 To 100 InsertItem(testtable, {name="item"..n, number=Rnd(1)} ) Next StartTimer(1) amount = TableItems(testtable) For n=1 To 10000 For m = 0 To amount-1 item = testtable[m] If item.number = 1 Then item.number=2 If item.number = 0 Then item.number=2 Next Next time = GetTimer(1)...