people playing: 133, servers online: 41, games played: 132,248,834 Top Player: Karteiro

  Toribash Community » Toribash » Mods » Lua scripts
Register FAQ Community
Reply
 
Thread Tools Display Modes
Old Dec 24, 2012   #11
Yoyo
 
5th Dan Black Belt
Join Date: Nov 2009
Posts: 4,169





I want mine to look more like this.
multiple texture uploader! updated: multiple texture remover!
updated pretty colorlist!

<BobJoelZ> ok ive just rebooted my pc and ive tried to activate my reflex on yahoo internet explorer :/ no luck

<Aracoon> I do not enjoy having anal sex with multiple men
Yoyo is offline   Reply With Quote
Old Dec 25, 2012   #12
psycore
Member
 
2nd Dan Black Belt
Join Date: Feb 2010
Posts: 388



Ah I guess I know what you mean.
I think I know the problem but I don't really know how to describe it. I'll try it like this:
The walls aren't actually parts of the grid.
There are two types of cells:

Path-cells which either are or aren't part of the maze (yet). (When the algorithm is done, ALL path-cells will be part of the maze)

and

Wall-cells which can either be walls or passages.

Let's use colors for more explanation:

White: Path-cells which are part of the maze.
Grey: Path-cells which are not part of the maze yet.
Black: Walls
Green: Passages
Red: Potential passages
Pink: Chosen wall (see later)

The algorithm we're following is this:
Code:
1. Start with all wall-cells as walls and all path cells as not part of the maze.
2. Choose one path-cell. Make it part of the maze. Add neighboring walls to your wall queue (what you called "n". btw: seriously, choose better variable names. Mine aren't perfect either, but at least you get an idea what they're used for).
3. While the wall queue is not empty:
    3.a. Choose random element of the wall queue. (The one I painted pink)
    3.b. If only one path-cell at the selected queue element is part of the maze:
        3.b.1 Make the selected queue entry a passage.
        3.b.2 Add other path-cell to the maze.
        3.b.3 Add neighboring walls to the wall queue (if not already in there)

    3.c Remove selected queue entry from the queue.
4. Done
In pictures:

Initial state:

Image was removed.

Choose random queue element:

Image was removed.

3.b.1 - 3.c.:

Image was removed.

Repeat again and again:

Image was removed.

Example where 3.b. is false:

Image was removed.

Image was removed.

Now just color paths and passages white, walls and path-cells which are not yet part of the maze black and the selected queue element red and it'll look like the video:

Image was removed.
(Well, not very impressive, but I only have paint at the moment. Sorry )

I hope you get what I mean.
Signature temporarily out of order.

Last edited by Thrandir; Aug 25, 2015 at 07:51 PM..
psycore is offline   Reply With Quote
Old Dec 25, 2012   #13
Yoyo
 
5th Dan Black Belt
Join Date: Nov 2009
Posts: 4,169



I'm gonna try to absorb all you just said and redo the algorithm, thanks!
multiple texture uploader! updated: multiple texture remover!
updated pretty colorlist!

<BobJoelZ> ok ive just rebooted my pc and ive tried to activate my reflex on yahoo internet explorer :/ no luck

<Aracoon> I do not enjoy having anal sex with multiple men
Yoyo is offline   Reply With Quote
Old Jun 14, 2013   #14
box
?crazykid700=flashglass
 
Cardboard Belt
Join Date: Sep 2007
Posts: 9,171
Clan: I am



Code:
size_x, size_y, size_z = 0.3, 0.3, 0.3

local function draw_box()
        set_color(1, 0, 0, .5)
		body = get_body_info(0, 11)
        draw_box_m(body.pos.x, body.pos.y, body.pos.z, size_x, size_y, size_z, body.rot)
		body = get_body_info(0, 12)
        draw_box_m(body.pos.x, body.pos.y, body.pos.z, size_x, size_y, size_z, body.rot)
        set_color(0, 0, 1, .5)
        body = get_body_info(1, 11)
        draw_box_m(body.pos.x, body.pos.y, body.pos.z, size_x, size_y, size_z, body.rot)
        body = get_body_info(1, 12)
        draw_box_m(body.pos.x, body.pos.y, body.pos.z, size_x, size_y, size_z, body.rot)
end

add_hook("draw3d", "draw_box", draw_box)
Extremely anti-complicated code that color-codes Tori and Uke's hands. You know, just in case you're in a room, and can't tell who is who. In those rare cases.

It's a thread for useless scripts, right?
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
box is offline   Reply With Quote
Old Jun 15, 2013   #15
Blam
Now I know my abc's!
This user title is the property of SkulFuk.
 
4th Dan Black Belt
Join Date: Apr 2007
Posts: 5,506
Clan: bncy



You can click on people to get their names pop up, no? :P
:D
Blam is offline   Reply With Quote
Old Jun 15, 2013   #16
box
?crazykid700=flashglass
 
Cardboard Belt
Join Date: Sep 2007
Posts: 9,171
Clan: I am



Well, yeah, but not in versions before like, 3.94...

I'm sure someone will find it helpful!
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
box is offline   Reply With Quote
Old Jun 15, 2013   #17
Eleeleth
Also Only responds to 'Eleeth'!
 
6th Dan Black Belt
Join Date: Apr 2008
Posts: 1,564
Clan: NO



Originally Posted by Blam View Post
You can click on people to get their names pop up, no? :P

:effort:
<~suomynona> TITS OR ELEELETH
Eleeleth is offline   Reply With Quote
Old Jun 20, 2013   #18
Blam
Now I know my abc's!
This user title is the property of SkulFuk.
 
4th Dan Black Belt
Join Date: Apr 2007
Posts: 5,506
Clan: bncy



Timers: https://gist.github.com/BlamBear/5823067
Graphs: https://gist.github.com/BlamBear/5802092
:D
Blam is offline   Reply With Quote
Old May 15, 2015   #19
Merc
Chatterbox
 
7th Dan Black Belt
Join Date: Feb 2013
Posts: 4,935



Can I post a vbs script too please? It's similar to Lua Coding. It's a Fake Prank Virus File If I can't post it here it's ok
| Mercenary of FC | Fear Me | Selling Expensive Sets |
Merc is offline   Reply With Quote
Old Aug 23, 2015   #20
Stupinator
NON-EXISTING!
 
6th Dan Black Belt
Join Date: Mar 2008
Posts: 3,800



So working on my sin and cos knowledge, I decided to just make a random script... and well... it's random alright.
lua code:

x = 0
y = 0
length = 50
angle = 0.0
angle_stepsize = .45
angtbl = {}
w,h = get_window_size()
lenset = 200

while angle < 2 * math.pi do

table.insert(angtbl,{x=lenset * math.cos(angle) + w/2, y=lenset *math.sin(angle) + h/2})

angle = angle + .1
end



add_hook("draw2d","y_test",function()

set_color(0,0,0,1)

draw_quad(0,0,w,h)
for i = 1,#angtbl do

set_color(math.random(),math.random(),math.random(),1)

draw_quad(angtbl[i].x, angtbl[i].y,4,4)
angtbl[i].x = angtbl[i].x + math.cos(math.random(0,360))*2
angtbl[i].y = angtbl[i].y + math.sin(math.random(0,360))*2

end
lenset = lenset + (150 - lenset/2)*.1

end)





also: this is good for random "explosion" particles:

lua code:

x = 0
y = 0
length = 50
angle = 0.0
angle_stepsize = .45
angtbl = {}
w,h = get_window_size()
lenset = 0
size = 4
oldtime = os.clock()

while angle < 2 * math.pi do

table.insert(angtbl,{x=lenset * math.cos(angle) + w/2, y=lenset *math.sin(angle) + h/2, dirx = math.cos(angle), diry = math.sin(angle)})
angle = angle + math.random()*2
end



add_hook("draw2d","y_test",function()
set_color(0,0,0,1)
draw_quad(0,0,w,h)
for i = 1,#angtbl do

set_color(math.random(),math.random(),math.random(),1)

draw_quad(angtbl[i].x, angtbl[i].y,size,size)
angtbl[i].x = angtbl[i].x + angtbl[i].dirx*4
angtbl[i].y = angtbl[i].y + angtbl[i].diry*4
if(size <= 0.01)then
table.remove(angtbl,i)
end
end
newtime = os.clock()
if(newtime > oldtime + .1)then
size = size - 1
oldtime = os.clock()
end

end)




aaaaand I added gravity because why not.

lua code:

x = 0
y = 0
length = 50
angle = 0.0
angle_stepsize = .45
angtbl = {}
w,h = get_window_size()
lenset = 0
size = 4
clicked = true
cursorx = 0
cursory = 0
gravity = 50





add_hook("draw2d","y_test",function()
set_color(0,0,0,1)
draw_quad(0,0,w,h)
if(clicked)then
while angle < 2 * math.pi do
table.insert(angtbl,{randgrey = math.random() * 2 - 2/2 + .5, gravity = 0, size = 7, x=lenset * math.cos(angle) + cursorx, y=lenset *math.sin(angle) + cursory, dirx = math.cos(angle), diry = math.sin(angle)})
angle = angle + math.random()*2
end
end
for i = 1,#angtbl do
set_color(math.random(),math.random(),math.random(),1)

draw_quad(angtbl[i].x, angtbl[i].y,angtbl[i].size,angtbl[i].size)
angtbl[i].size = angtbl[i].size + (0 - angtbl[i].size)*.05
angtbl[i].x = angtbl[i].x + angtbl[i].dirx*4
angtbl[i].y = (angtbl[i].y + angtbl[i].diry*4) + angtbl[i].gravity
angtbl[i].gravity = angtbl[i].gravity + (gravity - angtbl[i].gravity)*.005
if(angtbl[i].size <=0.01)then
table.remove(angtbl,i)
end
end

end)
function getmousepos(x,y)
cursorx = x
cursory = y
end
function mouseclicked(button,x,y)
clicked = true
cursorx = x
cursory = y
end
function mouseunclicked(button,x,y)
cursorx = x
cursory = y
angle = 0
end
add_hook("mouse_move","mousepos", getmousepos)
add_hook("mouse_button_down","mouseclicked",mouseclicked)
add_hook("mouse_button_up", "unclicked", mouseunclicked)

Last edited by Stupinator; Aug 23, 2015 at 09:08 AM..
Stupinator is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:27 AM.




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
ragdoll fighting game physics fighting game ragdoll fighting physics funmotion joints martial arts karate pc mac free game turn based game